提交 e54084be 编写于 作者: M Mugen87

Audio: Use .setTargetAtTime() instead of setter.

上级 46cf3f98
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
var sound3 = new THREE.PositionalAudio( listener ); var sound3 = new THREE.PositionalAudio( listener );
var oscillator = listener.context.createOscillator(); var oscillator = listener.context.createOscillator();
oscillator.type = 'sine'; oscillator.type = 'sine';
oscillator.frequency.value = 144; oscillator.frequency.setTargetAtTime( 144, sound3.context.currentTime, 0.01 );
oscillator.start(0); oscillator.start(0);
sound3.setNodeSource(oscillator); sound3.setNodeSource(oscillator);
sound3.setRefDistance( 20 ); sound3.setRefDistance( 20 );
......
...@@ -295,7 +295,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { ...@@ -295,7 +295,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
setVolume: function ( value ) { setVolume: function ( value ) {
this.gain.gain.value = value; this.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );
return this; return this;
......
...@@ -78,7 +78,7 @@ AudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), { ...@@ -78,7 +78,7 @@ AudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), {
setMasterVolume: function ( value ) { setMasterVolume: function ( value ) {
this.gain.gain.value = value; this.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册