未验证 提交 997c011f 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #15651 from Mugen87/dev27

Audio: Fix usage of detune
...@@ -95,10 +95,8 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { ...@@ -95,10 +95,8 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
var source = this.context.createBufferSource(); var source = this.context.createBufferSource();
source.buffer = this.buffer; source.buffer = this.buffer;
this.setDetune( this.detune );
source.loop = this.loop; source.loop = this.loop;
source.onended = this.onEnded.bind( this ); source.onended = this.onEnded.bind( this );
source.playbackRate.setValueAtTime( this.playbackRate, this.startTime );
this.startTime = this.context.currentTime; this.startTime = this.context.currentTime;
source.start( this.startTime, this.offset ); source.start( this.startTime, this.offset );
...@@ -106,6 +104,9 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { ...@@ -106,6 +104,9 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
this.source = source; this.source = source;
this.setDetune( this.detune );
this.setPlaybackRate( this.playbackRate );
return this.connect(); return this.connect();
}, },
...@@ -228,12 +229,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { ...@@ -228,12 +229,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
this.detune = value; this.detune = value;
if ( this.source.detune === undefined ) { if ( this.source.detune === undefined ) return; // only set detune when available
console.warn( 'THREE.Audio: AudioBufferSourceNode.detune not supported by the browser.' );
return;
}
if ( this.isPlaying === true ) { if ( this.isPlaying === true ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册