[SDL] GameCube audio back end, format conversion
Ryan C. Gordon
icculus at icculus.org
Tue Aug 7 04:33:36 PDT 2007
A Gamecube backend? Sweet. :)
> Because the GC doesn't need threads to supply audio, I'm writing my
> back end in a way that the user's callback will get called during my
> DMA callback. Is this safe? (I may have to go for threading if it
> turns out people put lots of processing in their mix callbacks.)
Look at what the Mac OS 9 target does. It fires the SDL audio callback
in a hardware interrupt, and takes some effort to deal with long-running
callbacks, without using real threads for any of it.
http://www.libsdl.org/cgi/viewvc.cgi?view=rev&revision=579
Look for "SDL_LockAudio on MacOS" emails in the mailing list archives
around March 2002 for all the discussion about how this works.
> What I'm seeing though, is that while samples are being converted to
> big endian and from mono to stereo, no rate conversion is being done
> (22050 -> 32000).
SDL 1.2 will only resample audio if it's a power of two (11025 -> 22050
-> 44100, etc, but not 44100 -> 48000). If you have to resample to
something else, bad things happen.
This is long overdue to be fixed, and will be fixed for SDL 1.3.
> If it's possible I would love to have someone peek at my source code
> to see if I'm doing anything wrong. I've attached it to this mail.
In this case, it's probably 100% not your bug. :/
--ryan.
More information about the SDL
mailing list