@blibliki/engine 0.3.7 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,7 +108,7 @@ export class MonoOscillator
108
108
  {
109
109
  declare audioNode: OscillatorNode;
110
110
  isStated = false;
111
- lowOutputGain: GainNode;
111
+ outputGain: GainNode;
112
112
  detuneGain!: GainNode;
113
113
 
114
114
  constructor(engineId: string, params: ICreateModule<ModuleType.Oscillator>) {
@@ -122,7 +122,7 @@ export class MonoOscillator
122
122
  audioNodeConstructor,
123
123
  });
124
124
 
125
- this.lowOutputGain = new GainNode(this.context.audioContext, {
125
+ this.outputGain = new GainNode(this.context.audioContext, {
126
126
  gain: dbToGain(LOW_GAIN),
127
127
  });
128
128
 
@@ -152,8 +152,8 @@ export class MonoOscillator
152
152
  this.updateFrequency();
153
153
  };
154
154
 
155
- onAfterSetLowGain: OscillatorSetterHooks["onAfterSetLowGain"] = () => {
156
- this.rePlugAll();
155
+ onAfterSetLowGain: OscillatorSetterHooks["onAfterSetLowGain"] = (lowGain) => {
156
+ this.outputGain.gain.value = lowGain ? dbToGain(LOW_GAIN) : 1;
157
157
  };
158
158
 
159
159
  start(time: ContextTime) {
@@ -218,7 +218,7 @@ export class MonoOscillator
218
218
  }
219
219
 
220
220
  private applyOutputGain() {
221
- this.audioNode.connect(this.lowOutputGain);
221
+ this.audioNode.connect(this.outputGain);
222
222
  }
223
223
 
224
224
  private initializeGainDetune() {
@@ -236,8 +236,7 @@ export class MonoOscillator
236
236
  private registerOutputs() {
237
237
  this.registerAudioOutput({
238
238
  name: "out",
239
- getAudioNode: () =>
240
- this.props.lowGain ? this.lowOutputGain : this.audioNode,
239
+ getAudioNode: () => this.outputGain,
241
240
  });
242
241
  }
243
242
  }