Make MidiCC working
This commit is contained in:
parent
2c77ea83df
commit
db2e5b13ed
3 changed files with 9 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 } }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue