This is true ALSA multi-threaded capturing! This my first, ALSA and POSIX thread application. Happy that it works as intended(well I hope the cubes jumped much higher but hey..they jump!). Drawing is done on one thread and the capturing is done on another. Make sure you set the recording source for ALSA to your system out. It was easy for me because ALSA is managed(to an extent) by PulseAudio(don’t worry, the application does not include anything PulseAudio). pavucontrol makes it easier to set the source to the system’s output’s monitor.
Here’s how to compile this,
g++ -I. -o dance ogl.cc alsa.cc -DdDOUBLE -lGL -lGLU -lglut -lode -lasound
Please have the ALSA development package installed.
ALSA code was ripped out from Linux Journal’s web site, thank you!