Problem Statement
We cannot know if the audio stream has encountered an underflow or overflow. This is crucial for some applications that need to know if some audio data has been dropped.
Proposed Solution
We should have an additional dropped flag on AudioInput and AudioOutput to indicate when such events have occured.
Alternative Solutions
Add additional on_audio_data_dropped methods on the callback traits, though this would probably require the user to set up some additional state in their audio processor type just to be able to react to it at the next audio callback. I think the solution above of the boolean value on the input/output context is better.
Example Usage
Provide an example of how this feature would be used:
fn on_audio_data(
&mut self,
context: AudioCallbackContext,
input: AudioInput<f32>,
output: AudioOutput<f32>,
) {
if(input.dropped) {
// Notify input underflow
}
if(output.dropped) {
// Notify output overflow
}
}
Checklist