pub trait StreamSource: Send {
    // Required method
    fn new_playback_stream(
        &mut self,
        num_channels: usize,
        format: SampleFormat,
        frame_rate: u32,
        buffer_size: usize
    ) -> Result<(Box<dyn StreamControl>, Box<dyn PlaybackBufferStream>), BoxError>;

    // Provided methods
    fn new_async_playback_stream(
        &mut self,
        _num_channels: usize,
        _format: SampleFormat,
        _frame_rate: u32,
        _buffer_size: usize,
        _ex: &dyn AudioStreamsExecutor
    ) -> Result<(Box<dyn StreamControl>, Box<dyn AsyncPlaybackBufferStream>), BoxError> { ... }
    fn async_new_async_playback_stream<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        num_channels: usize,
        format: SampleFormat,
        frame_rate: u32,
        buffer_size: usize,
        ex: &'life1 dyn AudioStreamsExecutor
    ) -> Pin<Box<dyn Future<Output = Result<(Box<dyn StreamControl>, Box<dyn AsyncPlaybackBufferStream>), BoxError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn new_capture_stream(
        &mut self,
        num_channels: usize,
        format: SampleFormat,
        frame_rate: u32,
        buffer_size: usize,
        _effects: &[StreamEffect]
    ) -> Result<(Box<dyn StreamControl>, Box<dyn CaptureBufferStream>), BoxError> { ... }
    fn new_async_capture_stream(
        &mut self,
        num_channels: usize,
        format: SampleFormat,
        frame_rate: u32,
        buffer_size: usize,
        _effects: &[StreamEffect],
        _ex: &dyn AudioStreamsExecutor
    ) -> Result<(Box<dyn StreamControl>, Box<dyn AsyncCaptureBufferStream>), BoxError> { ... }
    fn async_new_async_capture_stream<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        num_channels: usize,
        format: SampleFormat,
        frame_rate: u32,
        buffer_size: usize,
        effects: &'life1 [StreamEffect],
        ex: &'life2 dyn AudioStreamsExecutor
    ) -> Pin<Box<dyn Future<Output = Result<(Box<dyn StreamControl>, Box<dyn AsyncCaptureBufferStream>), BoxError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn keep_rds(&self) -> Option<Vec<RawDescriptor>> { ... }
}
Expand description

StreamSource creates streams for playback or capture of audio.

Required Methods§

source

fn new_playback_stream( &mut self, num_channels: usize, format: SampleFormat, frame_rate: u32, buffer_size: usize ) -> Result<(Box<dyn StreamControl>, Box<dyn PlaybackBufferStream>), BoxError>

Returns a stream control and buffer generator object. These are separate as the buffer generator might want to be passed to the audio stream.

Provided Methods§

source

fn new_async_playback_stream( &mut self, _num_channels: usize, _format: SampleFormat, _frame_rate: u32, _buffer_size: usize, _ex: &dyn AudioStreamsExecutor ) -> Result<(Box<dyn StreamControl>, Box<dyn AsyncPlaybackBufferStream>), BoxError>

Returns a stream control and async buffer generator object. These are separate as the buffer generator might want to be passed to the audio stream.

source

fn async_new_async_playback_stream<'life0, 'life1, 'async_trait>( &'life0 mut self, num_channels: usize, format: SampleFormat, frame_rate: u32, buffer_size: usize, ex: &'life1 dyn AudioStreamsExecutor ) -> Pin<Box<dyn Future<Output = Result<(Box<dyn StreamControl>, Box<dyn AsyncPlaybackBufferStream>), BoxError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a stream control and async buffer generator object asynchronously. Default implementation calls and blocks on new_async_playback_stream().

source

fn new_capture_stream( &mut self, num_channels: usize, format: SampleFormat, frame_rate: u32, buffer_size: usize, _effects: &[StreamEffect] ) -> Result<(Box<dyn StreamControl>, Box<dyn CaptureBufferStream>), BoxError>

Returns a stream control and buffer generator object. These are separate as the buffer generator might want to be passed to the audio stream. Default implementation returns NoopStreamControl and NoopCaptureStream.

source

fn new_async_capture_stream( &mut self, num_channels: usize, format: SampleFormat, frame_rate: u32, buffer_size: usize, _effects: &[StreamEffect], _ex: &dyn AudioStreamsExecutor ) -> Result<(Box<dyn StreamControl>, Box<dyn AsyncCaptureBufferStream>), BoxError>

Returns a stream control and async buffer generator object. These are separate as the buffer generator might want to be passed to the audio stream. Default implementation returns NoopStreamControl and NoopCaptureStream.

source

fn async_new_async_capture_stream<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, num_channels: usize, format: SampleFormat, frame_rate: u32, buffer_size: usize, effects: &'life1 [StreamEffect], ex: &'life2 dyn AudioStreamsExecutor ) -> Pin<Box<dyn Future<Output = Result<(Box<dyn StreamControl>, Box<dyn AsyncCaptureBufferStream>), BoxError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Returns a stream control and async buffer generator object asynchronously. Default implementation calls and blocks on new_async_capture_stream().

source

fn keep_rds(&self) -> Option<Vec<RawDescriptor>>

Returns any open file descriptors needed by the implementor. The FD list helps users of the StreamSource enter Linux jails making sure not to close needed FDs.

Implementors§