|
From: Kevin N. <bea...@ya...> - 2005-02-08 21:28:09
|
I asked the libsdl list about piping audio to stdout and here's the response. It looks like the AudioPlayer callback function is what is doing all the data transfer. It uses the memset() and memcpy() functions to move "character" data from one memory address to another. Do you know if stdout has a specific address or do you think I should just use a std::cout stream, or even a printf type function to do this. Kevin > 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: putenv("SDL_AUDIODRIVER=disk"); putenv("SDL_DISKAUDIODELAY=0"); 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 you. ===== Manage your PEZ collection online. Visit PezBase at http://pezbase.beakerboy.com __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail |