restore tempo and signature functions

This commit is contained in:
2023-07-28 16:53:02 +02:00
parent 944fe89b64
commit 2e1c0947b5

View File

@ -36,6 +36,12 @@ export class UserAPI {
get(name: string) { return this.variables[name] } get(name: string) { return this.variables[name] }
pick<T>(...array: T[]): T { return array[Math.floor(Math.random() * array.length)] } pick<T>(...array: T[]): T { return array[Math.floor(Math.random() * array.length)] }
bpm(bpm: number) { this.app.clock.bpm = bpm }
time_signature(numerator: number, denominator: number) {
this.app.clock.time_signature = [ numerator, denominator ]
}
almostNever() { return Math.random() > 0.9 } almostNever() { return Math.random() > 0.9 }
sometimes() { return Math.random() > 0.5 } sometimes() { return Math.random() > 0.5 }
@ -70,7 +76,7 @@ export class UserAPI {
return pulse.includes(this.app.clock.time_position.pulse) && this.app.clock.time_position.pulse == 1 return pulse.includes(this.app.clock.time_position.pulse) && this.app.clock.time_position.pulse == 1
} }
modPulse(pulse: number) { mod(pulse: number) {
return this.app.clock.time_position.pulse % pulse === 0 return this.app.clock.time_position.pulse % pulse === 0
} }