API reference / Audio
SDL_GetAudioStreamQueued
Function, SDL3
Gets the number of bytes that wait in a stream.
Declaration
#include <SDL3/SDL.h>
int SDL_GetAudioStreamQueued(SDL_AudioStream *stream);Parameters
stream | The stream. |
Return value
The number of bytes, or -1 on failure.
Example
while (SDL_GetAudioStreamQueued(stream) < KEEP_QUEUED * (int)sizeof(float)) {
float samples[CHUNK_SAMPLES];
make_samples(samples, CHUNK_SAMPLES);
SDL_PutAudioStreamData(stream, samples, sizeof(samples));
}See this code run in Make a tone. Download the full program (.zip)
Notes
- Use this to add more sound before the stream runs out.
In SDL2
Use SDL_GetQueuedAudioSize.