dist/howler.js
function() {
      var self = this;
      var parent = self._parent;
      var volume = (Howler._muted || self._muted || self._parent._muted) ? 0 : self._volume;

      if (parent._webAudio) {
        // Create the gain node for controlling volume (the source will connect to this).
        self._node = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain();
        self._node.gain.setValueAtTime(volume, Howler.ctx.currentTime);
        self._node.paused = true;
        self._node.connect(Howler.masterGain);
      } else {
        // Get an unlocked Audio object from the pool.
        self._node = Howler._obtainHtml5Audio();

        // Listen for errors (http://dev.w3.org/html5/spec-author-view/spec.html#mediaerror).
        self._errorFn = self._errorListener.bind(self);
        self._node.addEventListener('error', self._errorFn, false);

        // Listen for 'canplaythrough' event to let us know the sound is ready.
        self._loadFn = self._loadListener.bind(self);
        self._node.addEventListener(Howler._canPlayEvent, self._loadFn, false);

        // Setup the new audio node.
        self._node.src = parent._src;
        self._node.preload = 'auto';
        self._node.volume = volume * Howler.volume();

        // Begin loading the source.
        self._node.load();
      }

      return self;
    }
function() {
      var self = this;
      var parent = self._parent;
      var volume = (Howler._muted || self._muted || self._parent._muted) ? 0 : self._volume;

      if (parent._webAudio) {
        // Create the gain node for controlling volume (the source will connect to this).
        self._node = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain();
        self._node.gain.setValueAtTime(volume, Howler.ctx.currentTime);
        self._node.paused = true;
        self._node.connect(Howler.masterGain);
      } else {
        // Get an unlocked Audio object from the pool.
        self._node = Howler._obtainHtml5Audio();

        // Listen for errors (http://dev.w3.org/html5/spec-author-view/spec.html#mediaerror).
        self._errorFn = self._errorListener.bind(self);
        self._node.addEventListener('error', self._errorFn, false);

        // Listen for 'canplaythrough' event to let us know the sound is ready.
        self._loadFn = self._loadListener.bind(self);
        self._node.addEventListener(Howler._canPlayEvent, self._loadFn, false);

        // Setup the new audio node.
        self._node.src = parent._src;
        self._node.preload = 'auto';
        self._node.volume = volume * Howler.volume();

        // Begin loading the source.
        self._node.load();
      }

      return self;
    }
function ( ) { var self = this ; var parent = self . _parent ; var volume = ( Howler . _muted || self . _muted || self . _parent . _muted ) ? 0 : self . _volume ; if ( parent . _webAudio ) { // Create the gain node for controlling volume (the source will connect to this). self . _node = ( typeof Howler . ctx . createGain === 'undefined' ) ? Howler . ctx . createGainNode ( ) : Howler . ctx . createGain ( ) ; self . _node . gain . setValueAtTime ( volume , Howler . ctx . currentTime ) ; self . _node . paused = true ; self . _node . connect ( Howler . masterGain ) ; } else { // Get an unlocked Audio object from the pool. self . _node = Howler . _obtainHtml5Audio ( ) ; // Listen for errors (http://dev.w3.org/html5/spec-author-view/spec.html#mediaerror). self . _errorFn = self . _errorListener . bind ( self ) ; self . _node . addEventListener ( 'error' , self . _errorFn , false ) ; // Listen for 'canplaythrough' event to let us know the sound is ready. self . _loadFn = self . _loadListener . bind ( self ) ; self . _node . addEventListener ( Howler . _canPlayEvent , self . _loadFn , false ) ; // Setup the new audio node. self . _node . src = parent . _src ; self . _node . preload = 'auto' ; self . _node . volume = volume * Howler . volume ( ) ; // Begin loading the source. self . _node . load ( ) ; } return self ; }
Create and setup a new sound object, whether HTML5 Audio or Web Audio.
@return {Sound}
Create and setup a new sound object whether HTML5 Audio or Web Audio .