diff --git a/examples/webaudio_sandbox.html b/examples/webaudio_sandbox.html index 109bd6c414cb2e97c35262c05567d5a08a0f44bb..c18e5893e988c938f11bd61a7fc4e8b4d5b48a47 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.setValueAtTime( 144, sound3.context.currentTime ); oscillator.start(0); sound3.setNodeSource(oscillator); sound3.setRefDistance( 20 ); diff --git a/src/audio/Audio.js b/src/audio/Audio.js index 79d0b48a2230b99db1922cb281ed15fdc0b51e8e..e36e4e30986885121c65cb716b12e121402f6da1 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 b6ebeb82743d8b2ea615977d687f6e8f783f5186..a7f4bdcac214e77615e6b4eb8dfeeb81a9d55eb4 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 ); },