|
@@ -991,11 +991,7 @@ extern DECLSPEC int SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream);
|
|
|
*
|
|
|
* 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. These 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 by
|
|
|
- * before your callback is called, so your callback does not need to
|
|
|
- * manage the lock explicitly.
|
|
|
+ * 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
|
|
@@ -1011,6 +1007,17 @@ extern DECLSPEC int SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream);
|
|
|
* \param additional_amount The amount of data, in bytes, that is needed right now.
|
|
|
* \param total_amount The total amount of data requested, in bytes, that is requested or available.
|
|
|
* \param userdata An opaque pointer provided by the app for their personal use.
|
|
|
+ *
|
|
|
+ * \threadsafety 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.
|
|
|
+ *
|
|
|
+ * \since This datatype is available since SDL 3.0.0.
|
|
|
+ *
|
|
|
+ * \sa SDL_SetAudioStreamGetCallback
|
|
|
+ * \sa SDL_SetAudioStreamPutCallback
|
|
|
*/
|
|
|
typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount);
|
|
|
|
|
@@ -1185,6 +1192,29 @@ extern DECLSPEC SDL_AudioStream *SDLCALL SDL_OpenAudioDeviceStream(SDL_AudioDevi
|
|
|
* This is useful for accessing the final mix, perhaps for writing a
|
|
|
* visualizer or applying a final effect to the audio data before playback.
|
|
|
*
|
|
|
+ * This callback should run as quickly as possible and not block for any
|
|
|
+ * significant time, as this callback delays submission of data to the audio
|
|
|
+ * device, which can cause audio playback problems.
|
|
|
+ *
|
|
|
+ * The postmix callback _must_ be able to handle any audio data format
|
|
|
+ * specified in `spec`, which can change between callbacks if the audio
|
|
|
+ * device changed. However, this only covers frequency and channel count;
|
|
|
+ * data is always provided here in SDL_AUDIO_F32 format.
|
|
|
+ *
|
|
|
+ * \param userdata a pointer provided by the app through
|
|
|
+ * SDL_SetAudioDevicePostmixCallback, for its own use.
|
|
|
+ * \param spec the current format of audio that is to be submitted to the
|
|
|
+ * audio device.
|
|
|
+ * \param buffer the buffer of audio samples to be submitted. The callback
|
|
|
+ * can inspect and/or modify this data.
|
|
|
+ * \param buflen the size of `buffer` in bytes.
|
|
|
+ *
|
|
|
+ * \threadsafety This will run from a background thread owned by SDL.
|
|
|
+ * The application is responsible for locking resources the
|
|
|
+ * callback touches that need to be protected.
|
|
|
+ *
|
|
|
+ * \since This datatype is available since SDL 3.0.0.
|
|
|
+ *
|
|
|
* \sa SDL_SetAudioDevicePostmixCallback
|
|
|
*/
|
|
|
typedef void (SDLCALL *SDL_AudioPostmixCallback)(void *userdata, const SDL_AudioSpec *spec, float *buffer, int buflen);
|