AUDIO
Source snapshot · 11 November 2026

API reference / ravet_clap::MainBusBridge

Struct MainBusBridge 

pub struct MainBusBridge<P, S: ClapSample = f32> { /* private fields */ }
Expand description

Prepared one-main-bus effect/instrument adapter for native f32 or f64. Accepts 0..64 inputs and 1..64 outputs, <=65,536 frames/1,024 events; no auxiliary buses. Opt-in bounded output events use explicit host delivery. Optional selected MIDI input port maps validated short messages with sample timing; scoped parameters require an independent input/output selector. UMP words retain framing and timing without semantic conversion. Native CLAP notes/standard expressions require explicit selected ports; byte-pointer SysEx and note end filter. Exporters must advertise only processor-supported MIDI dialects and precision/layout.

Input scratch is copied before processing to preserve legal host aliases; output scratch is separate and every portable output must be initialized. Up to 64 MiB scratch at maximum f64 shape. Preparation/drop allocate; process, flush/reset avoid heap/locks/I/O. Invalid whole blocks silence host outputs without changing DSP/transport history. Host buffer validity remains Clack’s caller contract. Flush applies parameters only, without advancing time.

Implementations§

§

impl<P: Processor<S>, S: ClapSample> MainBusBridge<P, S>

pub fn prepare( processor: P, config: ProcessConfig, midi_port: Option<u16>, ) -> Result<Self, BridgeError>

pub fn prepare_with_output( processor: P, config: ProcessConfig, midi_port: Option<u16>, output_midi_port: Option<u16>, ) -> Result<Self, BridgeError>

Prepare at most 1024 generated events in addition to bounded audio/input scratch. Parameter output is global; MIDI/normalized notes require the selected output port. Exporters advertise that port’s MIDI dialect. Notes quantize velocity to 7 bits (positive note-on rounds to at least one). Use process_with_output/flush_with_output when capacity is nonzero.

pub fn with_clap_note_input_port( self, port: Option<u16>, ) -> Result<Self, BridgeError>

Select explicit native CLAP note/expression input (0..256), independent of raw MIDI/UMP selection. Requires exporter-advertised processor support; no voice behavior/metadata is inferred. None restores default filtering.

pub fn with_note_end_output_port( self, port: Option<u16>, ) -> Result<Self, BridgeError>

Select the originating note INPUT endpoint for generated completion notifications (0..256), independently of performance output and scoped parameters. Native timestamp/velocity carry no termination semantics. IDs must fit nonnegative i32; missing routes reject whole delivery. Flush rejects completion output. No voice tracking or metadata is inferred.

pub fn with_clap_note_output_port( self, port: Option<u16>, ) -> Result<Self, BridgeError>

Select native CLAP generated On/Off, identified notes and expressions (0..256). Legacy notes retain unquantized f32 velocity; IDs must fit i32. Raw MIDI/UMP still use their independently selected port. Whole delivery preflight prevents identity/scope loss. Native performance in parameter flush is unrepresentable; audio/DSP already progressed before delivery.

pub fn with_scoped_parameter_input_port( self, port: Option<u16>, ) -> Result<Self, BridgeError>

Select scoped physical values/modulation on a note input endpoint below 256. Independent of note translation and global modulation; no metadata, parameter range/state/voice behavior is inferred. None restores filtering.

pub fn with_scoped_parameter_output_port( self, port: Option<u16>, ) -> Result<Self, BridgeError>

Select the originating note input endpoint for generated scoped physical parameter values/modulation (0..256), including zero-time parameter flush. This index is independent of note output and raw MIDI/UMP selectors. Full finite f64 values/scope are retained; native IDs must fit nonnegative i32.

pub fn with_parameter_gesture_input(self, enabled: bool) -> Self

Enable raw parameter begin/end input; no automatic pairing/state edits.

pub fn with_global_parameter_modulation(self, enabled: bool) -> Self

Opt in to global parameter modulation input without changing metadata or saved values. The processor must explicitly implement modulation semantics; scoped events require their separate selector. Default is disabled, including flush.

pub fn processor(&self) -> &P

pub fn reset(&mut self)

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

Preserve refused history reset and stop subsequent DSP dispatch.

pub fn reset_error(&self) -> Option<ProcessError>

Original refused reset, until a complete successful reset.

pub fn deactivate(&mut self)

pub fn flush(&mut self, events: &InputEvents<'_>) -> Result<(), BridgeError>

pub fn flush_with_output( &mut self, events: &InputEvents<'_>, output: &mut OutputEvents<'_>, ) -> Result<BridgeReport, BridgeError>

Parameter-only zero-time flush with generated output delivery. Queue rejection is reported after DSP progresses; it cannot roll back state.

pub fn process( &mut self, audio: &mut Audio<'_>, events: &InputEvents<'_>, transport: Option<&TransportEvent>, ) -> Result<ProcessStatus, BridgeError>

pub fn process_with_output( &mut self, audio: &mut Audio<'_>, events: &InputEvents<'_>, transport: Option<&TransportEvent>, output: &mut OutputEvents<'_>, ) -> Result<BridgeReport, BridgeError>

Process audio and bounded generated events. Invalid input/DSP faults silence audio and emit nothing. Successful audio is preserved even if the generated stream is unrepresentable or the host queue accepts only a prefix. Delivery reports discarded events; there is no implicit retry.

Auto Trait Implementations§

§

impl<P, S> Freeze for MainBusBridge<P, S>
where P: Freeze,

§

impl<P, S> RefUnwindSafe for MainBusBridge<P, S>

§

impl<P, S> Send for MainBusBridge<P, S>
where P: Send, S: Send,

§

impl<P, S> Sync for MainBusBridge<P, S>
where P: Sync, S: Sync,

§

impl<P, S> Unpin for MainBusBridge<P, S>
where P: Unpin, S: Unpin,

§

impl<P, S> UnsafeUnpin for MainBusBridge<P, S>
where P: UnsafeUnpin,

§

impl<P, S> UnwindSafe for MainBusBridge<P, S>
where P: UnwindSafe, S: 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> AutoreleaseSafe for T
where T: ?Sized,

§

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.