dist/howler.js
function() {
      var self = this;
      var limit = self._pool;
      var cnt = 0;
      var i = 0;

      // If there are less sounds than the max pool size, we are done.
      if (self._sounds.length < limit) {
        return;
      }

      // Count the number of inactive sounds.
      for (i=0; i<self._sounds.length; i++) {
        if (self._sounds[i]._ended) {
          cnt++;
        }
      }

      // Remove excess inactive sounds, going in reverse order.
      for (i=self._sounds.length - 1; i>=0; i--) {
        if (cnt <= limit) {
          return;
        }

        if (self._sounds[i]._ended) {
          // Disconnect the audio source when using Web Audio.
          if (self._webAudio && self._sounds[i]._node) {
            self._sounds[i]._node.disconnect(0);
          }

          // Remove sounds until we have the pool size.
          self._sounds.splice(i, 1);
          cnt--;
        }
      }
    }
function() {
      var self = this;
      var limit = self._pool;
      var cnt = 0;
      var i = 0;

      // If there are less sounds than the max pool size, we are done.
      if (self._sounds.length < limit) {
        return;
      }

      // Count the number of inactive sounds.
      for (i=0; i<self._sounds.length; i++) {
        if (self._sounds[i]._ended) {
          cnt++;
        }
      }

      // Remove excess inactive sounds, going in reverse order.
      for (i=self._sounds.length - 1; i>=0; i--) {
        if (cnt <= limit) {
          return;
        }

        if (self._sounds[i]._ended) {
          // Disconnect the audio source when using Web Audio.
          if (self._webAudio && self._sounds[i]._node) {
            self._sounds[i]._node.disconnect(0);
          }

          // Remove sounds until we have the pool size.
          self._sounds.splice(i, 1);
          cnt--;
        }
      }
    }
function ( ) { var self = this ; var limit = self . _pool ; var cnt = 0 ; var i = 0 ; // If there are less sounds than the max pool size, we are done. if ( self . _sounds . length < limit ) { return ; } // Count the number of inactive sounds. for ( i = 0 ; i < self . _sounds . length ; i ++ ) { if ( self . _sounds [ i ] . _ended ) { cnt ++ ; } } // Remove excess inactive sounds, going in reverse order. for ( i = self . _sounds . length - 1 ; i >= 0 ; i -- ) { if ( cnt <= limit ) { return ; } if ( self . _sounds [ i ] . _ended ) { // Disconnect the audio source when using Web Audio. if ( self . _webAudio && self . _sounds [ i ] . _node ) { self . _sounds [ i ] . _node . disconnect ( 0 ) ; } // Remove sounds until we have the pool size. self . _sounds . splice ( i , 1 ) ; cnt -- ; } } }
Drain excess inactive sounds from the pool.
Drain excess inactive sounds from the pool .