pub struct AudioGraph {
pub nodes: HashMap<NodeId, AudioNode>,
pub edges: Vec<AudioEdge>,
pub output_node: Option<NodeId>,
pub automation: Vec<AutomationLane>,
pub polyphony: usize,
pub master_volume: f32,
pub bpm: f32,
pub commands: Arc<Mutex<VecDeque<AudioCommand>>>,
pub output_buffer: StereoBuffer,
/* private fields */
}Expand description
The main audio processing graph.
Fields§
§nodes: HashMap<NodeId, AudioNode>§edges: Vec<AudioEdge>§output_node: Option<NodeId>§automation: Vec<AutomationLane>§polyphony: usize§master_volume: f32§bpm: f32§commands: Arc<Mutex<VecDeque<AudioCommand>>>§output_buffer: StereoBufferImplementations§
Source§impl AudioGraph
impl AudioGraph
pub fn new() -> Self
pub fn add_node(&mut self, node_type: AudioNodeType) -> NodeId
pub fn connect( &mut self, from: NodeId, from_slot: u8, to: NodeId, to_slot: u8, ) -> EdgeId
pub fn disconnect(&mut self, edge_id: EdgeId)
pub fn set_output(&mut self, node_id: NodeId)
pub fn add_automation(&mut self, lane: AutomationLane)
Sourcepub fn send_command(&self, cmd: AudioCommand)
pub fn send_command(&self, cmd: AudioCommand)
Send a command to the audio thread.
pub fn note_on(&self, note: u8, velocity: f32)
pub fn note_off(&self, note: u8)
pub fn set_param(&self, node_id: NodeId, param: &str, value: f32)
Sourcepub fn sort_topologically(&mut self) -> Result<(), String>
pub fn sort_topologically(&mut self) -> Result<(), String>
Topological sort (Kahn’s algorithm).
Sourcepub fn process_block(&mut self) -> StereoBuffer
pub fn process_block(&mut self) -> StereoBuffer
Process one audio buffer through the graph.
Sourcepub fn basic_synth_chain(
&mut self,
wave: Waveform,
freq: f32,
) -> (NodeId, NodeId, NodeId, NodeId)
pub fn basic_synth_chain( &mut self, wave: Waveform, freq: f32, ) -> (NodeId, NodeId, NodeId, NodeId)
Build a simple signal chain from oscillator → filter → envelope → output.
Sourcepub fn fm_synth_chain(
&mut self,
carrier: f32,
ratio: f32,
index: f32,
) -> (NodeId, NodeId)
pub fn fm_synth_chain( &mut self, carrier: f32, ratio: f32, index: f32, ) -> (NodeId, NodeId)
FM synthesis chain.
Sourcepub fn drum_chain(&mut self, is_snare: bool) -> NodeId
pub fn drum_chain(&mut self, is_snare: bool) -> NodeId
Drum machine chain: noise → HP filter → fast envelope → output.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AudioGraph
impl RefUnwindSafe for AudioGraph
impl Send for AudioGraph
impl Sync for AudioGraph
impl Unpin for AudioGraph
impl UnsafeUnpin for AudioGraph
impl UnwindSafe for AudioGraph
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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.