rudimentary input quantizer

This commit is contained in:
🪞👃🪞 2024-07-05 15:48:28 +03:00
parent 665885f6ff
commit f6a7cbf38e
8 changed files with 108 additions and 54 deletions

View file

@ -115,6 +115,7 @@ impl Track {
input: MidiIter,
timebase: &Arc<Timebase>,
playing: Option<TransportState>,
quant: usize,
panic: bool,
scope: &ProcessScope,
(frame0, frames): (usize, usize),
@ -158,6 +159,7 @@ impl Track {
if let Some(phrase) = phrase {
let pulse = timebase.frames_pulses((frame0 + time) as f64) as usize;
let pulse = pulse % phrase.length;
let pulse = (pulse / quant) * quant;
let contains = phrase.notes.contains_key(&pulse);
if contains {
phrase.notes.get_mut(&pulse).unwrap().push(message.clone());