recently, I wrote a simple driver for the more than ancient Sound Blaster 16:
https://github.com/vvaltchev/tilck/tree ... eneric_x86
I knew QEMU supported only the original SB16 (ISA) and that my driver will ever work only on virtual machines,
but that was fine because it's simplest sound card I could think of, and we have some simple and clear documentation
for it: https://wiki.osdev.org/Sound_Blaster_16
But, I hit a nasty QEMU bug:
https://bugs.launchpad.net/qemu/+bug/1873769
QEMU's bug description
Briefly, QEMU's window freezes while audio is playing because GTK's window event loop
and the ISA DMA emulation share the same thread. The good thing is that, I'm not the only
one that hit the issue, as the guy who created the bug shows a video with Windows 95 having
the exact same problem.
Why I'm posting here
I saw posts by people trying to write a driver for this simple sound card, and I believe
it makes sense to warn anyone interested in doing so, before starting. Also, people
affected by this bug can comment and/or click "this bug affects also me" in the bug's page on
launchpad.net.
Workarounds
1. Use an older version of QEMU. With QEMU 2.11 the problem simply does not exist.
2. Use virt-manager which connects to QEMU using Spice. The problem does not
exist in this case because QEMU's GTK UI is not used. BUT, configuring QEMU to emulate
Sound Blaster 16 through virt-manager requires some tricky settings:
- - Add any sound card to the VM
- In virt-manager's Edit -> Preferences menu check the "Enable XML editing" box.
- Open VM's hardware and after selecting the sound card, click on the XML tab and replace its contents with:Code: Select all
<sound model="sb16"/>
there will be no "freeze", but there still be some flickering in the audio.
Conclusion
QEMU's support for Sound Blaster 16 is broken, but despite that it's still possible to write a driver
for that ancient sound card and it's overall good for educational purposes. At the end, with the virt-manager
workaround I managed to get my driver working and now its possible to play WAV files on Tilck. Just, If I had
to write a new sound driver now, I'd choose:
https://wiki.osdev.org/Ensoniq_AudioPCI
Instead. Also, its worth noting that the Linux kernel has no support for the ISA sb16, maybe that's why
QEMU's sb16 emulation is not tested often.
What do you think about? I hope my experience will be useful to someone.
Vlad