adding bpb function
This commit is contained in:
16
src/API.ts
16
src/API.ts
@ -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(
|
||||
|
||||
Reference in New Issue
Block a user