feat: added lots of ui
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user