Merge branch 'time-warp' of github.com:Bubobubobubobubo/Topos into time-warp

This commit is contained in:
2023-09-01 13:02:52 +02:00
8 changed files with 107 additions and 13 deletions

View File

@ -405,6 +405,11 @@ export class UserAPI {
player.updateLastCallTime();
if(id !== "") {
// Sync named patterns to z0 by default
player.sync("z0");
}
return player;
};
@ -1044,6 +1049,19 @@ export class UserAPI {
return final_pulses.some((p) => p == true);
};
oneuclid = (pulses: number, length: number, rotate: number=0): boolean => {
/**
* Returns true if the current beat is in the given euclid sequence.
* @param pulses - The number of pulses in the cycle
* @param length - The length of the cycle
* @param rotate - Rotation of the euclidian sequence
* @returns True if the current beat is in the given euclid sequence
*/
const cycle = this._euclidean_cycle(pulses, length, rotate);
const beats = cycle.reduce((acc:number[], x:boolean, i:number) => { if(x) acc.push(i+1); return acc; }, []);
return this.oncount(beats, length);
};
// ======================================================================
// Delay related functions
// ======================================================================