[SDL] Redirecting audio to stdout in linux
Ryan C. Gordon
icculus at clutteredmind.org
Tue Feb 8 11:38:49 PST 2005
> I'm working on a console based music jukebox called
> tjukebox (http://www.sf.net/projects/tjukebox). I'm
> using SDL_sound to take care of all the file
> translations and SDL for the sound output. I'd like
> to follow the Linux tradition of allowing users to
> link software together and I want to use stdout as
> that bridge. How do I force SDL to write the
> audiostream to stdout instead of /dev/dsp.
You _could_ change SDL12/src/audio/disk/SDL_diskaudio.c to use stdout
instead of a filename in the DISKAUD_OpenAudio() function.
Then add this to your program before initializing SDL:
The DISKAUDIODELAY makes the SDL audio callback run continuously, which
is probably what you want for something that's just piping to another
program. "150" is a better value if you want a timing-specific
simulation of a real audio device (which some programs need to function
correctly with diskaudio).
But really, you're better off just writing the stream to stdout directly
when piping, since that'll be cleaner than hacking up SDL to do it for
More information about the SDL