fully implemented

This commit is contained in:
Jade (Rose) Rowland 2025-07-08 00:26:15 -04:00
parent d9e44dcda6
commit ce5f425142
7 changed files with 227 additions and 306 deletions

View file

@ -38,16 +38,13 @@ export class Cyclist {
const end = begin + eventLength;
this.cycle = begin + secondsSinceLastTick * this.cps;
//account for latency and tick duration when using cycle calculations for audio downstream
const cycle_gap = (this.latency - duration) * this.cps;
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps });
haps.forEach((hap) => {
if (hap.hasOnset()) {
let targetTime = (hap.whole.begin - this.num_cycles_at_cps_change) / this.cps;
targetTime = targetTime + this.latency + tickdeadline + time - num_seconds_since_cps_change;
const duration = hap.duration / this.cps;
onTrigger?.(hap, tickdeadline, duration, this.cps, targetTime, this.cycle - cycle_gap);
onTrigger?.(hap, tickdeadline, duration, this.cps, targetTime);
}
});
this.time_at_last_tick_message = time;
@ -119,4 +116,4 @@ export class Cyclist {
const onsets = haps.filter((h) => h.hasOnset());
console.log(`${begin.toFixed(4)} - ${end.toFixed(4)} ${Array(onsets.length).fill('I').join('')}`);
}
}
}