pub struct AudioOutput(/* private fields */);Expand description
Represents an open audio output stream.
You can use AUDIOS.open_output to open a new output stream.
Implementations§
Source§impl AudioOutput
impl AudioOutput
Sourcepub fn id(&self) -> AudioOutputId
pub fn id(&self) -> AudioOutputId
Unique ID of this output.
Sourcepub fn cue(&self, audio: impl Into<AudioMix>)
pub fn cue(&self, audio: impl Into<AudioMix>)
Enqueue the audio for playback in this output.
The audio will play when the output is playing and the previous cued audio finishes.
Sourcepub fn volume(&self) -> Var<Factor>
pub fn volume(&self) -> Var<Factor>
Volume of the sound.
The value multiplies the samples, 1.fct() is the natural volume from the source.
Sourcepub fn speed(&self) -> Var<Factor>
pub fn speed(&self) -> Var<Factor>
Speed of the sound.
This is a multiplier of the playback speed and pitch.
0.5.fct()doubles the total duration and halves (lowers) the pitch.2.fct()halves the total duration and doubles (raises) the pitch.
Sourcepub fn state(&self) -> Var<AudioOutputState>
pub fn state(&self) -> Var<AudioOutputState>
Output playback state.
This variable can be set to change the state.
Note that because variable modifications apply at once you cannot stop and play in the same update cycle using this. Use the
The default value is AudioOutputState::Playing.
Sourcepub fn pause(&self)
pub fn pause(&self)
Change state to Paused.
Audio playback is paused, cue requests are buffered.
Sourcepub fn stop(&self)
pub fn stop(&self)
Change state to Stopped.
Audio playback is paused, all current cue requests are dropped.
Sourcepub fn is_connected(&self) -> Var<bool>
pub fn is_connected(&self) -> Var<bool>
Sourcepub fn error(&self) -> Var<Option<Txt>>
pub fn error(&self) -> Var<Option<Txt>>
Gets an error message if view-process connection has failed.
Reconnection is attempted on view-process respawn, the is_connected tracks the ok status. Note that
the first connection attempt is true in is_connected and None here.
Source§impl AudioOutput
impl AudioOutput
Sourcepub fn downgrade(&self) -> WeakAudioOutput
pub fn downgrade(&self) -> WeakAudioOutput
Create a weak reference to this audio output.
Trait Implementations§
Source§impl Clone for AudioOutput
impl Clone for AudioOutput
Source§fn clone(&self) -> AudioOutput
fn clone(&self) -> AudioOutput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AudioOutput
impl Debug for AudioOutput
Source§impl PartialEq for AudioOutput
impl PartialEq for AudioOutput
impl Eq for AudioOutput
Auto Trait Implementations§
impl Freeze for AudioOutput
impl !RefUnwindSafe for AudioOutput
impl Send for AudioOutput
impl Sync for AudioOutput
impl Unpin for AudioOutput
impl !UnwindSafe for AudioOutput
Blanket Implementations§
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more