refactor sequencer processing

This commit is contained in:
🪞👃🪞 2024-06-29 23:29:41 +03:00
parent 2b4f28ae36
commit 82b5614040
4 changed files with 187 additions and 130 deletions

View file

@ -75,7 +75,7 @@ impl Sampler {
let mut mixed = vec![vec![0.0;scope.n_frames() as usize];channel_count];
// Emit next chunk of each currently playing voice,
// removing voices that have completed playing.
// dropping voices that have reached their ends.
let mut voices = vec![];
std::mem::swap(&mut voices, &mut self.voices);
loop {
@ -93,6 +93,11 @@ impl Sampler {
self.voices.push(voice);
}
}
// process midi in
// add new voices
// emit new voices starting from midi event frames
//
for (i, port) in self.audio_outs.iter_mut().enumerate() {
let buffer = &mixed[i];
for (i, value) in port.as_mut_slice(scope).iter_mut().enumerate() {
@ -100,9 +105,6 @@ impl Sampler {
}
}
Control::Continue
// process midi in
// add new voices
// emit new voices starting from midi event frames
//for event in self.midi_in.iter(scope) {
//let len = 3.min(event.bytes.len());