Trait audio_streams::AsyncBufferCommit
source · pub trait AsyncBufferCommit {
// Required method
fn commit<'life0, 'async_trait>(
&'life0 mut self,
nframes: usize
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn latency_bytes(&self) -> u32 { ... }
}
Expand description
AsyncBufferCommit
is a cleanup funcion that must be called before dropping the buffer,
allowing arbitrary code to be run after the buffer is filled or read by the user.
Required Methods§
sourcefn commit<'life0, 'async_trait>(
&'life0 mut self,
nframes: usize
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn commit<'life0, 'async_trait>(
&'life0 mut self,
nframes: usize
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
async_write_playback_buffer
or async_read_capture_buffer
would trigger this
automatically. nframes
indicates the number of audio frames that were read or written to
the device.
Provided Methods§
sourcefn latency_bytes(&self) -> u32
fn latency_bytes(&self) -> u32
latency_bytes
the current device latency.
For playback it means how many bytes need to be consumed
before the current playback buffer will be played.
For capture it means the latency in terms of bytes that the capture buffer was recorded.