adding bpb function

This commit is contained in:
2023-08-14 23:54:13 +02:00
parent c16363d984
commit 0cd6a1bd41

View File

@ -543,6 +543,20 @@ export class UserAPI {
}
tempo = this.bpm;
bpb(n?: number): number {
/**
* Sets or returns the number of beats per bar.
*
* @param bpb - [optional] The number of beats per bar to set
* @returns The current bpb
*/
if (n === undefined) return this.app.clock.time_signature[0];
if (n < 1) console.log(`Setting bpb to ${n}`);
this.app.clock.time_signature[0] = n;
return n;
}
time_signature(numerator: number, denominator: number): void {
/**
* Sets the time signature.
@ -698,7 +712,7 @@ export class UserAPI {
*/
let final_pulses: boolean[] = [];
beat.forEach((b) => {
b = 1 + (b % this.app.clock.time_signature[0]);
b = (b % this.app.clock.time_signature[0]);
let integral_part = Math.floor(b);
let decimal_part = b - integral_part;
final_pulses.push(