AUDIO
Source snapshot · 12 October 2026

API reference / ravet_graph::MonoDuplicator

Struct MonoDuplicator 

pub struct MonoDuplicator<S: GraphSample, C, K: SharedMonoKernel<S, C>> { /* private fields */ }
Expand description

One prepared control object shared by reference and 1..64 separate native histories. The factory returns inactive kernels; successful kernels may own additional caller-defined storage outside the checked 4MiB kernel-Vec payload cap. Effect-only, no events/auxiliary/generated events; construction/preparation are CONTROL. Bypass returns exact dry input and freezes all histories.

Rendering paths: Processor::process validates the whole block and, on a refusal, silences the active output frames (backing tails and histories are untouched); process_sample, process_frame, process_planar and process_in_place preflight the whole call and return an error without writing outputs or advancing any kernel. Nonfinite samples are passed to the kernels and through bypass unchanged; what a kernel makes of them (including leaking into its own history) is the kernel’s policy.

prepare deactivates first, so a refused or failed prepare leaves the duplicator unprepared; kernel histories are whatever the foreign kernels keep across deactivation. Dropping an active duplicator deactivates the prepared kernel prefix once, in reverse order, before the kernels are dropped. prepare_failure() is cleared only by the next prepare, not by deactivate or shared_controls_mut_stopped.

Implementations§

§

impl<S: GraphSample, C, K: SharedMonoKernel<S, C>> MonoDuplicator<S, C, K>

pub fn new<F, E>( controls: C, channels: usize, maximum_frames: usize, factory: F, ) -> Result<Self, MonoFactoryFailure<C, K, F, E>>
where F: FnMut(usize, &C) -> Result<K, E>,

The allocator-failure branch of the kernel reservation and the post- reservation capacity check cannot be reached by ordinary tests (an exact reservation of at most the admitted payload); they are defensive refusals without dedicated coverage.

pub fn channels(&self) -> usize

pub fn shared_controls(&self) -> &C

pub fn shared_controls_mut_stopped(&mut self) -> &mut C

Invalidates preparation first; changing controls requires reprepare.

pub fn kernel(&self, channel: usize) -> Option<&K>

pub fn prepare_failure(&self) -> Option<(usize, PrepareError)>

Index and error of the last failed kernel prepare. Cleared by the next prepare only; deactivate and shared_controls_mut_stopped keep it.

pub fn set_bypassed(&mut self, value: bool)

pub fn is_bypassed(&self) -> bool

pub fn process_sample( &mut self, channel: usize, input: S, ) -> Result<S, ProcessError>

pub fn process_frame( &mut self, input: &[S], output: &mut [S], ) -> Result<(), ProcessError>

pub fn process_planar( &mut self, inputs: &[&[S]], outputs: &mut [&mut [S]], frames: usize, ) -> Result<(), ProcessError>

pub fn process_in_place( &mut self, channels: &mut [&mut [S]], frames: usize, ) -> Result<(), ProcessError>

pub fn into_parts(self) -> (C, Vec<K>)

CONTROL-only owner recovery after once-only deactivation.

Trait Implementations§

§

impl<S: GraphSample, C, K: SharedMonoKernel<S, C>> Drop for MonoDuplicator<S, C, K>

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
§

impl<S: GraphSample, C, K: SharedMonoKernel<S, C>> Processor<S> for MonoDuplicator<S, C, K>

§

fn prepare(&mut self, c: ProcessConfig) -> Result<(), PrepareError>

Deactivates first. A kernel prepare panic leaves the successfully prepared prefix active; it is deactivated once, in reverse, by the next deactivate, prepare or by Drop, including during unwinding.

§

fn latency_samples(&self) -> u32

Maximum over kernels while prepared, else zero. Kernels are not summed; bypass does not change the declared value.

§

fn tail(&self) -> Tail

Longest kernel tail while prepared (Infinite dominates, None is the identity), else Tail::None.

§

fn process(&mut self, b: &mut ProcessBlock<'_, '_, '_, S>) -> ProcessStatus

§

fn reset(&mut self)

§

fn deactivate(&mut self)

§

fn start_audio(&mut self) -> Result<(), ProcessError>

Optional explicit audio-owner session start, after prepare and before rendering. Default is a no-op. Consumers using these hooks call once on the audio owner and stop there before transfer/deactivation. Failure must leave this processor stopped; earlier successful nodes may be stopped. Hooks follow prepared callback allocation/locking/I/O obligations. Existing adapters do not implicitly opt in; explicit graph sessions supply them.
§

fn stop_audio(&mut self)

End an explicitly started session on its audio owner, without deactivation or storage destruction. Default no-op; preparation/history may be retained.
§

fn try_reset(&mut self) -> Result<(), ProcessError>

Attempt history reset without allocating or changing configuration. Existing processors delegate to their successful legacy reset by default. A refusal may follow earlier reset work; consumers must remain faulted.

Auto Trait Implementations§

§

impl<S, C, K> Freeze for MonoDuplicator<S, C, K>
where C: Freeze,

§

impl<S, C, K> RefUnwindSafe for MonoDuplicator<S, C, K>

§

impl<S, C, K> Send for MonoDuplicator<S, C, K>
where C: Send, K: Send,

§

impl<S, C, K> Sync for MonoDuplicator<S, C, K>
where C: Sync, S: Sync, K: Sync,

§

impl<S, C, K> Unpin for MonoDuplicator<S, C, K>
where C: Unpin, S: Unpin, K: Unpin,

§

impl<S, C, K> UnsafeUnpin for MonoDuplicator<S, C, K>
where C: UnsafeUnpin,

§

impl<S, C, K> UnwindSafe for MonoDuplicator<S, C, K>
where C: UnwindSafe, S: UnwindSafe, K: UnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.