Updated: October 28, 2024 |
Provide audio functionality to guests running in hypervisor VMs
vdev virtio-snd [loc addr intr intr] [stream type [nid node_id] [rates audio_rates] [formats audio_formats] [channels numbers_of_channels | chmap map *] [pcmpath host_path] [audio_type type] ]* [control name [nid node_id] [ctlpath mixer_control_path] [switchname mixer_switch_name] [switchdev mixer_switch_device] [groupname mixer_group_name] [groupindex mixer_group_index] [groupcaps mixer_capabilities] ]*
This option establishes a context: all options that follow are parameters that apply to this context until another stream option, a control option, or the end of the vdev configuration is reached.
If you don't specify any parameters for this stream, the vdev sets the pcmpath option to either pcmPreferredp for a playback stream or pcmPreferredc for a capture stream. For all other parameters (except for the audio_type option which applies only to playback streams), the vdev defaults to the hardware capabilities of pcmPreferredp and pcmPreferredc for playback and capture PCM streams, respectively, in the host. For playback streams where you don't specify any parameters, the audio_type option's default is "" (the empty string), which gets interpreted as the default audio type.
This can be a list of discreet rates or the minimum and maximum rates. In the first case, the audio_rates string must be a colon-separated list: rate1[:rate2[...]*]. In the second case, it must be a hyphen-separated value pair: min_rate-max_rate.
|
|
vdev virtio-snd ... stream playback pcmpath pcmPreferredp rates 44100:48000:96000 ...
|
|
vdev virtio-snd ... stream playback pcmpath pcmPreferredp formats s16:s32:s24_3:s24 ...
This option can contain a list of discreet numbers of channels or a range of channels. In the first case, the numbers_of_channels string must be a colon-separated list: num1[:num2[...]*]. In the second case, it must be a hyphen-separated value pair: min_channels-max_channels.
All host channel maps with a number of channels satisfying this option are exported to the guest. If discreet numbers are given (the first case), then a channel map satifies this option if its number of channel positions matches one of the values in the list. If a range of channels is given (the second case), then a channel map satisfies this option if its number of channel positions falls within the specified range.
If channels is not specified, the full range of minimum and maximum channels of the host PCM device is exported. The channels option may not be used if chmap is defined.
You may define multiple chmap options, with each on its own line. A chmap option contains a list of mappings of guest and host channel positions. Each mapping is a pair of strings that are separated by an equal sign (=). Different mappings are separated by a colon (:). Thus, the map string is formatted as follows: guest_chpos1=host_chpos1:guest_chpos2=host_chpos2
|
|
chmap guest_fl=host_fl:guest_fr=host_flIn this case, audio playback on both the front left and front right guest positions is mixed and directed to the front left position on the host, while audio capture from the front left host position is presented as audio on both guest positions.
chmap guest_mono=host_fl,host_frHere, audio playback from the single guest position will be written to both the front left and front right positions on the host, while audio capture from the front left and front right host positions will be mixed and presented to the guest as a single channel position (mono).
If one channel map is specified explicitly for a guest, then all channel maps to be exported to that guest must be specified explicitly, using as many chmap options as needed.
If chmap is not specified, all host channel mappings that satisfy the channels option (if it's defined) are exported; for details, see above. The chmap option may not be used if channels is defined.
vdev virtio-snd ... stream playback pcmpath pcmPreferredp ... stream capture pcmpath pcmPreferredc ...will create the following paths for audio playback and capture in the host and the guest:
Host | Guest | |
---|---|---|
Playback | /dev/snd/pcmPreferredp | /dev/snd/pcmC0D0p |
Capture | /dev/snd/pcmPreferredc | /dev/snd/pcmC0D0c |
/dev/snd/pcmCcardDdevicetypewhere:
Set the audio type that the host must use for mixed audio that the guest plays in the current audio stream. For playback streams only.
The host must not use any audio types that can be preempted by higher priority audio types. The preemptable audio types are those that have the preemptable property enabled in the audio type definition that is part of the audio policy configuration file.
If you don't specify this option, an audio type of default is used. For more information on audio types, preemption, and the syntax of the policy configuration file, see the Audio Concurrency Management chapter of the Audio Developer's Guide.
This option establishes a context: all options that follow are parameters that apply to this context until another control option, a stream option, or the end of the vdev configuration is reached.
If you set this option for a control, you can't set any group* options.
If you set this option for a control, you can't set any group* options.
If you set this option for a control, you can't set any switch* options.
If you set this option for a control, you can't set any switch* options.
If you set this option for a control, you can't set any switch* options.
(ARM and x86) This audio vdev provides guests with access to audio functionality in the host. The vdev configuration can include any number of stream options, which allow the guest to access playback and/or capture streams for PCM devices in the host.
The options that immediately follow a stream option configure properties of that audio stream. If you specify the pcmpath option, but don't provide any further options, the configuration uses the hardware capabilities of the specified host PCM device.
To take advantage of the audio management capabilities of the host, you can configure the vdev, through the audio_type option, to replicate any host playback PCM channel for any audio type supported on the host.
Use the other channel configuration options (rates, formats, etc.) to restrict the capabilities made available to the guest's VirtIO sound driver; this allows the guest driver to use only a subset of the capabilities provided by the PCM channel in the host. For example, if the PCM channel supports rates of 48000:44100:32000, but the audio vdev's rates option is set to 44100, the driver advertises only this particular rate to clients in the guest. Using this strategy, you can lock the sample rate used in the guest to a single value.
The vdev configuration can include control options, and related options that immediately follow, to configure properties of audio controls. These options are virtio-snd extensions. For Android guests, Automotive Android requires the host to expose audio controls specific to the use of Bluetooth HFP voice; these controls can be made available to the guest through the audio controls extensions.
For a given audio control, you must provide its device path on the host, and you must name either a host mixer switch or host mixer group and configure its properties. For groups, you can indicate the audio capabilities available to the guest, such as volume setting, muting, and fading.
If the host is an x86-based platform, or if a PCI server is set up in a guest, you can omit the loc and intr options. The vdev then presents itself to the guest via the PCI bus, with the vendor ID/device ID pair 0x1C05/0xF000, where 0x1C05 is the BlackBerry vendor ID and 0xF000 is the device ID.
Otherwise, you need to specify these options as part of the VM configuration file (*.qvmconf) for the guest; the values you specify are passed to the guest driver, deva-ctrl-virtio. For more information, see Common vdev options in the Virtual Device Reference chapter in the QNX Hypervisor User's Guide.
vdev virtio-snd loc 0x20020000 intr gic:47 stream playback nid 0 pcmpath pcmPreferredp stream capture nid 0 pcmpath pcmPreferredc formats s16