Continue adaptation work

This commit is contained in:
2024-04-14 23:34:53 +02:00
parent b2a8e18b0e
commit 57f0c9dfe6
20 changed files with 1079 additions and 1055 deletions

View File

@ -83,10 +83,9 @@ export class UserAPI {
*/
public codeExamples: { [key: string]: string } = {};
public counters: { [key: string]: any } = {};
//@ts-ignore
private counters: { [key: string]: any } = {};
//@ts-ignore
private _drunk: DrunkWalk = new DrunkWalk(-100, 100, false);
public _drunk: DrunkWalk = new DrunkWalk(-100, 100, false);
public randomGen = Math.random;
public currentSeed: string | undefined = undefined;
public localSeeds = new Map<string, Function>();
@ -274,11 +273,11 @@ export class UserAPI {
this.MidiConnection = new MidiConnection(this, app.settings);
this.global = {};
this.g = this.global;
this.time = Transport.time(this.app);
this.play = Transport.play(this.app);
this.pause = Transport.pause(this.app);
this.stop = Transport.stop(this.app);
this.silence = Transport.silence(this.app);
this.time = Transport.time(this);
this.play = Transport.play(this);
this.pause = Transport.pause(this);
this.stop = Transport.stop(this);
this.silence = Transport.silence(this);
this.tempo = Transport.tempo(this.app);
this.bpb = Transport.bpb(this.app);
this.ppqn = Transport.ppqn(this.app);
@ -324,9 +323,9 @@ export class UserAPI {
this.animals = Canvas.animals();
this.expressions = Canvas.expressions();
this.generateCacheKey = Cache.generateCacheKey();
this.resetAllFromCache = Cache.resetAllFromCache(this.app);
this.clearPatternCache = Cache.clearPatternCache(this.app);
this.removePatternFromCache = Cache.removePatternFromCache(this.app);
this.resetAllFromCache = Cache.resetAllFromCache(this);
this.clearPatternCache = Cache.clearPatternCache(this);
this.removePatternFromCache = Cache.removePatternFromCache(this);
this.script = Script.script(this.app);
this.s = this.script;
this.delete_script = Script.delete_script(this.app);
@ -336,10 +335,10 @@ export class UserAPI {
this.copy_universe = Script.copy_universe(this.app);
this.delete_universe = Script.delete_universe(this.app);
this.big_bang = Script.big_bang(this.app);
this.drunk = Drunk.drunk(this.app);
this.drunk_max = Drunk.drunk_max(this.app);
this.drunk_min = Drunk.drunk_min(this.app);
this.drunk_wrap = Drunk.drunk_wrap(this.app);
this.drunk = Drunk.drunk(this);
this.drunk_max = Drunk.drunk_max(this);
this.drunk_min = Drunk.drunk_min(this);
this.drunk_wrap = Drunk.drunk_wrap(this);
this.warp = Warp.warp(this.app);
this.beat_warp = Warp.beat_warp(this.app);
this.min = Mathematics.min();
@ -359,7 +358,7 @@ export class UserAPI {
this.flip = Filters.flip(this.app);
this.flipbar = Filters.flipbar(this.app);
this.onbar = Filters.onbar(this.app);
this.onbeat = Filters.onbeat(this.app);
this.onbeat = Filters.onbeat(this);
this.oncount = Filters.oncount(this.app);
this.oneuclid = Filters.oneuclid(this.app);
this.euclid = Filters.euclid();
@ -378,23 +377,23 @@ export class UserAPI {
this.usaw = LFO.usaw(this.app);
this.triangle = LFO.triangle(this.app);
this.utriangle = LFO.utriangle(this.app);
this.square = LFO.square();
this.usquare = LFO.usquare();
this.noise = LFO.noise(this.app);
this.unoise = LFO.unoise(this.app);
this.prob = Probability.prob(this.app);
this.toss = Probability.toss(this.app);
this.odds = Probability.odds(this.app);
this.square = LFO.square(this.app);
this.usquare = LFO.usquare(this.app);
this.noise = LFO.noise(this);
this.unoise = LFO.unoise(this);
this.prob = Probability.prob(this);
this.toss = Probability.toss(this);
this.odds = Probability.odds(this);
this.never = Probability.never();
this.almostNever = Probability.almostNever(this.app);
this.rarely = Probability.rarely(this.app);
this.scarcely = Probability.scarcely(this.app);
this.sometimes = Probability.sometimes(this.app);
this.often = Probability.often(this.app);
this.frequently = Probability.frequently(this.app);
this.almostAlways = Probability.almostAlways(this.app);
this.almostNever = Probability.almostNever(this);
this.rarely = Probability.rarely(this);
this.scarcely = Probability.scarcely(this);
this.sometimes = Probability.sometimes(this);
this.often = Probability.often(this);
this.frequently = Probability.frequently(this);
this.almostAlways = Probability.almostAlways(this);
this.always = Probability.always();
this.dice = Probability.dice(this.app);
this.dice = Probability.dice(this);
this.osc = OSC.osc(this.app);
this.getOSC = OSC.getOSC(this.app);
this.gif = Canvas.gif(this.app);
@ -404,16 +403,16 @@ export class UserAPI {
this.seed = Randomness.seed(this.app);
this.localSeededRandom = Randomness.localSeededRandom(this.app);
this.clearLocalSeed = Randomness.clearLocalSeed(this.app);
this.once = Counter.once(this.app);
this.counter = Counter.counter(this.app);
this.once = Counter.once(this);
this.counter = Counter.counter(this);
this.$ = this.counter;
this.count = this.counter;
this.i = Counter.i(this.app);
this.sound = Sound.sound(this.app);
this.snd = this.sound;
this.snd = this.sound;
this.speak = Sound.speak();
this.log = Console.log(this.app);
this.logOnce = Console.logOnce(this.app);
this.log = Console.log(this);
this.logOnce = Console.logOnce(this);
this.cbar = Transport.cbar(this.app);
this.ctick = Transport.ctick(this.app);
this.cpulse = Transport.cpulse(this.app);
@ -425,7 +424,7 @@ export class UserAPI {
this.denominator = Transport.denominator(this.app); // Alias for meter
this.pulsesForBar = Transport.pulsesForBar(this.app);
}
}
public g: any;
@ -474,7 +473,7 @@ export class UserAPI {
? code
: (this.app.selectedExample as string);
}
this.clearPatternCache();
this.patternCache.clear();
this.stop();
this.play();
};
@ -609,7 +608,7 @@ export class UserAPI {
nearScales = nearScales;
public cue = (functionName: string | Function): void => {
functionName = typeof functionName === "function" ? functionName.name : functionName;
this.cueTimes[functionName] = this.app.clock.pulses_since_origin;
functionName = typeof functionName === "function" ? functionName.name : functionName;
this.cueTimes[functionName] = this.app.clock.pulses_since_origin;
};
}
}