Added all() method for chaining all events

This commit is contained in:
2023-12-22 15:26:51 +02:00
parent 98f431f6b2
commit 30983147ea
5 changed files with 44 additions and 5 deletions

View File

@ -521,4 +521,13 @@ export abstract class AudibleEvent extends AbstractEvent {
this.app.api.cue(functionName);
return this;
}
runChain = (): this => {
// chainAll is defined using all() in the API
if("chainAll" in this && typeof this.chainAll === "function") {
this.values = this.chainAll().values;
}
return this;
}
}

View File

@ -115,7 +115,7 @@ export class MidiEvent extends AudibleEvent {
return this;
};
out = (): void => {
out = (outChannel?: number|number[]): void => {
function play(event: MidiEvent, params: MidiParams): void {
const channel = params.channel ? params.channel : 0;
const velocity = params.velocity ? params.velocity : 100;
@ -141,6 +141,9 @@ export class MidiEvent extends AudibleEvent {
);
}
this.runChain();
if(outChannel) this.channel(outChannel);
const events = objectWithArraysToArrayOfObjects(this.values, [
"parsedScale",
]) as MidiParams[];

View File

@ -423,6 +423,7 @@ export class SoundEvent extends AudibleEvent {
};
out = (orbit?: number | number[]): void => {
this.runChain();
if (orbit) this.values["orbit"] = orbit;
const events = objectWithArraysToArrayOfObjects(this.values, [
"parsedScale",