fix cyclist clock cycle

This commit is contained in:
Jade (Rose) Rowland
2024-05-08 00:05:05 -04:00
parent 7df663e87d
commit 16472b59dd
3 changed files with 92 additions and 81 deletions
+3 -1
View File
@@ -34,6 +34,8 @@ export class Cyclist {
try {
const begin = this.lastEnd;
const cycle = this.now();
this.lastBegin = begin;
const end = this.num_cycles_at_cps_change + num_cycles_since_cps_change;
this.lastEnd = end;
@@ -56,7 +58,7 @@ export class Cyclist {
// the following line is dumb and only here for backwards compatibility
// see https://github.com/tidalcycles/strudel/pull/1004
const deadline = targetTime - phase;
onTrigger?.(hap, deadline, duration, this.cps, targetTime, end);
onTrigger?.(hap, deadline, duration, this.cps, targetTime, cycle);
}
});
} catch (e) {
+1 -10
View File
@@ -4,7 +4,6 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import Fraction from 'fraction.js';
import { logger } from './logger.mjs';
export class NeoCyclist {
@@ -87,15 +86,7 @@ export class NeoCyclist {
this.latency +
this.worker_time_dif;
const duration = hap.duration / this.cps;
onTrigger?.(
hap,
0,
duration,
this.cps,
targetTime,
this.cycle,
// + Fraction(this.latency).div(this.cps)
);
onTrigger?.(hap, 0, duration, this.cps, targetTime, this.cycle);
}
});
};