Skip to main content

AudioClip

Struct AudioClip 

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

tick-authored audio occurrence, separate from the retained root AudioClip.

Implementations§

Source§

impl AudioClip

Source

pub fn composition(timeline: Timeline) -> Self

Retains a nested mix, including its own buses and master, without decoding.

Source

pub fn file(path: impl Into<PathBuf>) -> Self

Retains a local file path without opening, probing or decoding it.

Source

pub fn with_resolved_source(&self, source: Arc<dyn AudioSource>) -> Self

Replaces a deferred source at an execution boundary, preserving all authored settings.

Source

pub fn unresolved_file(&self) -> bool

Whether metadata is still required to determine a natural file duration.

Source

pub fn parameters(&self) -> AudioClipParameters<'_>

Borrows mixer parameters without reading, decoding or copying PCM.

Source

pub fn source(source: impl AudioSource + 'static) -> Self

Captures a stateless source. Infinite sources require an explicit duration.

Source

pub fn start(self, start: Time) -> Self

Sets destination start in nonnegative ticks.

Source

pub fn offset(self, offset: Time) -> Self

Sets source offset, rounded once to the nearest source-rate frame.

Source

pub fn duration(self, duration: Duration) -> Self

Sets a finite positive occurrence duration; EOF is padded with silence.

Source

pub fn volume(self, volume: f64) -> Self

Sets finite amplitude in 0..=16; mixing never normalizes peaks automatically.

Source

pub fn volume_envelope(self, envelope: impl Animation<f64> + 'static) -> Self

Multiplies volume by a typed animation sampled at clip-local output time.

Source

pub fn fade_in(self, duration: Duration) -> Self

Linear amplitude fade anchored to the clip start; overlapping fades multiply.

Source

pub fn fade_out(self, duration: Duration) -> Self

Linear amplitude fade ending at the occurrence’s exclusive end.

Source

pub fn pan(self, pan: f64) -> Self

Constant-power mono pan; stereo uses balance. Range -1 left through +1 right.

Source

pub fn effect(self, effect: impl AudioEffect + 'static) -> Self

Appends an offline effect, rendered once from the clip origin.

Source

pub fn ducked_by(self, trigger: &AudioClip, duck: Duck) -> Self

Lowers this clip while trigger is audible. The trigger is still mixed on its own when it is also added to the timeline; at most four triggers per clip. Ducking is rendered offline from the trigger envelope, so it is deterministic and random-access safe.

Source

pub fn bus(self, name: impl Into<String>) -> Self

Routes the occurrence to a named timeline bus.

Source

pub fn pan_law(self, law: PanLaw) -> Self

Replaces stereo balance law; mono panning is unaffected.

Source

pub fn pan_animation(self, animation: impl Animation<f64> + 'static) -> Self

Sets a pure local-time pan animation, with values in -1..=1.

Source

pub fn stereo_width(self, width: f64) -> Self

Sets mid/side width in 0..=2, without changing the mono component.

Source

pub fn spatial( self, position: impl Animation<Point> + 'static, listener: Point, width: f64, rolloff: f64, ) -> Result<Self, ValidationError>

Couples screen position to pan and inverse-distance gain, multiplying the existing envelope. Width is the listener-to-edge distance; this is not HRTF or three-dimensional spatial audio.

Source

pub fn trim(self, start: Time, end: Time) -> Self

Selects a positive source-time interval; natural duration is not required.

Source

pub fn resolved_duration(&self) -> Result<Duration, ValidationError>

Validated natural/overridden duration, before destination placement.

Source

pub fn end(&self) -> Result<Time, ValidationError>

Exclusive destination end, checked without reading samples.

Source

pub fn relocated( &self, offset: Time, window: Duration, ) -> Result<Option<Self>, ValidationError>

Places a nested audio occurrence in a parent timeline, cropping its audible window. Source offsets and fade positions remain anchored to the original clip.

Trait Implementations§

Source§

impl Clone for AudioClip

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 AudioClip

Source§

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

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

impl<Source: AudioSource + ?Sized + 'static> From<Arc<Source>> for AudioClip

Source§

fn from(source: Arc<Source>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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.