diff --git a/src/dsp/node_midicc.rs b/src/dsp/node_midicc.rs index 8f2bed1..6596577 100644 --- a/src/dsp/node_midicc.rs +++ b/src/dsp/node_midicc.rs @@ -80,9 +80,9 @@ impl DspNode for MidiCC { let sig3 = &mut sig3[0]; let midicc_channel = (chan.i() as usize % 16) as u8; - let midicc_cc1 = (chan.i() as usize % 128) as u8; - let midicc_cc2 = (chan.i() as usize % 128) as u8; - let midicc_cc3 = (chan.i() as usize % 128) as u8; + let midicc_cc1 = (cc1.i() as usize % 128) as u8; + let midicc_cc2 = (cc2.i() as usize % 128) as u8; + let midicc_cc3 = (cc3.i() as usize % 128) as u8; let mut ptr = MidiEventPointer::new(&ectx.midi_ccs[..]); @@ -92,6 +92,7 @@ impl DspNode for MidiCC { while let Some(ev) = ptr.next_at(frame) { match ev { HxMidiEvent::CC { channel, cc, value } => { + println!("CC: {} {} {}", channel, cc, value); if channel != midicc_channel { continue; } diff --git a/src/dsp/node_midip.rs b/src/dsp/node_midip.rs index f7fae9e..fd6cb31 100644 --- a/src/dsp/node_midip.rs +++ b/src/dsp/node_midip.rs @@ -152,7 +152,7 @@ impl DspNode for MidiP { let note = (self.cur_note as f32 - 69.0) / 120.0; let note = note + det.read(frame); - println!("FRAME: {} => gate={}, freq={}, next_gate={}", frame, self.cur_gate, note, self.next_gate); + //d// println!("FRAME: {} => gate={}, freq={}, next_gate={}", frame, self.cur_gate, note, self.next_gate); freq.write(frame, note); gate.write(frame, if self.cur_gate > 0 { 1.0 } else { 0.0 }); vel.write(frame, self.cur_vel as f32); diff --git a/src/nodes/note_buffer.rs b/src/nodes/note_buffer.rs index 37e3138..ed1f6b8 100644 --- a/src/nodes/note_buffer.rs +++ b/src/nodes/note_buffer.rs @@ -20,6 +20,10 @@ impl HxTimedEvent { } } + pub fn cc(timing: usize, channel: u8, cc: u8, value: f32) -> Self { + Self { timing, kind: HxMidiEvent::CC { channel, cc, value } } + } + pub fn note_on(timing: usize, channel: u8, note: u8, vel: f32) -> Self { Self { timing, kind: HxMidiEvent::NoteOn { channel, note, vel } } }