mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
rudimentary input quantizer
This commit is contained in:
parent
665885f6ff
commit
f6a7cbf38e
8 changed files with 108 additions and 54 deletions
|
|
@ -50,6 +50,7 @@ impl Phrase {
|
|||
let end = timebase.usecs_frames((usec0 + usecs) as f64);
|
||||
let repeat = timebase.pulses_frames(self.length as f64);
|
||||
let ticks = timebase.frames_to_ticks(start, end, repeat);
|
||||
//panic!("{start} {end} {repeat} {ticks:?}");
|
||||
for (time, tick) in ticks.iter() {
|
||||
if let Some(events) = self.notes.get(&(*tick as usize)) {
|
||||
for message in events.iter() {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue