Skip to content

Commit

Permalink
better debug behavior + optional analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubobubobubobubo committed Nov 30, 2023
1 parent 49f7998 commit c192988
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/classes/SoundEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ export class SoundEvent extends AudibleEvent {
self.updateValue("release", 0.0);
return self;
},
analyze: function(self: SoundEvent) {
self.updateValue("analyze", true)
return self
},
debug: function(self: SoundEvent, callback?: Function) {
self.updateValue("debug", true)
if (callback) {
Expand Down Expand Up @@ -382,12 +386,10 @@ export class SoundEvent extends AudibleEvent {
s,
n: n.length > 0 ? n : undefined,
dur: this.app.clock.convertPulseToSecond(this.app.clock.ppqn),
analyze: true,
};
} else if (typeof sound === "object") {
const validatedObj: SoundParams = {
dur: this.app.clock.convertPulseToSecond(this.app.clock.ppqn),
analyze: true,
...(sound as Partial<SoundParams>),
};
return validatedObj;
Expand All @@ -400,10 +402,9 @@ export class SoundEvent extends AudibleEvent {
s,
n,
dur: this.app.clock.convertPulseToSecond(this.app.clock.ppqn),
analyze: true,
};
} else {
return { s: sound, dur: 0.5, analyze: true };
return { s: sound, dur: 0.5 };
}
}
};
Expand Down Expand Up @@ -467,8 +468,9 @@ export class SoundEvent extends AudibleEvent {
if (this.values["debug"]) {
if (this.values["debugFunction"]) {
this.values["debugFunction"](filteredEvent)
} else {
console.log(filteredEvent)
}
console.log(filteredEvent)
}
superdough(
filteredEvent,
Expand Down

0 comments on commit c192988

Please sign in to comment.