pub struct GraphModuleAdapter<G: GraphModule> { /* private fields */ }Expand description
Adapts a GraphModule (the engine’s multi-port, type-erased module trait) into a
single-in / single-out combinator Module, so real DSP modules such as
Vco or Svf can be composed with
.then, .parallel, and .fanout.
One input port and one output port of the wrapped module are chosen at construction
(by id, via new, or automatically from the first audio
ports, via from_audio_ports). Every other
input port keeps its PortDef default; the wrapped module still reads those on each
tick, so pulse-width, cutoff, etc. behave as if unpatched in a graph.
Implementations§
Source§impl<G: GraphModule> GraphModuleAdapter<G>
impl<G: GraphModule> GraphModuleAdapter<G>
Sourcepub fn new(module: G, input_port: PortId, output_port: PortId) -> Self
pub fn new(module: G, input_port: PortId, output_port: PortId) -> Self
Wrap module, driving input port input_port and reading output port
output_port on every tick.
Sourcepub fn from_audio_ports(module: G) -> Option<Self>
pub fn from_audio_ports(module: G) -> Option<Self>
Wrap module, automatically choosing its first SignalKind::Audio input and
first SignalKind::Audio output port.
Returns None if the module exposes no audio input or no audio output (e.g. a
Vco, whose only inputs are CV/pitch — use new with
an explicit port id for those).
Sourcepub fn inner(&self) -> &G
pub fn inner(&self) -> &G
Borrow the wrapped GraphModule.
Sourcepub fn into_inner(self) -> G
pub fn into_inner(self) -> G
Consume the adapter, returning the wrapped GraphModule.
Trait Implementations§
Auto Trait Implementations§
impl<G> Freeze for GraphModuleAdapter<G>where
G: Freeze,
impl<G> RefUnwindSafe for GraphModuleAdapter<G>where
G: RefUnwindSafe,
impl<G> Send for GraphModuleAdapter<G>
impl<G> Sync for GraphModuleAdapter<G>
impl<G> Unpin for GraphModuleAdapter<G>where
G: Unpin,
impl<G> UnsafeUnpin for GraphModuleAdapter<G>where
G: UnsafeUnpin,
impl<G> UnwindSafe for GraphModuleAdapter<G>where
G: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<M> ModuleExt for Mwhere
M: Module,
impl<M> ModuleExt for Mwhere
M: Module,
Source§fn then<M: Module<In = Self::Out>>(self, next: M) -> Chain<Self, M>
fn then<M: Module<In = Self::Out>>(self, next: M) -> Chain<Self, M>
>>>)Source§fn fanout<M: Module<In = Self::In>>(self, other: M) -> Fanout<Self, M>
fn fanout<M: Module<In = Self::In>>(self, other: M) -> Fanout<Self, M>
&&&)