From 90c948d27292361db44d80d6076d6bc8ed7b30c8 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Wed, 10 Aug 2022 22:42:48 +0200 Subject: [PATCH] Got first rough prototype of the MidiP node going --- src/dsp/node_midip.rs | 3 +-- src/nodes/note_buffer.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dsp/node_midip.rs b/src/dsp/node_midip.rs index 8fe4c34..bfe8a80 100644 --- a/src/dsp/node_midip.rs +++ b/src/dsp/node_midip.rs @@ -85,8 +85,7 @@ impl DspNode for MidiP { outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals, ) { - let out_i = out_idx::MidiP::freq(); - + let out_i = out_idx::MidiP::gate(); let (freq, r) = outputs.split_at_mut(out_i); let (gate, vel) = r.split_at_mut(1); let freq = &mut freq[0]; diff --git a/src/nodes/note_buffer.rs b/src/nodes/note_buffer.rs index d1c8038..42d847f 100644 --- a/src/nodes/note_buffer.rs +++ b/src/nodes/note_buffer.rs @@ -42,11 +42,18 @@ impl NoteBuffer { } } + #[inline] + pub fn step_to(&mut self, buf_idx: usize) { + while self.buf_idx < (buf_idx % MAX_BLOCK_SIZE) { + self.step(); + } + } + #[inline] pub fn step(&mut self) { let cur = self.buf_idx; let next = (self.buf_idx + 1) % MAX_BLOCK_SIZE; - println!("COPY {}..{} => {}", (cur * 16), ((cur + 1) * 16), next * 16); + //d// println!("COPY {}..{} => {}", (cur * 16), ((cur + 1) * 16), next * 16); self.interleaved_chans.copy_within((cur * 16)..((cur + 1) * 16), next * 16); self.buf_idx = next; }