Struct Typed Chain Audio Session
pub struct TypedChainAudioSession<'a, S: GraphSample, T: StageTuple<S>> { /* private fields */ }Expand description
Canonical non-Send audio-session guard with typed readonly access and bypass.
Finish/drop before CONTROL mutation, extraction or transfer. Do not forget it:
a forgotten guard leaves the audio owner live (see TypedChain), which is
misuse and not a supported way to hand the chain to another thread.
The guard is not Send:
use ravet_graph::TypedChainAudioSession;
use ravet_gain::GainProcessor;
fn send<T:Send>() {}
send::<TypedChainAudioSession<'static,f32,(GainProcessor,)>>();A live stage() borrow excludes process on the session:
use ravet_graph::{StageAt,TypedChainAudioSession};
use ravet_foundation::{ProcessBlock,Processor};
fn overlap<T: StageAt<f32,0>>(session:&mut TypedChainAudioSession<'_,f32,T>, block:&mut ProcessBlock<'_,'_,'_,f32>) {
let stage=session.stage::<0>();
let _=session.process(block);
let _=stage.latency_samples();
}… and excludes set_bypassed:
use ravet_graph::{StageAt,TypedChainAudioSession};
use ravet_foundation::Processor;
fn overlap<T: StageAt<f32,0>>(session:&mut TypedChainAudioSession<'_,f32,T>) {
let stage=session.stage::<0>();
session.set_bypassed::<0>(true);
let _=stage.latency_samples();
}Positive companion: read first, then mutate and render.
use ravet_graph::{StageAt,TypedChainAudioSession};
use ravet_foundation::{ProcessBlock,Processor};
fn ordered<T: StageAt<f32,0>>(session:&mut TypedChainAudioSession<'_,f32,T>, block:&mut ProcessBlock<'_,'_,'_,f32>) {
let latency=session.stage::<0>().latency_samples();
session.set_bypassed::<0>(true);
let _=session.process(block);
let _=latency;
}Implementations§
§impl<S: GraphSample, T: StageTuple<S>> TypedChainAudioSession<'_, S, T>
impl<S: GraphSample, T: StageTuple<S>> TypedChainAudioSession<'_, S, T>
pub fn process(&mut self, b: &mut ProcessBlock<'_, '_, '_, S>) -> GraphStatus
pub fn reset(&mut self)
pub fn try_reset(&mut self) -> Result<(), GraphStatus>
pub fn try_reset(&mut self) -> Result<(), GraphStatus>
Preserve the first fault until the complete reset succeeds.