Skip to main content

AudioTrack

Struct AudioTrack 

Source
pub struct AudioTrack { /* private fields */ }
Expand description

Seekable digital audio track with PCM samples, precomputed waveform peaks, and transport state.

Implementations§

Source§

impl AudioTrack

Transport playback, seeking, and procedural WAV synthesis for AudioTrack.

Source

pub fn sample_synth_wav() -> Self

Synthesizes a valid RIFF PCM 16-bit mono WAV byte stream and decodes it through MediaCodecRegistry::decode_wav.

§Returns
  • Self - Decoded AudioTrack with real PCM samples and 48 waveform peaks.
Source

pub fn toggle_play(&mut self)

Toggles audio playback between Playing and Paused.

§Arguments
  • &Self - Mutable audio track.
Source

pub fn seek(&mut self, secs: f32)

Seeks the audio playhead to secs, clamped to [0.0, duration_secs].

§Arguments
  • &Self - Mutable audio track.
  • f32 - Target timestamp in seconds.
Source

pub fn step(&mut self, dt_secs: f32)

Advances audio timeline playback by dt_secs * playback_rate.

§Arguments
  • &Self - Mutable audio track.
  • f32 - Elapsed delta time in seconds.
Source§

impl AudioTrack

Source

pub fn get_metadata(&self) -> &MediaMetadata

Source

pub fn get_mut_metadata(&mut self) -> &mut MediaMetadata

Source

pub fn set_metadata(&mut self, val: MediaMetadata) -> &mut Self

Source

pub fn get_codec(&self) -> AudioCodec

Source

pub fn get_mut_codec(&mut self) -> &mut AudioCodec

Source

pub fn set_codec(&mut self, val: AudioCodec) -> &mut Self

Source

pub fn get_samples(&self) -> &Vec<f32>

Source

pub fn get_mut_samples(&mut self) -> &mut Vec<f32>

Source

pub fn set_samples(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_waveform_peaks(&self) -> &Vec<f32>

Source

pub fn get_mut_waveform_peaks(&mut self) -> &mut Vec<f32>

Source

pub fn set_waveform_peaks(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_state(&self) -> PlaybackState

Source

pub fn get_mut_state(&mut self) -> &mut PlaybackState

Source

pub fn set_state(&mut self, val: PlaybackState) -> &mut Self

Source

pub fn get_current_time_secs(&self) -> f32

Source

pub fn get_mut_current_time_secs(&mut self) -> &mut f32

Source

pub fn set_current_time_secs(&mut self, val: f32) -> &mut Self

Source

pub fn get_volume(&self) -> f32

Source

pub fn get_mut_volume(&mut self) -> &mut f32

Source

pub fn set_volume(&mut self, val: f32) -> &mut Self

Source

pub fn get_muted(&self) -> bool

Source

pub fn get_mut_muted(&mut self) -> &mut bool

Source

pub fn set_muted(&mut self, val: bool) -> &mut Self

Source

pub fn get_playback_rate(&self) -> f32

Source

pub fn get_mut_playback_rate(&mut self) -> &mut f32

Source

pub fn set_playback_rate(&mut self, val: f32) -> &mut Self

Source

pub fn get_looping(&self) -> bool

Source

pub fn get_mut_looping(&mut self) -> &mut bool

Source

pub fn set_looping(&mut self, val: bool) -> &mut Self

Trait Implementations§

Source§

impl Clone for AudioTrack

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AudioTrack

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AudioTrack

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for AudioTrack

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AudioTrack

Auto Trait Implementations§

§

impl Forget for AudioTrack

§

impl Freeze for AudioTrack

§

impl Move for AudioTrack

§

impl RefUnwindSafe for AudioTrack

§

impl Send for AudioTrack
where RawVecInner: Send,

§

impl Sync for AudioTrack
where RawVecInner: Sync,

§

impl Unpin for AudioTrack
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for AudioTrack

§

impl UnwindSafe for AudioTrack
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.