Luna::AHI::playback_callback_t
using playback_callback_t = u32(void* dst_buffer, const WaveFormat& format, u32 num_frames)
Called when audio data is required by the audio driver. The user should write audio frames to the provided audio buffer for playback.
This callback function is invoked in a dedicated audio thread, so the user must use synchronization mechanisms if needed. If this function takes too much time to return, the audio playback may be paused since the audio driver could not take enough audio frames for playback.
Parameters
-
in dst_buffer
The buffer to write audio frames to. The write data must not exceed
num_frames * get_frame_size(format.bit_depth, format.num_channels)
bytes. -
in format
The required wave format.
-
in num_frames
The required number of frames to write. If the actual number of frames written is smaller than required, frames that is not written will be muted (filled with 0).
Return value
Returns the number of frames actually written.