diff --git a/build/three.js b/build/three.js index 7d16759caddf16036c7492f2bd27be980bba29e6..a154040942dcb137b707f68d865e0e1d0e0896d6 100644 --- a/build/three.js +++ b/build/three.js @@ -16377,6 +16377,36 @@ THREE.Audio.prototype.getVolume = function () { }; +// File:src/audio/AudioAnalyser.js + +/** + * @author mrdoob / http://mrdoob.com/ + */ + +THREE.AudioAnalyser = function ( audio, fftSize ) { + + this.analyser = audio.context.createAnalyser(); + this.analyser.fftSize = fftSize !== undefined ? fftSize : 2048; + + this.data = new Uint8Array( this.analyser.frequencyBinCount ); + + audio.getOutput().connect( this.analyser ); + +}; + +THREE.AudioAnalyser.prototype = { + + constructor: THREE.AudioAnalyser, + + getData: function () { + + this.analyser.getByteFrequencyData( this.data ); + return this.data; + + } + +}; + // File:src/audio/AudioBuffer.js /** diff --git a/build/three.min.js b/build/three.min.js index 21caf40be711cbab6c902121d55a510942861a4e..8146505d76a8e155f96f9e91609cb43e95a92c3b 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -334,7 +334,8 @@ THREE.Audio.prototype.pause=function(){!1===this.hasPlaybackControl?console.warn THREE.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())};THREE.Audio.prototype.getFilter=function(){return this.filter};THREE.Audio.prototype.setFilter=function(a){void 0===a&&(a=null);!0===this.isPlaying?(this.disconnect(),this.filter=a,this.connect()):this.filter=a}; THREE.Audio.prototype.setPlaybackRate=function(a){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=a,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate))};THREE.Audio.prototype.getPlaybackRate=function(){return this.playbackRate};THREE.Audio.prototype.onEnded=function(){this.isPlaying=!1}; THREE.Audio.prototype.setLoop=function(a){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=a};THREE.Audio.prototype.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop};THREE.Audio.prototype.setVolume=function(a){this.gain.gain.value=a};THREE.Audio.prototype.getVolume=function(){return this.gain.gain.value}; -THREE.AudioBuffer=function(a){this.context=a;this.ready=!1;this.readyCallbacks=[]};THREE.AudioBuffer.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.buffer=a;b.ready=!0;for(a=0;a