Tested on OSS4 (4front), FreeBSD 7.2 OSS and with ALSA's OSS emulation. Bear with me, this is both my first serious C++ and OSS code. Originally committed to SVN as r3497.