Provided by: libsdl3-doc_3.2.8+ds-1_all bug

NAME

       SDL_AudioStreamCallback - A callback that fires when data passes through an SDL_AudioStream .

HEADER FILE

       Defined in SDL3/SDL_audio.h

SYNOPSIS

       #include "SDL3/SDL.h"

       typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount);

DESCRIPTION

       Apps can (optionally) register a callback with an audio stream that is called when data is added with

       SDL_PutAudioStreamData , or requested with

       SDL_GetAudioStreamData .

       Two values are offered here: one is the amount of additional data needed to satisfy the immediate request
       (which  might  be  zero  if  the stream already has enough data queued) and the other is the total amount
       being requested.  In a Get call triggering a Put callback, these values can be different. In a  Put  call
       triggering a Get callback, these values are always the same.

       Byte  counts  might be slightly overestimated due to buffering or resampling, and may change from call to
       call.

       This callback is not required to do anything. Generally this is useful for adding/reading data on demand,
       and the app will often put/get data as appropriate, but the  system  goes  on  with  the  data  currently
       available to it if this callback does nothing.

FUNCTION PARAMETERS

       stream the SDL audio stream associated with this callback.

       additional_amount
              the amount of data, in bytes, that is needed right now.

       total_amount
              the total amount of data requested, in bytes, that is requested or available.

       userdata
              an opaque pointer provided by the app for their personal use.

THREAD SAFETY

       This  callbacks  may  run  from  any  thread,  so  if  you  need  to  protect shared data, you should use
       SDL_LockAudioStream
        to serialize access; this lock will be held before your callback is called, so your  callback  does  not
       need to manage the lock explicitly.

AVAILABILITY

       This datatype is available since SDL 3.2.0.

SEE ALSO

       (3), SDL_SetAudioStreamGetCallback(3), (3), SDL_SetAudioStreamPutCallback(3)

Simple Directmedia Layer                            SDL 3.2.8                     SDL_AudioStreamCallback(3type)