diff --git a/src/audio/Audio.js b/src/audio/Audio.js index 193e8b1ef3f44b..69f22005bee304 100644 --- a/src/audio/Audio.js +++ b/src/audio/Audio.js @@ -396,6 +396,44 @@ class Audio extends Object3D { } + copy( source, recursive ) { + + super.copy( source, recursive ); + + this.autoplay = source.autoplay; + + this.buffer = source.buffer; + this.detune = source.detune; + this.loop = source.loop; + this.loopStart = source.loopStart; + this.loopEnd = source.loopEnd; + this.offset = source.offset; + this.duration = source.duration; + this.playbackRate = source.playbackRate; + this.hasPlaybackControl = source.hasPlaybackControl; + + this.filters = source.filters.slice(); + + if ( source.sourceType !== 'buffer' ) { + + console.warn( 'THREE.Audio: Audio source type cannot be copied.' ); + + return this; + + } + + this.sourceType = source.sourceType; + + return this; + + } + + clone( recursive ) { + + return new this.constructor( this.listener ).copy( this, recursive ); + + } + } export { Audio };