Synced ziffers to onbeat (on start) + merge
This commit is contained in:
27
src/API.ts
27
src/API.ts
@ -236,7 +236,7 @@ export class UserAPI {
|
||||
}
|
||||
};
|
||||
|
||||
public midi = (value: number | object = 60): NoteEvent => {
|
||||
public midi = (value: number|object = 60): NoteEvent => {
|
||||
/**
|
||||
* Sends a MIDI note to the current MIDI output.
|
||||
*
|
||||
@ -255,7 +255,6 @@ export class UserAPI {
|
||||
*/
|
||||
this.MidiConnection.sendSysExMessage(data);
|
||||
};
|
||||
sy = this.sysex;
|
||||
|
||||
public pitch_bend = (value: number, channel: number): void => {
|
||||
/**
|
||||
@ -278,7 +277,6 @@ export class UserAPI {
|
||||
*/
|
||||
this.MidiConnection.sendProgramChange(program, channel);
|
||||
};
|
||||
pc = this.program_change;
|
||||
|
||||
public midi_clock = (): void => {
|
||||
/**
|
||||
@ -300,7 +298,6 @@ export class UserAPI {
|
||||
*/
|
||||
this.MidiConnection.sendMidiControlChange(control, value, channel);
|
||||
};
|
||||
cc = this.control_change;
|
||||
|
||||
public midi_panic = (): void => {
|
||||
/**
|
||||
@ -325,9 +322,9 @@ export class UserAPI {
|
||||
player = new Player(input, options, this.app);
|
||||
this.app.api.patternCache.set(key, player);
|
||||
}
|
||||
if ((player && player.ziffers.index === -1) || player.played) {
|
||||
player.callTime = this.epulse();
|
||||
player.played = false;
|
||||
if ((player && player.notStarted()) || player.played) {
|
||||
player.callTime = this.epulse();
|
||||
player.played = false;
|
||||
}
|
||||
return player;
|
||||
};
|
||||
@ -491,12 +488,6 @@ export class UserAPI {
|
||||
return current_chunk % 2 === 0;
|
||||
};
|
||||
|
||||
public babou = (chunk: number): boolean => {
|
||||
const time_pos = this.epulse();
|
||||
const chunkSize = Math.floor(chunk * this.ppqn());
|
||||
return time_pos % chunkSize === 0;
|
||||
};
|
||||
|
||||
public divbar = (chunk: number): boolean => {
|
||||
const time_pos = this.bar() - 1;
|
||||
const current_chunk = Math.floor(time_pos / chunk);
|
||||
@ -875,8 +866,10 @@ export class UserAPI {
|
||||
};
|
||||
|
||||
onbar = (n: number, ...bar: number[]): boolean => {
|
||||
let bar_modulo = (this.bar() % n) + 1;
|
||||
return bar.some((b) => b == bar_modulo);
|
||||
// n is acting as a modulo on the bar number
|
||||
const bar_list = [...Array(n).keys()].map((i) => i + 1);
|
||||
console.log(bar.some((b) => bar_list.includes(b % n)));
|
||||
return bar.some((b) => bar_list.includes(b % n));
|
||||
};
|
||||
|
||||
onbeat = (...beat: number[]): boolean => {
|
||||
@ -1041,7 +1034,7 @@ export class UserAPI {
|
||||
*/
|
||||
return this._euclidean_cycle(pulses, length, rotate)[iterator % length];
|
||||
};
|
||||
eu = this.euclid;
|
||||
ec = this.euclid;
|
||||
|
||||
_euclidean_cycle(
|
||||
pulses: number,
|
||||
@ -1241,7 +1234,7 @@ export class UserAPI {
|
||||
// Trivial functions
|
||||
// =============================================================
|
||||
|
||||
sound = (sound: string | object) => {
|
||||
sound = (sound: string|object) => {
|
||||
return new SoundEvent(sound, this.app);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user