The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Re: Play the buffer
Carabut Nicolae
Guest

Hello,

I have found answers to my question, thank you.
I guess last time I took it too hard ;)

Nicu.


Carabut Nicolae wrote:

Quote:
Hello,
my name is Carabut Nicolae.


I've recently started with the SDL. While digging into the docs and
code samples, I've came to the idea that there is a lack of clean
documentation.

So here is my question:
I have a music file (ogg, mp3 ... whatever), I have kind of code which
in a loop is decoding the format througth a corresponding library, and
at some point I have buffer with data in decoded format which normally
should be plaied on the audio device.

This is how I see the logic it should be
/**************** logic of a chunk of code (AAA)**************/
SDL_OpenAudio();

loop
{
decode( input_buffer, output_buffer );

play_to_device( output_buffer ); // how to implement this one ??
}

SDL_CloseAudio();
/*********************************************************/


But in the documentation I saw a kind of callback() which is called
after the call of "SDL_Pause(0)" ...


Please help me to have the implementation that I see (AAA), or point
some docs to refer something analogical.

Or, help me to understand what should do the 'callback()' function, or
point some links to explanations of that one.


I have tried the 'SDL_sound' and 'SDL_mixer' sources to clear out the
things, but there is an unclean and anoying code.

Thank you,
Nicu.