Fix some clock properties, start cleaning up

This commit is contained in:
2024-04-20 02:44:35 +02:00
parent 0b09f16624
commit 605db460e5
4 changed files with 21 additions and 27 deletions

View File

@ -1,5 +1,3 @@
import { blinkScript } from "../DOM/Visuals/Blinkers";
class TransportProcessor extends AudioWorkletProcessor {
constructor(options) {
super(options);
@ -13,6 +11,7 @@ class TransportProcessor extends AudioWorkletProcessor {
this.currentPulsePosition = 0;
this.startTime = 0;
this.pauseTime = 0;
this.grain = 0;
this.totalPauseTime = 0;
}
@ -59,6 +58,7 @@ class TransportProcessor extends AudioWorkletProcessor {
const currentPulsePosition = Math.round(beatNumber * this.ppqn);
if (currentPulsePosition > this.currentPulsePosition) {
this.grain += 1;
this.currentPulsePosition = currentPulsePosition;
// Calculate current tick, beat, and bar
@ -81,6 +81,7 @@ class TransportProcessor extends AudioWorkletProcessor {
bpm: this.bpm,
num: this.timeSignature[0],
den: this.timeSignature[1],
grain: this.grain,
});
}
}