pub struct AudioTrack { /* private fields */ }Expand description
State of an AudioVar.
Implementations§
Source§impl AudioTrack
impl AudioTrack
Sourcepub fn new_loading() -> Self
pub fn new_loading() -> Self
Create a dummy audio in the loading state.
This is the same as calling new_error with an empty error.
Sourcepub fn new_error(error: Txt) -> Self
pub fn new_error(error: Txt) -> Self
Create a dummy audio in the error state.
If the error is empty the audio is loading, not an error.
Sourcepub fn is_loading(&self) -> bool
pub fn is_loading(&self) -> bool
Returns true if the is still acquiring or decoding the audio bytes.
Sourcepub fn is_loaded(&self) -> bool
pub fn is_loaded(&self) -> bool
If the audio has finished loading ok or due to error.
Note that depending on how the audio is requested and its source it may never be fully loaded.
Sourcepub fn can_cue(&self) -> bool
pub fn can_cue(&self) -> bool
If this audio can be cued for playback already.
This is true when the audio has decoded enough that it can begin streaming.
Sourcepub fn total_duration(&self) -> Option<Duration>
pub fn total_duration(&self) -> Option<Duration>
Total duration of the track, if it is known.
Note that this value is set as soon as the header finishes decoding, the chunk may not contains the full stream.
Sourcepub fn channel_count(&self) -> u16
pub fn channel_count(&self) -> u16
Number of channels interleaved in the track.
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Samples per second.
A sample is a single sequence of channel_count in chunk.
Sourcepub fn chunk(&self) -> IpcBytesCast<f32>
pub fn chunk(&self) -> IpcBytesCast<f32>
Current decoded samples.
Note that depending on how the audio is requested and its source it may never be fully loaded. The chunk_offset defines the
position of the chunk in the overall stream.
Sourcepub fn chunk_offset(&self) -> usize
pub fn chunk_offset(&self) -> usize
Offset of the chunk in the overall stream.
Sourcepub fn has_tracks(&self) -> bool
pub fn has_tracks(&self) -> bool
If tracks is not empty.
Sourcepub fn tracks(&self) -> Vec<AudioVar> ⓘ
pub fn tracks(&self) -> Vec<AudioVar> ⓘ
Other audios from the same container that are a child of this audio.
Sourcepub fn flat_tracks(&self) -> Var<Vec<(VarEq<AudioTrack>, usize)>>
pub fn flat_tracks(&self) -> Var<Vec<(VarEq<AudioTrack>, usize)>>
All other audios from the same container that are a descendant of this audio.
The values are a tuple of each track and the length of descendants tracks that follow it.
The returned variable will update every time any track descendant var updates.
Sourcepub fn track_index(&self) -> usize
pub fn track_index(&self) -> usize
Sort index of the audio in the list of tracks of the source container.
Sourcepub fn view_handle(&self) -> &ViewAudioHandle
pub fn view_handle(&self) -> &ViewAudioHandle
Connection to the audio resource in the view-process.
Sourcepub fn insert_track(&mut self, track: AudioVar)
pub fn insert_track(&mut self, track: AudioVar)
Insert track in tracks.
Trait Implementations§
Source§impl Clone for AudioTrack
impl Clone for AudioTrack
Source§fn clone(&self) -> AudioTrack
fn clone(&self) -> AudioTrack
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AudioTrack
impl Debug for AudioTrack
Source§impl From<&AudioTrack> for AudioMix
impl From<&AudioTrack> for AudioMix
Source§fn from(audio: &AudioTrack) -> Self
fn from(audio: &AudioTrack) -> Self
Source§impl From<AudioTrack> for AudioMix
impl From<AudioTrack> for AudioMix
Source§fn from(audio: AudioTrack) -> Self
fn from(audio: AudioTrack) -> Self
Source§impl PartialEq for AudioTrack
impl PartialEq for AudioTrack
impl IntoValue<AudioMix> for AudioTrack
Auto Trait Implementations§
impl Freeze for AudioTrack
impl !RefUnwindSafe for AudioTrack
impl Send for AudioTrack
impl Sync for AudioTrack
impl !Unpin for AudioTrack
impl !UnwindSafe for AudioTrack
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<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