Add parameters to audio nodes and rename Delay node to Echo

This commit is contained in:
Skyler Lehmkuhl
2026-02-15 05:34:28 -05:00
parent 6fcee92d59
commit 1e7001b291
8 changed files with 254 additions and 254 deletions
+4 -2
View File
@@ -501,6 +501,8 @@ impl Engine {
.store(self.playhead, Ordering::Relaxed);
// Stop all MIDI notes when seeking to prevent stuck notes
self.project.stop_all_notes();
// Reset all node graphs to clear effect buffers (echo, reverb, etc.)
self.project.reset_all_graphs();
// Notify disk reader to refill buffers from new position
if let Some(ref mut dr) = self.disk_reader {
dr.send(crate::audio::disk_reader::DiskReaderCommand::Seek { frame: frames });
@@ -1080,7 +1082,7 @@ impl Engine {
"Splitter" => Box::new(SplitterNode::new("Splitter".to_string())),
"Pan" => Box::new(PanNode::new("Pan".to_string())),
"Quantizer" => Box::new(QuantizerNode::new("Quantizer".to_string())),
"Delay" => Box::new(DelayNode::new("Delay".to_string())),
"Echo" | "Delay" => Box::new(EchoNode::new("Echo".to_string())),
"Distortion" => Box::new(DistortionNode::new("Distortion".to_string())),
"Reverb" => Box::new(ReverbNode::new("Reverb".to_string())),
"Chorus" => Box::new(ChorusNode::new("Chorus".to_string())),
@@ -1165,7 +1167,7 @@ impl Engine {
"Splitter" => Box::new(SplitterNode::new("Splitter".to_string())),
"Pan" => Box::new(PanNode::new("Pan".to_string())),
"Quantizer" => Box::new(QuantizerNode::new("Quantizer".to_string())),
"Delay" => Box::new(DelayNode::new("Delay".to_string())),
"Echo" | "Delay" => Box::new(EchoNode::new("Echo".to_string())),
"Distortion" => Box::new(DistortionNode::new("Distortion".to_string())),
"Reverb" => Box::new(ReverbNode::new("Reverb".to_string())),
"Chorus" => Box::new(ChorusNode::new("Chorus".to_string())),
+1 -1
View File
@@ -865,7 +865,7 @@ impl AudioGraph {
"Splitter" => Box::new(SplitterNode::new("Splitter")),
"Pan" => Box::new(PanNode::new("Pan")),
"Quantizer" => Box::new(QuantizerNode::new("Quantizer")),
"Delay" => Box::new(DelayNode::new("Delay")),
"Echo" | "Delay" => Box::new(EchoNode::new("Echo")),
"Distortion" => Box::new(DistortionNode::new("Distortion")),
"Reverb" => Box::new(ReverbNode::new("Reverb")),
"Chorus" => Box::new(ChorusNode::new("Chorus")),
@@ -7,8 +7,8 @@ const PARAM_WET_DRY: u32 = 2;
const MAX_DELAY_SECONDS: f32 = 2.0;
/// Stereo delay node with feedback
pub struct DelayNode {
/// Stereo echo node with feedback
pub struct EchoNode {
name: String,
delay_time: f32, // seconds
feedback: f32, // 0.0 to 0.95
@@ -26,7 +26,7 @@ pub struct DelayNode {
parameters: Vec<Parameter>,
}
impl DelayNode {
impl EchoNode {
pub fn new(name: impl Into<String>) -> Self {
let name = name.into();
@@ -79,7 +79,7 @@ impl DelayNode {
}
}
impl AudioNode for DelayNode {
impl AudioNode for EchoNode {
fn category(&self) -> NodeCategory {
NodeCategory::Effect
}
@@ -185,7 +185,7 @@ impl AudioNode for DelayNode {
}
fn node_type(&self) -> &str {
"Delay"
"Echo"
}
fn name(&self) -> &str {
@@ -7,7 +7,7 @@ mod bpm_detector;
mod chorus;
mod compressor;
mod constant;
mod delay;
mod echo;
mod distortion;
mod envelope_follower;
mod eq;
@@ -49,7 +49,7 @@ pub use bpm_detector::BpmDetectorNode;
pub use chorus::ChorusNode;
pub use compressor::CompressorNode;
pub use constant::ConstantNode;
pub use delay::DelayNode;
pub use echo::EchoNode;
pub use distortion::DistortionNode;
pub use envelope_follower::EnvelopeFollowerNode;
pub use eq::EQNode;
+11
View File
@@ -506,6 +506,17 @@ impl Project {
}
}
/// Reset all node graphs (clears effect buffers on seek)
pub fn reset_all_graphs(&mut self) {
for track in self.tracks.values_mut() {
match track {
TrackNode::Audio(t) => t.effects_graph.reset(),
TrackNode::Midi(t) => t.instrument_graph.reset(),
TrackNode::Group(_) => {}
}
}
}
/// Process live MIDI input from all MIDI tracks (called even when not playing)
pub fn process_live_midi(&mut self, output: &mut [f32], sample_rate: u32, channels: u32) {
// Process all MIDI tracks to handle queued live input events