Trait cpal::traits::StreamTrait

source ·
pub trait StreamTrait {
    // Required methods
    fn play(&self) -> Result<(), PlayStreamError>;
    fn pause(&self) -> Result<(), PauseStreamError>;
}
Expand description

A stream created from Device, with methods to control playback.

Required Methods§

source

fn play(&self) -> Result<(), PlayStreamError>

Run the stream.

Note: Not all platforms automatically run the stream upon creation, so it is important to call play after creation if it is expected that the stream should run immediately.

source

fn pause(&self) -> Result<(), PauseStreamError>

Some devices support pausing the audio stream. This can be useful for saving energy in moments of silence.

Note: Not all devices support suspending the stream at the hardware level. This method may fail in these cases.

Implementors§

source§

impl StreamTrait for cpal::platform::AlsaStream

source§

impl StreamTrait for cpal::platform::Stream