function to set the ppqn

This commit is contained in:
2023-08-15 11:58:34 +02:00
parent 01fd9bd4a1
commit 0802a5da5d
2 changed files with 14 additions and 3 deletions

View File

@ -422,7 +422,7 @@ export class UserAPI {
// Small algorithmic functions
// =============================================================
_sequence_key_generator(pattern: any[]) {
private _sequence_key_generator(pattern: any[]) {
/**
* Generates a key for the sequence function.
*
@ -433,7 +433,7 @@ export class UserAPI {
return btoa(JSON.stringify(pattern));
}
seq(...input: any[]) {
public seq(...input: any[]) {
/**
* Returns a value in a sequence stored using an LRU Cache.
* The sequence is stored in the cache with an hash identifier
@ -615,6 +615,17 @@ export class UserAPI {
return n;
}
ppqn(n?: number) {
/**
* Sets or returns the number of pulses per quarter note.
*/
if (n === undefined) return this.app.clock.ppqn;
if (n < 1) console.log(`Setting ppqn to ${n}`);
this.app.clock.ppqn = n;
return n;
}
time_signature(numerator: number, denominator: number): void {
/**
* Sets the time signature.