Minor fixes

This commit is contained in:
2023-11-10 13:27:03 +01:00
parent 1bd9468c40
commit c4f9cdccf2
5 changed files with 26 additions and 28 deletions

View File

@ -164,7 +164,7 @@ export class Clock {
}
get realTime(): number {
return this.app.audioContext.currentTime - this.totalPauseTime;
return this.app.audioContext.currentTime - this.totalPauseTime;
}
get deviation(): number {
@ -175,6 +175,7 @@ export class Clock {
if (ppqn > 0 && this._ppqn !== ppqn) {
this._ppqn = ppqn;
this.transportNode?.setPPQN(ppqn);
this.logicalTime = this.realTime;
}
}
@ -192,15 +193,12 @@ export class Clock {
*/
const pulseDuration = this.pulse_duration;
const nudgedTime = time + nudge;
const nextTickTime = Math.ceil(nudgedTime /
pulseDuration) * pulseDuration;
const nextTickTime = Math.ceil(nudgedTime / pulseDuration) * pulseDuration;
const remainingTime = nextTickTime - nudgedTime;
return remainingTime;
}
public convertPulseToSecond(n: number): number {
/**
* Converts a pulse to a second.
@ -218,7 +216,7 @@ export class Clock {
this.running = true;
this.app.api.MidiConnection.sendStartMessage();
this.lastPlayPressTime = this.app.audioContext.currentTime;
this.totalPauseTime += (this.lastPlayPressTime - this.lastPauseTime);
this.totalPauseTime += this.lastPlayPressTime - this.lastPauseTime;
this.transportNode?.start();
}