|
@@ -2,9 +2,7 @@
|
|
|
* @author Reece Aaron Lecrivain / http://reecenotes.com/
|
|
|
*/
|
|
|
|
|
|
-THREE.AudioLoader = function ( context, manager ) {
|
|
|
-
|
|
|
- this.context = ( context !== undefined ) ? context : new ( window.AudioContext || window.webkitAudioContext )();
|
|
|
+THREE.AudioLoader = function ( manager ) {
|
|
|
|
|
|
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
|
|
|
|
|
@@ -16,13 +14,13 @@ THREE.AudioLoader.prototype = {
|
|
|
|
|
|
load: function ( url, onLoad, onProgress, onError ) {
|
|
|
|
|
|
- var scope = this;
|
|
|
-
|
|
|
var loader = new THREE.XHRLoader( this.manager );
|
|
|
loader.setResponseType( 'arraybuffer' );
|
|
|
loader.load( url, function ( buffer ) {
|
|
|
|
|
|
- scope.context.decodeAudioData( buffer, function ( audioBuffer ) {
|
|
|
+ var context = THREE.AudioContext;
|
|
|
+
|
|
|
+ context.decodeAudioData( buffer, function ( audioBuffer ) {
|
|
|
|
|
|
onLoad( audioBuffer );
|
|
|
|