pub struct AudioTrackHandle { /* private fields */ }Expand description
Cloneable handle for filling a track and adjusting its gain from any thread.
Obtained by calling AudioMixer::add_track. All methods are lock-free
on the hot path (volume/pan reads) and only lock for buffer access.
Implementations§
Source§impl AudioTrackHandle
impl AudioTrackHandle
Sourcepub fn set_volume(&self, v: f32)
pub fn set_volume(&self, v: f32)
Set per-track volume.
1.0 = unity gain. Values above 1.0 amplify; values below reduce.
Negative values are clamped to 0.0 (silence). The mixer output is
always clipped to [-1.0, 1.0], so amplification may cause saturation
on loud signals.
Sourcepub fn set_pan(&self, p: f32)
pub fn set_pan(&self, p: f32)
Set stereo pan. Clamped to [-1.0 (full left) .. +1.0 (full right)].
Sourcepub fn push_samples(&self, samples: &[f32])
pub fn push_samples(&self, samples: &[f32])
Push decoded mono PCM samples into the track buffer.
Called by the background audio-decode thread. The samples should be
f32 mono at 48 kHz (i.e., one value per time step).
Trait Implementations§
Source§impl Clone for AudioTrackHandle
impl Clone for AudioTrackHandle
Source§fn clone(&self) -> AudioTrackHandle
fn clone(&self) -> AudioTrackHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AudioTrackHandle
impl RefUnwindSafe for AudioTrackHandle
impl Send for AudioTrackHandle
impl Sync for AudioTrackHandle
impl Unpin for AudioTrackHandle
impl UnsafeUnpin for AudioTrackHandle
impl UnwindSafe for AudioTrackHandle
Blanket Implementations§
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
Mutably borrows from an owned value. Read more