How to work with audio data while streaming?

Hey,

can anybody show me, how I would manipulate audio data while playing it? I’ll try to compute the samples on my own (changing volume by manipulate the amplitude f.e.). But I’m not sure how I could calculate the values for lets say, the next second, stream the data to an audio device without stopping it and calculate the second after that?!

Greets

Your choices are to use the ‘pull’ approach (specify a callback function in your SDL_AudioSpec() structure) in which case SDL will call your function when it needs more data, or the ‘push’ approach (specify NULL as the callback) in which case you must call SDL_QueueAudio() to send more audio data. In the latter case you can monitor how much audio data remains unplayed by calling SDL_GetQueuedAudioSize().

1 Like

Thx. I’ll try it tomorrow morning :slight_smile: