[−][src]Struct cpal::EventLoop
Collection of voices managed together.
Created with the new
method.
Methods
impl EventLoop
[src]
pub fn new() -> EventLoop
[src]
Initializes a new events loop.
pub fn build_input_stream(
&self,
device: &Device,
format: &Format
) -> Result<StreamId, CreationError>
[src]
&self,
device: &Device,
format: &Format
) -> Result<StreamId, CreationError>
Creates a new input stream that will run from the given device and with the given format.
On success, returns an identifier for the stream.
Can return an error if the device is no longer valid, or if the input stream format is not supported by the device.
pub fn build_output_stream(
&self,
device: &Device,
format: &Format
) -> Result<StreamId, CreationError>
[src]
&self,
device: &Device,
format: &Format
) -> Result<StreamId, CreationError>
Creates a new output stream that will play on the given device and with the given format.
On success, returns an identifier for the stream.
Can return an error if the device is no longer valid, or if the output stream format is not supported by the device.
pub fn play_stream(&self, stream: StreamId)
[src]
Instructs the audio device that it should start playing the stream with the given ID.
Has no effect is the stream was already playing.
Only call this after you have submitted some data, otherwise you may hear some glitches.
Panic
If the stream does not exist, this function can either panic or be a no-op.
pub fn pause_stream(&self, stream: StreamId)
[src]
Instructs the audio device that it should stop playing the stream with the given ID.
Has no effect is the stream was already paused.
If you call play
afterwards, the playback will resume where it was.
Panic
If the stream does not exist, this function can either panic or be a no-op.
pub fn destroy_stream(&self, stream_id: StreamId)
[src]
Destroys an existing stream.
Panic
If the stream does not exist, this function can either panic or be a no-op.
pub fn run<F>(&self, callback: F) -> ! where
F: FnMut(StreamId, StreamData) + Send,
[src]
F: FnMut(StreamId, StreamData) + Send,
Takes control of the current thread and begins the stream processing.
Note: Since it takes control of the thread, this method is best called on a separate thread.
Whenever a stream needs to be fed some data, the closure passed as parameter is called.
You can call the other methods of EventLoop
without getting a deadlock.
Auto Trait Implementations
impl Unpin for EventLoop
impl Sync for EventLoop
impl Send for EventLoop
impl UnwindSafe for EventLoop
impl RefUnwindSafe for EventLoop
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,