function to set the ppqn
This commit is contained in:
15
src/API.ts
15
src/API.ts
@ -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.
|
||||
|
||||
@ -47,7 +47,7 @@ export class Clock {
|
||||
this.time_position = { bar: 0, beat: 0, pulse: 0 }
|
||||
this.bpm = 120;
|
||||
this.time_signature = [4, 4];
|
||||
this.ppqn = 48;
|
||||
this.ppqn = 8;
|
||||
ctx.audioWorklet.addModule(TransportProcessor).then((e) => {
|
||||
this.transportNode = new TransportNode(ctx, {}, this.app);
|
||||
this.transportNode.connect(ctx.destination);
|
||||
|
||||
Reference in New Issue
Block a user