Bläddra i källkod

Audio: Use .setTargetAtTime() instead of setter.

Mugen87 7 år sedan
förälder
incheckning
e54084be1e
3 ändrade filer med 3 tillägg och 3 borttagningar
  1. 1 1
      examples/webaudio_sandbox.html
  2. 1 1
      src/audio/Audio.js
  3. 1 1
      src/audio/AudioListener.js

+ 1 - 1
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 );

+ 1 - 1
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;
 

+ 1 - 1
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 );
 
 	},