Finished gate len for MidiP

This commit is contained in:
Weird Constructor 2022-08-16 03:53:41 +02:00
parent 3b4e8a36f5
commit 549aa8888d
2 changed files with 5 additions and 5 deletions

View file

@ -157,14 +157,12 @@ impl DspNode for MidiP {
} else { } else {
self.cur_gate = 1; self.cur_gate = 1;
} }
println!("NOTE ON");
self.trig_sig.trigger(); self.trig_sig.trigger();
self.gate_sig.trigger(); self.gate_sig.trigger();
self.cur_note = note; self.cur_note = note;
self.cur_vel = vel; self.cur_vel = vel;
} }
HxMidiEvent::NoteOff { channel, note } => { HxMidiEvent::NoteOff { channel, note } => {
println!("NOTE OFF");
if channel != midip_channel { if channel != midip_channel {
continue; continue;
} }
@ -182,11 +180,13 @@ impl DspNode for MidiP {
gate.write(frame, self.trig_sig.next()); gate.write(frame, self.trig_sig.next());
} }
2 => { 2 => {
println!("GOGOGO {} {}", gate_len, self.next_gate);
if self.next_gate > 0 { if self.next_gate > 0 {
gate.write(frame, 0.0); gate.write(frame, 0.0);
self.cur_gate = 0;
} else { } else {
gate.write(frame, self.gate_sig.next(gate_len)); let gsig = self.gate_sig.next(gate_len);
self.cur_gate = gsig.ceil() as u8;
gate.write(frame, gsig);
} }
} }
_ => { _ => {

View file

@ -227,7 +227,7 @@ fn check_node_midip_gate_test() {
); );
let changes = collect_signal_changes_both_edges(&ch1[..], 1); let changes = collect_signal_changes_both_edges(&ch1[..], 1);
assert_eq!(changes, vec![(100, 100), (145, -100)]); assert_eq!(changes, vec![(100, 100), (120, -100), (121, 100), (166, -100)]);
// // Now test without the trigger signal: // // Now test without the trigger signal:
// node_pset_s(&mut matrix, "midip", 0, "gmode", 0); // node_pset_s(&mut matrix, "midip", 0, "gmode", 0);