This commit is contained in:
Jade (Rose) Rowland 2024-08-18 12:08:40 -04:00
parent 4eae366bee
commit 2c9ea03fde
3 changed files with 4 additions and 6 deletions

View File

@ -4,9 +4,8 @@
// import createClock from './zyklus.mjs'; // import createClock from './zyklus.mjs';
function getTime() { function getTime() {
const seconds = performance.now() * 0.001;
const seconds = performance.now() * .001; return seconds;
return seconds
// return Math.round(seconds * precision) / precision; // return Math.round(seconds * precision) / precision;
} }

View File

@ -44,7 +44,7 @@ export class NeoCyclist {
haps.forEach((hap) => { haps.forEach((hap) => {
if (hap.hasOnset()) { if (hap.hasOnset()) {
const timeUntilTrigger = cycleToSeconds(hap.whole.begin - this.cycle, this.cps); const timeUntilTrigger = cycleToSeconds(hap.whole.begin - this.cycle, this.cps);
const targetTime = timeUntilTrigger + currentTime + this.latency const targetTime = timeUntilTrigger + currentTime + this.latency;
const duration = cycleToSeconds(hap.duration, this.cps); const duration = cycleToSeconds(hap.duration, this.cps);
onTrigger?.(hap, 0, duration, this.cps, targetTime); onTrigger?.(hap, 0, duration, this.cps, targetTime);
} }

View File

@ -415,7 +415,6 @@ export class ClockCollator {
//when the clock offsets surpass the delta, set the new reference time //when the clock offsets surpass the delta, set the new reference time
if (Math.abs(rollingOffsetTime - this.offsetTime) > this.offsetDelta) { if (Math.abs(rollingOffsetTime - this.offsetTime) > this.offsetDelta) {
this.offsetTime = rollingOffsetTime; this.offsetTime = rollingOffsetTime;
} }
} }
@ -423,7 +422,7 @@ export class ClockCollator {
} }
calculateTimestamp(currentTime, targetTime) { calculateTimestamp(currentTime, targetTime) {
return this.calculateOffset(currentTime) + targetTime return this.calculateOffset(currentTime) + targetTime;
} }
} }