Struct cpal::EventLoop [] [src]

pub struct EventLoop(_);

Collection of voices managed together.

Created with the new method.

Methods

impl EventLoop
[src]

[src]

Initializes a new events loop.

[src]

Creates a new voice that will play on the given endpoint and with the given format.

On success, returns an identifier for the voice.

Can return an error if the endpoint is no longer valid, or if the format is not supported by the endpoint.

[src]

Destroys an existing voice.

Panic

If the voice doesn't exist, this function can either panic or be a no-op.

[src]

Takes control of the current thread and processes the sounds.

Note: Since it takes control of the thread, this method is best called on a separate thread.

Whenever a voice 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.

[src]

Instructs the audio device that it should start playing.

Has no effect is the voice was already playing.

Only call this after you have submitted some data, otherwise you may hear some glitches.

Panic

If the voice doesn't exist, this function can either panic or be a no-op.

[src]

Instructs the audio device that it should stop playing.

Has no effect is the voice was already paused.

If you call play afterwards, the playback will resume where it was.

Panic

If the voice doesn't exist, this function can either panic or be a no-op.