Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default value for audio driver #2456

Merged
merged 3 commits into from
Jul 5, 2024

Conversation

afbjorklund
Copy link
Member

@afbjorklund afbjorklund commented Jun 30, 2024

Can now use .audio.device=default similar to .video.display=default

audio:
  device: default
video:
  display: default

You can still pick another driver, such as alsa or oss, if you want.

Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "default" should also work with VZ and just be an alias for "vz" in that case.

Also maybe "none" should work for VZ as well and be an alias for ""?

@@ -297,6 +297,7 @@ audio:
# QEMU audiodev, e.g., "none", "coreaudio", "pa", "alsa", "oss".
# VZ driver, use "vz" as device name
# Choosing "none" will mute the audio output, and not play any sound.
# Choosing "default" will pick the default for the operating system.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we explicitly list the default values for each os:

# macOS: "coreaudio" or "vz", Linux: "pa", Windows: "dsound", otherwise "oss"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just listed all of them, like we do for the video display

@@ -297,6 +297,7 @@ audio:
# QEMU audiodev, e.g., "none", "coreaudio", "pa", "alsa", "oss".
# VZ driver, use "vz" as device name
# Choosing "none" will mute the audio output, and not play any sound.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is not part of this PR, but reading the docs here makes me wonder what the difference is between "" and "none" beyond that "none" doesn't work with VZ. Why would you use "none" instead of just leaving off the audio device?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually some distributions don't work properly without an audio card, so the default ("") is to add one but leave it disconnected to any speakers. It can be explicitly removed ("none"), if you know that the OS will still boot...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the comment is actually wrong. It is "" that is muting the audio, and "none" that removes the driver.

And I still think it needs to be clarified that "default" doesn't apply to VZ. This could be as simple as moving the VZ line all the way to the bottom (on top of the "Builtin default" line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, "" omits the qemu flag

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this is end-user documentation. We should not punt by telling them to read the qemu docs and the Lima sources, but explain what each valid choice does, and why they would want to pick "" over "none" or vice versa. Or just drop "none" from our comments if there is no reason a user would ever want that.

Copy link
Member Author

@afbjorklund afbjorklund Jul 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defaults changed again in QEMU 8.2, so if we want to document what the default drivers are - it needs some more research and testing.

@AkihiroSuda AkihiroSuda added this to the v0.23.0 (tentative) milestone Jun 30, 2024
@afbjorklund afbjorklund marked this pull request as draft July 1, 2024 05:45
@afbjorklund
Copy link
Member Author

afbjorklund commented Jul 1, 2024

This probably needs a testing template, as well. If nothing else, you need to add linux-modules-extra and alsa-utils.

I would normally test with mikmod and https://modarchive.org/, but I suppose that part can be left up to the user...

@afbjorklund
Copy link
Member Author

afbjorklund commented Jul 2, 2024

Added example:

 0 - Front Left
 1 - Front Right
Time per period = 3.017038
 0 - Front Left
 1 - Front Right
Time per period = 3.049002

This example uses sudo, since there is not yet a good way to add the user to the "audio" group

@afbjorklund afbjorklund marked this pull request as ready for review July 2, 2024 08:53
Can now use .audio.device=default similar to .video.display=default

You can still pick another driver, such as alsa or oss, if you want.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but one superfluous argument in the Warnf call.

pkg/vz/vz_driver_darwin.go Outdated Show resolved Hide resolved
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM.

@@ -297,6 +297,9 @@ audio:
# QEMU audiodev, e.g., "none", "coreaudio", "pa", "alsa", "oss".
# VZ driver, use "vz" as device name
# Choosing "none" will mute the audio output, and not play any sound.
# Choosing "default" will pick a suitable of: coreudio, pa, dsound, oss.
# As of QEMU v6.2 the default is to create a disconnected sound device
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still ambiguous if "the default" means when it is set to "default" or to "the builtin default" "".

But maybe it doesn't really matter, practically speaking.

@jandubois jandubois merged commit 04363c0 into lima-vm:master Jul 5, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants