Skip to content

Commit 3df675b

Browse files
committed
Add effect properties to AudioEffectMap
1 parent ebe7694 commit 3df675b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Sound.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,14 +736,23 @@ type EffectDescriptor<
736736
? PatchDescriptor<Name, Nodes>
737737
: PatchlessDescriptor<Name>;
738738

739-
export class AudioEffectMap {
739+
type Effects = {
740+
[x in EffectName]: number;
741+
};
742+
743+
export class AudioEffectMap implements Effects {
740744
// This class provides a simple interface for setting and getting audio
741745
// effects stored on an EffectChain, similar to EffectMap (that class being
742746
// for graphic effects). It takes an EffectChain and automatically generates
743747
// properties according to the names of the effect descriptors, acting with
744748
// the EffectChain's API when accessed.
745749
private effectChain: EffectChain;
746750

751+
// TypeScript can't infer these
752+
public pan!: number;
753+
public pitch!: number;
754+
public volume!: number;
755+
747756
public constructor(effectChain: EffectChain) {
748757
this.effectChain = effectChain;
749758

0 commit comments

Comments
 (0)