pub struct AudioClip { /* private fields */ }Expand description
tick-authored audio occurrence, separate from the retained root AudioClip.
Implementations§
Source§impl AudioClip
impl AudioClip
Sourcepub fn composition(timeline: Timeline) -> Self
pub fn composition(timeline: Timeline) -> Self
Retains a nested mix, including its own buses and master, without decoding.
Sourcepub fn file(path: impl Into<PathBuf>) -> Self
pub fn file(path: impl Into<PathBuf>) -> Self
Retains a local file path without opening, probing or decoding it.
Sourcepub fn with_resolved_source(&self, source: Arc<dyn AudioSource>) -> Self
pub fn with_resolved_source(&self, source: Arc<dyn AudioSource>) -> Self
Replaces a deferred source at an execution boundary, preserving all authored settings.
Sourcepub fn unresolved_file(&self) -> bool
pub fn unresolved_file(&self) -> bool
Whether metadata is still required to determine a natural file duration.
Sourcepub fn parameters(&self) -> AudioClipParameters<'_>
pub fn parameters(&self) -> AudioClipParameters<'_>
Borrows mixer parameters without reading, decoding or copying PCM.
Sourcepub fn source(source: impl AudioSource + 'static) -> Self
pub fn source(source: impl AudioSource + 'static) -> Self
Captures a stateless source. Infinite sources require an explicit duration.
Sourcepub fn offset(self, offset: Duration) -> Self
pub fn offset(self, offset: Duration) -> Self
Sets source offset, rounded once to the nearest source-rate frame.
Sourcepub fn duration(self, duration: Duration) -> Self
pub fn duration(self, duration: Duration) -> Self
Sets a finite positive occurrence duration; EOF is padded with silence.
Sourcepub fn volume(self, volume: f64) -> Self
pub fn volume(self, volume: f64) -> Self
Sets finite amplitude in 0..=16; mixing never normalizes peaks automatically.
Sourcepub fn volume_envelope(self, envelope: impl Signal<f64> + 'static) -> Self
pub fn volume_envelope(self, envelope: impl Signal<f64> + 'static) -> Self
Multiplies volume by a typed animation sampled at clip-local output time.
Sourcepub fn fade_in(self, duration: Duration) -> Self
pub fn fade_in(self, duration: Duration) -> Self
Linear amplitude fade anchored to the clip start; overlapping fades multiply.
Sourcepub fn fade_out(self, duration: Duration) -> Self
pub fn fade_out(self, duration: Duration) -> Self
Linear amplitude fade ending at the occurrence’s exclusive end.
Sourcepub fn pan(self, pan: f64) -> Self
pub fn pan(self, pan: f64) -> Self
Constant-power mono pan; stereo uses balance. Range -1 left through +1 right.
Sourcepub fn effect(self, effect: impl AudioEffect + 'static) -> Self
pub fn effect(self, effect: impl AudioEffect + 'static) -> Self
Appends an offline effect, rendered once from the clip origin.
Sourcepub fn ducked_by(self, trigger: &AudioClip, duck: Duck) -> Self
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.
Sourcepub fn bus(self, name: impl Into<String>) -> Self
pub fn bus(self, name: impl Into<String>) -> Self
Routes the occurrence to a named timeline bus.
Sourcepub fn pan_law(self, law: PanLaw) -> Self
pub fn pan_law(self, law: PanLaw) -> Self
Replaces stereo balance law; mono panning is unaffected.
Sourcepub fn pan_animation(self, animation: impl Signal<f64> + 'static) -> Self
pub fn pan_animation(self, animation: impl Signal<f64> + 'static) -> Self
Sets a pure local-time pan animation, with values in -1..=1.
Sourcepub fn stereo_width(self, width: f64) -> Self
pub fn stereo_width(self, width: f64) -> Self
Sets mid/side width in 0..=2, without changing the mono component.
Sourcepub fn spatial(
self,
position: impl Signal<Point> + 'static,
listener: Point,
width: f64,
rolloff: f64,
) -> Result<Self, ValidationError>
pub fn spatial( self, position: impl Signal<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.
Sourcepub fn trim(self, start: Duration, end: Duration) -> Self
pub fn trim(self, start: Duration, end: Duration) -> Self
Selects a positive source-time interval; natural duration is not required.
An end not after start yields an empty duration, rejected when resolved.
Sourcepub fn resolved_duration(&self) -> Result<Duration, ValidationError>
pub fn resolved_duration(&self) -> Result<Duration, ValidationError>
Validated natural/overridden duration, before destination placement.
Sourcepub fn end(&self) -> Result<Time, ValidationError>
pub fn end(&self) -> Result<Time, ValidationError>
Exclusive destination end, checked without reading samples.