function _loadAudioFile(context, fileInfo, done) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', fileInfo.url);
    xhr.responseType = 'arraybuffer';

    xhr.onload = function () {
      if (xhr.status === 200) {
        context.decodeAudioData(xhr.response,
          function (buffer) {
            console.log('[VRAudioPanner] File loaded: ' + fileInfo.url);
            done(fileInfo.name, buffer);
          },
          function (message) {
            console.log('[VRAudioPanner] Decoding failure: ' + fileInfo.url + ' (' + message + ')');
            done(fileInfo.name, null);
          });
      } else {
        console.log('[VRAudioPanner] XHR Error: ' + fileInfo.url + ' (' + xhr.statusText + ')');
        done(fileInfo.name, null);
      }
    };

    xhr.onerror = function (event) {
      console.log('[VRAudioPanner] XHR Network failure: ' + fileInfo.url);
      done(fileInfo.name, null);
    };

    xhr.send();
  }
// Internal helper: load a file into a buffer. (github.com/hoch/spiral)
Internal helper: load a file into a buffer.
Internal helper : load a file into a buffer .
function _loadAudioFile(context, fileInfo, done) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', fileInfo.url);
    xhr.responseType = 'arraybuffer';
    xhr.onload = function () {
      if (xhr.status === 200) {
        context.decodeAudioData(xhr.response,
          function (buffer) {
            console.log('[VRAudioPanner] File loaded: ' + fileInfo.url);
            done(fileInfo.name, buffer);
          },
          function (message) {
            console.log('[VRAudioPanner] Decoding failure: ' + fileInfo.url + ' (' + message + ')');
            done(fileInfo.name, null);
          });
      } else {
        console.log('[VRAudioPanner] XHR Error: ' + fileInfo.url + ' (' + xhr.statusText + ')');
        done(fileInfo.name, null);
      }
    };
    xhr.onerror = function (event) {
      console.log('[VRAudioPanner] XHR Network failure: ' + fileInfo.url);
      done(fileInfo.name, null);
    };
    xhr.send();
  }
function _loadAudioFile ( context , fileInfo , done ) { var xhr = new XMLHttpRequest ( ) ; xhr . open ( 'GET' , fileInfo . url ) ; xhr . responseType = 'arraybuffer' ; xhr . onload = function ( ) { if ( xhr . status === 200 ) { context . decodeAudioData ( xhr . response , function ( buffer ) { console . log ( '[VRAudioPanner] File loaded: ' + fileInfo . url ) ; done ( fileInfo . name , buffer ) ; } , function ( message ) { console . log ( '[VRAudioPanner] Decoding failure: ' + fileInfo . url + ' (' + message + ')' ) ; done ( fileInfo . name , null ) ; } ) ; } else { console . log ( '[VRAudioPanner] XHR Error: ' + fileInfo . url + ' (' + xhr . statusText + ')' ) ; done ( fileInfo . name , null ) ; } } ; xhr . onerror = function ( event ) { console . log ( '[VRAudioPanner] XHR Network failure: ' + fileInfo . url ) ; done ( fileInfo . name , null ) ; } ; xhr . send ( ) ; }
Internal helper: load a file into a buffer.
Internal helper : load a file into a buffer .