Skip to content

Commit

Permalink
Generating documentation using factory
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubobubobubobubo committed Aug 25, 2023
1 parent 94acee8 commit 58c0a2c
Show file tree
Hide file tree
Showing 3 changed files with 407 additions and 370 deletions.
18 changes: 10 additions & 8 deletions src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Array.prototype.in = function <T>(this: T[], value: T): boolean {
return this.includes(value);
};

async function loadSamples() {
export async function loadSamples() {
// const ds = "https://raw.githubusercontent.com/felixroos/dough-samples/main/";
return Promise.all([
initAudioOnFirstClick(),
Expand All @@ -62,8 +62,6 @@ async function loadSamples() {
]);
}

loadSamples();

export const generateCacheKey = (...args: any[]): string => {
return args.map((arg) => JSON.stringify(arg)).join(",");
};
Expand Down Expand Up @@ -92,6 +90,10 @@ export class UserAPI {
//this.load = samples("github:tidalcycles/Dirt-Samples/master");
}

_all_samples = (): object => {
return soundMap.get();
};

_reportError = (error: any): void => {
console.log(error);
clearTimeout(this.errorTimeoutID);
Expand Down Expand Up @@ -236,7 +238,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.
*
Expand Down Expand Up @@ -323,8 +325,8 @@ export class UserAPI {
this.app.api.patternCache.set(key, player);
}
if ((player && player.notStarted()) || player.played) {
player.callTime = this.epulse();
player.played = false;
player.callTime = this.epulse();
player.played = false;
}
return player;
};
Expand Down Expand Up @@ -889,7 +891,7 @@ export class UserAPI {
let integral_part = Math.floor(b);
let decimal_part = b - integral_part;
final_pulses.push(
integral_part === this.app.clock.time_position.beat &&
integral_part === this.app.clock.time_position.beat &&
this.app.clock.time_position.pulse ===
decimal_part * this.app.clock.ppqn
);
Expand Down Expand Up @@ -1235,7 +1237,7 @@ export class UserAPI {
// Trivial functions
// =============================================================

sound = (sound: string|object) => {
sound = (sound: string | object) => {
return new SoundEvent(sound, this.app);
};

Expand Down
Loading

0 comments on commit 58c0a2c

Please sign in to comment.