Skip to main content

SDL_AudioStreamDataCompleteCallback

Type Alias SDL_AudioStreamDataCompleteCallback 

Source
pub type SDL_AudioStreamDataCompleteCallback = Option<unsafe extern "C" fn(userdata: *mut c_void, buf: *const c_void, buflen: c_int)>;
Expand description

A callback that fires for completed SDL_PutAudioStreamDataNoCopy() data.

When using SDL_PutAudioStreamDataNoCopy() to provide data to an SDL_AudioStream, it’s not safe to dispose of the data until the stream has completely consumed it. Often times it’s difficult to know exactly when this has happened.

This callback fires once when the stream no longer needs the buffer, allowing the app to easily free or reuse it.

Parameter: userdata an opaque pointer provided by the app for their personal use. Parameter: buf the pointer provided to SDL_PutAudioStreamDataNoCopy(). Parameter: buflen the size of buffer, in bytes, provided to SDL_PutAudioStreamDataNoCopy().

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.

Available Since: This datatype is available since SDL 3.4.0.

See Also: SDL_SetAudioStreamGetCallback See Also: SDL_SetAudioStreamPutCallback

Aliased Type§

pub enum SDL_AudioStreamDataCompleteCallback {
    None,
    Some(unsafe extern "C" fn(*mut c_void, *const c_void, i32)),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(*mut c_void, *const c_void, i32))

Some value of type T.