Skip to content

Commit

Permalink
add null as possible note for rest
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubobubobubobubo committed Oct 9, 2023
1 parent f92b7d7 commit 5de6bee
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/classes/SoundEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,11 @@ export class SoundEvent extends AudibleEvent {
public cut = (value: number) => this.updateValue("cut", value);
public clip = (value: number) => this.updateValue("clip", value);
public n = (value: number) => this.updateValue("n", value);
public note = (value: number | string) => {
public note = (value: number | string | null) => {
if (typeof value === "string") {
return this.updateValue("note", noteNameToMidi(value));
} else if (typeof value == null || value == undefined) {
return this.updateValue("note", 0).updateValue("gain", 0);
} else {
return this.updateValue("note", value);
}
Expand Down

0 comments on commit 5de6bee

Please sign in to comment.