memory allocation in snd_alsa.c

Jamie Wilkinson jaq at
Sun Feb 1 09:20:25 EST 2004

I wrote a libao output driver last night, and was looking at snd_alsa
for clues, but noticed that despite dma.buffer being pointed to buffer,
neither of them were actually getting allocated.  I then looked at
snd_arts.c, which it looks like snd_alsa.c was derived from, and that
actually does malloc some space for buffer.  There's also a free in
SNDDMA_Shutdown which will probably crash.

Does snd_alsa.c actually work?  I haven't tried it but it looks like the
first attempt to fill the buffer will crash.

Also, the buffer size is hardcoded to be dma.samples * 2 big, with the
#define snf_buf at the start.  The snd_linux.c and other OS specific
audio code use dma.samples * dma.samplebits / 8 for the size of the
buffer, as they can take 8 or 16 bit samples.  Just pointing that out in
case someone wanted to use 24 or 32 bit samples in the future.

finger jaq at       

More information about the quake2 mailing list