From e54084be1e55728b5d6c72e19b1b2540e96a50ab Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 31 Mar 2018 15:54:44 +0200 Subject: [PATCH] Audio: Use .setTargetAtTime() instead of setter. --- examples/webaudio_sandbox.html | 2 +- src/audio/Audio.js | 2 +- src/audio/AudioListener.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/webaudio_sandbox.html b/examples/webaudio_sandbox.html index 109bd6c414..ef0642a444 100644 --- a/examples/webaudio_sandbox.html +++ b/examples/webaudio_sandbox.html @@ -130,7 +130,7 @@ var sound3 = new THREE.PositionalAudio( listener ); var oscillator = listener.context.createOscillator(); oscillator.type = 'sine'; - oscillator.frequency.value = 144; + oscillator.frequency.setTargetAtTime( 144, sound3.context.currentTime, 0.01 ); oscillator.start(0); sound3.setNodeSource(oscillator); sound3.setRefDistance( 20 ); diff --git a/src/audio/Audio.js b/src/audio/Audio.js index 79d0b48a22..e36e4e3098 100644 --- a/src/audio/Audio.js +++ b/src/audio/Audio.js @@ -295,7 +295,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { setVolume: function ( value ) { - this.gain.gain.value = value; + this.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 ); return this; diff --git a/src/audio/AudioListener.js b/src/audio/AudioListener.js index b6ebeb8274..a7f4bdcac2 100644 --- a/src/audio/AudioListener.js +++ b/src/audio/AudioListener.js @@ -78,7 +78,7 @@ AudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), { setMasterVolume: function ( value ) { - this.gain.gain.value = value; + this.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 ); }, -- GitLab