adding new important method

This commit is contained in:
2023-08-13 12:03:53 +02:00
parent 8aa4255cff
commit 0cb03c7473
3 changed files with 14 additions and 6 deletions

View File

@ -47,7 +47,7 @@ export class Clock {
this.time_position = { bar: 0, beat: 0, pulse: 0 }
this.bpm = 120;
this.time_signature = [4, 4];
this.ppqn = 48*2;
this.ppqn = 48;
ctx.audioWorklet.addModule(TransportProcessor).then((e) => {
this.transportNode = new TransportNode(ctx, {}, this.app);
this.transportNode.connect(ctx.destination);
@ -65,6 +65,10 @@ export class Clock {
return this.time_signature[0];
}
get beats_since_origin(): number {
return (this.time_position.bar - 1) * this.beats_per_bar + this.time_position.beat;
}
get pulse_duration(): number {
/**
* Returns the duration of a pulse in seconds.