| 1 | VirtIO Sound |
| 2 | ============ |
| 3 | |
| 4 | This document explains the setup and usage of the Virtio sound device. |
| 5 | The Virtio sound device is a paravirtualized sound card device. |
| 6 | |
| 7 | Linux kernel support |
| 8 | -------------------- |
| 9 | |
| 10 | Virtio sound requires a guest Linux kernel built with the |
| 11 | ``CONFIG_SND_VIRTIO`` option. |
| 12 | |
| 13 | Description |
| 14 | ----------- |
| 15 | |
| 16 | Virtio sound implements capture and playback from inside a guest using the |
| 17 | configured audio backend of the host machine. |
| 18 | |
| 19 | Device properties |
| 20 | ----------------- |
| 21 | |
| 22 | The Virtio sound device can be configured with the following properties: |
| 23 | |
| 24 | * ``jacks`` number of physical jacks (Unimplemented). |
| 25 | * ``streams`` number of PCM streams. At the moment, no stream configuration is supported: the first one will always be a playback stream, an optional second will always be a capture stream. Adding more will cycle stream directions from playback to capture. |
| 26 | * ``chmaps`` number of channel maps (Unimplemented). |
| 27 | |
| 28 | All streams are stereo and have the default channel positions ``Front left, right``. |
| 29 | |
| 30 | Examples |
| 31 | -------- |
| 32 | |
| 33 | Add an audio device and an audio backend at once with ``-audio`` and ``model=virtio``: |
| 34 | |
| 35 | * pulseaudio: ``-audio driver=pa,model=virtio`` |
| 36 | or ``-audio driver=pa,model=virtio,server=/run/user/1000/pulse/native`` |
| 37 | * sdl: ``-audio driver=sdl,model=virtio`` |
| 38 | * coreaudio: ``-audio driver=coreaudio,model=virtio`` |
| 39 | |
| 40 | etc. |
| 41 | |
| 42 | To specifically add virtualized sound devices, you have to specify a PCI device |
| 43 | and an audio backend listed with ``-audio driver=help`` that works on your host |
| 44 | machine, e.g.: |
| 45 | |
| 46 | :: |
| 47 | |
| 48 | -device virtio-sound-pci,audiodev=my_audiodev \ |
| 49 | -audiodev alsa,id=my_audiodev |