feat: added lots of ui

This commit is contained in:
Daniel Ledda
2021-08-29 22:53:15 +02:00
parent a5f5169e62
commit cdf6ef754d
22 changed files with 384 additions and 49 deletions

View File

@@ -32,7 +32,7 @@ export default class Beat implements IPublisher<BeatEvents>{
this.key = `Beat-${Beat.count}`;
this.name = options?.name ?? this.key;
this.setTimeSignature({up: options?.timeSig?.up ?? 4, down: options?.timeSig?.down ?? 4});
this.setBars(options?.bars ?? 48);
this.setBars(options?.bars ?? 4);
Beat.count++;
}
@@ -61,6 +61,10 @@ export default class Beat implements IPublisher<BeatEvents>{
this.publisher.notifySubs(BeatEvents.NewBarCount);
}
getUnitByIndex(index: number): BeatUnit | null {
return this.unitRecord[index] ?? null;
}
private updateBeatUnitLength() {
const newBarCount = this.barCount * this.timeSigUp;
if (newBarCount < this.unitRecord.length) {
@@ -146,7 +150,7 @@ export default class Beat implements IPublisher<BeatEvents>{
return this.key;
}
private static isValidTimeSigRange(sig: number): boolean {
static isValidTimeSigRange(sig: number): boolean {
return sig >= 2 && sig <= 64;
}