Skip to content

Commit 2a576bd

Browse files
Merge pull request phaserjs#3125 from orblazer/master
Fix deprecated WebAudio value change on FX
2 parents 3b6f3ef + 09afe0b commit 2a576bd

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

  • v3/src/sound/dynamic

v3/src/sound/dynamic/FX.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ var FX = new Class({
6060

6161
// Set the values
6262

63-
this.volume.gain.value = this.volumeValue;
64-
63+
this.volume.gain.setTargetAtTime(this.volumeValue, 0, 0.01);
64+
6565
if (!ctx.createStereoPanner)
6666
{
6767
this.pan.setPosition(this.panValue, 0, 1 - Math.abs(this.panValue));
6868
}
6969
else
7070
{
71-
this.pan.pan.value = this.panValue;
71+
this.pan.pan.setTargetAtTime(this.panValue, 0, 0.01);
7272
}
7373

7474
// Create an oscillator, gain and pan nodes, and connect them together to the destination
@@ -84,14 +84,14 @@ var FX = new Class({
8484

8585
if (this.randomValue > 0)
8686
{
87-
oscillator.frequency.value = Between(
87+
oscillator.frequency.setTargetAtTime(Between(
8888
this.frequencyValue - this.randomValue / 2,
8989
this.frequencyValue + this.randomValue / 2
90-
);
90+
), 0, 0.01);
9191
}
9292
else
9393
{
94-
oscillator.frequency.value = this.frequencyValue;
94+
oscillator.frequency.setTargetAtTime(this.frequencyValue, 0, 0.01);
9595
}
9696

9797
// Apply effects
@@ -149,7 +149,7 @@ var FX = new Class({
149149

150150
fadeIn: function (volume)
151151
{
152-
volume.gain.value = 0;
152+
volume.gain.setTargetAtTime(0, this.audioContext.currentTime, 0.01);
153153

154154
volume.gain.linearRampToValueAtTime(0, this.audioContext.currentTime + this.wait);
155155

@@ -182,12 +182,12 @@ var FX = new Class({
182182

183183
// Set the node values
184184

185-
feedback.gain.value = this.echoFeedback;
186-
delay.delayTime.value = this.echoDelay;
185+
feedback.gain.setTargetAtTime(this.echoFeedback, 0, 0.01);
186+
delay.delayTime.setTargetAtTime(this.echoDelay, 0, 0.01);
187187

188188
if (this.echoFilter)
189189
{
190-
filter.frequency.value = this.echoFilter;
190+
filter.frequency.setTargetAtTime(this.echoFilter, 0, 0.01);
191191
}
192192

193193
// Create the delay feedback loop (with optional filtering)
@@ -245,8 +245,8 @@ var FX = new Class({
245245
var d2Volume = ctx.createGain();
246246

247247
// Set the volume to the `volumeValue`
248-
d1Volume.gain.value = this.volumeValue;
249-
d2Volume.gain.value = this.volumeValue;
248+
d1Volume.gain.setTargetAtTime(this.volumeValue, 0, 0.01);
249+
d2Volume.gain.setTargetAtTime(this.volumeValue, 0, 0.01);
250250

251251
// Connect the oscillators to the gain and destination nodes
252252
d1.connect(d1Volume);
@@ -261,8 +261,8 @@ var FX = new Class({
261261

262262
// Make the two oscillators play at frequencies above and below the main sound's frequency.
263263
// Use whatever value was supplied by the `dissonance` argument
264-
d1.frequency.value = this.frequencyValue + this.dissonance;
265-
d2.frequency.value = this.frequencyValue - this.dissonance;
264+
d1.frequency.setTargetAtTime(this.frequencyValue + this.dissonance, 0, 0.01);
265+
d2.frequency.setTargetAtTime(this.frequencyValue - this.dissonance, 0, 0.01);
266266

267267
// Fade in / out, pitch bend and play the oscillators to match the main sound
268268
if (this.attack > 0)

0 commit comments

Comments
 (0)