almost figured it out
This commit is contained in:
parent
19df19375d
commit
e024ae2142
1 changed files with 13 additions and 4 deletions
|
|
@ -36,11 +36,13 @@ export class Cyclist {
|
||||||
const begin = this.lastEnd;
|
const begin = this.lastEnd;
|
||||||
|
|
||||||
const end = this.num_cycles_at_cps_change + num_cycles_since_cps_change;
|
const end = this.num_cycles_at_cps_change + num_cycles_since_cps_change;
|
||||||
let cycle = this.now();
|
let cycle2 = this.now();
|
||||||
//magic number that fixes cycle calcuation, cycle is probably not being calculated correctly
|
//magic number that fixes cycle calcuation, cycle is probably not being calculated correctly
|
||||||
const modifier = this.cps * -interval;
|
const modifier = this.cps * -interval;
|
||||||
cycle = cycle + modifier;
|
cycle2 = cycle2 + modifier;
|
||||||
|
// let cycle = begin + (phase - t) * this.cps;
|
||||||
|
// cycle = begin t
|
||||||
|
// console.log({ phase, t, cycle2 });
|
||||||
if (phase < t) {
|
if (phase < t) {
|
||||||
// avoid querying haps that are in the past anyway
|
// avoid querying haps that are in the past anyway
|
||||||
console.log(`skip query: too late`);
|
console.log(`skip query: too late`);
|
||||||
|
|
@ -49,7 +51,9 @@ export class Cyclist {
|
||||||
|
|
||||||
// query the pattern for events
|
// query the pattern for events
|
||||||
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps });
|
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps });
|
||||||
|
let mod2 = t - phase - this.latency;
|
||||||
|
mod2 = mod2 * this.cps;
|
||||||
|
console.log(this.clock.duration);
|
||||||
haps.forEach((hap) => {
|
haps.forEach((hap) => {
|
||||||
if (hap.hasOnset()) {
|
if (hap.hasOnset()) {
|
||||||
const targetTime =
|
const targetTime =
|
||||||
|
|
@ -59,9 +63,14 @@ export class Cyclist {
|
||||||
// see https://github.com/tidalcycles/strudel/pull/1004
|
// see https://github.com/tidalcycles/strudel/pull/1004
|
||||||
|
|
||||||
const deadline = targetTime - phase;
|
const deadline = targetTime - phase;
|
||||||
|
// console.log();
|
||||||
|
let cycle = hap.whole.begin.valueOf() + mod2;
|
||||||
|
|
||||||
|
// console.log({ cycle, cycle2, mod2 });
|
||||||
onTrigger?.(hap, deadline, duration, this.cps, targetTime, cycle);
|
onTrigger?.(hap, deadline, duration, this.cps, targetTime, cycle);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.lastBegin = begin;
|
this.lastBegin = begin;
|
||||||
this.lastEnd = end;
|
this.lastEnd = end;
|
||||||
this.lastTick = phase;
|
this.lastTick = phase;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue