It would be useful if sound was enabled by default by the runqemu script. To enable sound manually I found I needed to do three things: 1) export QEMU_AUDIO_DRV=alsa (otherwise it defaults to oss, which is not available by default on my Ubuntu system) 2) Add qemuparams="-soundhw all" to runqemu command line (you can select drivers more specifically, but given there are only three supported drivers I don't think it matters) 3) modprobe snd-ens1370 within the running system - apparently we already install the appropriate kernel module, we just need to auto-load it.
Created attachment 280 [details] Patch 1 to enable sound
Created attachment 281 [details] Patch 2 to enable sound
I tried this (patches attached). I ran into the complexity of my system running pulseaudio. To make this work we'd need to enable pulseaudio in qemu-native/nativesdk by building pulseaudio as a dependency for qemu. We could really use a way to turn these features on/off in the qemu script.
Surely you don't *need* pulseaudio support in an application just to play sound with it installed? I was under the impression it provided a standard ALSA interface.
Running qemu complained my alsa device was locked, presumably by pulseaudio which was active on the system. Qemu also has a pulseaudio specific backend...
Using pulseaudio as the audio backend for qemu works, however, it is my understanding that not all Linux distros rely on pulseaudio server for audio services. This would basically mean, at a minimal level, to detect at runtime (runqemu) which audio server is used (pa, alsa, oss) and set qccordingly qemu. Another issue that needs to get solved is that sound from guest machines is muted while using qemu's pulseaudio backend. This also needs to get fixed. Finally, a little bit of cleanup needs to be performed in qemu scripts (runqemu).
*** Bug 5602 has been marked as a duplicate of this bug. ***
Now the audio support is controlled by bsp, it can set QB_AUDIO_DRV, QB_AUDIO_DRV and QB_AUDIO_OPT, see meta/classes/qemuboot.bbclass for more info. Merged into master: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=b405712414de98cba3a645601419aceb32d52f02 And qemux86, qemux86-64's sound support had been done.