dist/melonjs.js
function(id, internal) {
         var self = this;

         // If the sound hasn't loaded, add it to the load queue to stop when capable.
         if (self._state !== 'loaded' || self._playLock) {
           self._queue.push({
             event: 'stop',
             action: function() {
               self.stop(id);
             }
           });

           return self;
         }

         // If no id is passed, get all ID's to be stopped.
         var ids = self._getSoundIds(id);

         for (var i=0; i<ids.length; i++) {
           // Clear the end timer.
           self._clearTimer(ids[i]);

           // Get the sound.
           var sound = self._soundById(ids[i]);

           if (sound) {
             // Reset the seek position.
             sound._seek = sound._start || 0;
             sound._rateSeek = 0;
             sound._paused = true;
             sound._ended = true;

             // Stop currently running fades.
             self._stopFade(ids[i]);

             if (sound._node) {
               if (self._webAudio) {
                 // Make sure the sound's AudioBufferSourceNode has been created.
                 if (sound._node.bufferSource) {
                   if (typeof sound._node.bufferSource.stop === 'undefined') {
                     sound._node.bufferSource.noteOff(0);
                   } else {
                     sound._node.bufferSource.stop(0);
                   }

                   // Clean up the buffer source.
                   self._cleanBuffer(sound._node);
                 }
               } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
                 sound._node.currentTime = sound._start || 0;
                 sound._node.pause();
               }
             }

             if (!internal) {
               self._emit('stop', sound._id);
             }
           }
         }

         return self;
       }
function(id, internal) {
         var self = this;

         // If the sound hasn't loaded, add it to the load queue to stop when capable.
         if (self._state !== 'loaded' || self._playLock) {
           self._queue.push({
             event: 'stop',
             action: function() {
               self.stop(id);
             }
           });

           return self;
         }

         // If no id is passed, get all ID's to be stopped.
         var ids = self._getSoundIds(id);

         for (var i=0; i<ids.length; i++) {
           // Clear the end timer.
           self._clearTimer(ids[i]);

           // Get the sound.
           var sound = self._soundById(ids[i]);

           if (sound) {
             // Reset the seek position.
             sound._seek = sound._start || 0;
             sound._rateSeek = 0;
             sound._paused = true;
             sound._ended = true;

             // Stop currently running fades.
             self._stopFade(ids[i]);

             if (sound._node) {
               if (self._webAudio) {
                 // Make sure the sound's AudioBufferSourceNode has been created.
                 if (sound._node.bufferSource) {
                   if (typeof sound._node.bufferSource.stop === 'undefined') {
                     sound._node.bufferSource.noteOff(0);
                   } else {
                     sound._node.bufferSource.stop(0);
                   }

                   // Clean up the buffer source.
                   self._cleanBuffer(sound._node);
                 }
               } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
                 sound._node.currentTime = sound._start || 0;
                 sound._node.pause();
               }
             }

             if (!internal) {
               self._emit('stop', sound._id);
             }
           }
         }

         return self;
       }
function ( id , internal ) { var self = this ; // If the sound hasn't loaded, add it to the load queue to stop when capable. if ( self . _state !== 'loaded' || self . _playLock ) { self . _queue . push ( { event : 'stop' , action : function ( ) { self . stop ( id ) ; } } ) ; return self ; } // If no id is passed, get all ID's to be stopped. var ids = self . _getSoundIds ( id ) ; for ( var i = 0 ; i < ids . length ; i ++ ) { // Clear the end timer. self . _clearTimer ( ids [ i ] ) ; // Get the sound. var sound = self . _soundById ( ids [ i ] ) ; if ( sound ) { // Reset the seek position. sound . _seek = sound . _start || 0 ; sound . _rateSeek = 0 ; sound . _paused = true ; sound . _ended = true ; // Stop currently running fades. self . _stopFade ( ids [ i ] ) ; if ( sound . _node ) { if ( self . _webAudio ) { // Make sure the sound's AudioBufferSourceNode has been created. if ( sound . _node . bufferSource ) { if ( typeof sound . _node . bufferSource . stop === 'undefined' ) { sound . _node . bufferSource . noteOff ( 0 ) ; } else { sound . _node . bufferSource . stop ( 0 ) ; } // Clean up the buffer source. self . _cleanBuffer ( sound . _node ) ; } } else if ( ! isNaN ( sound . _node . duration ) || sound . _node . duration === Infinity ) { sound . _node . currentTime = sound . _start || 0 ; sound . _node . pause ( ) ; } } if ( ! internal ) { self . _emit ( 'stop' , sound . _id ) ; } } } return self ; }
Stop playback and reset to start.
@param  {Number} id The sound ID (empty to stop all in group).
@param  {Boolean} internal Internal Use: true prevents event firing.
@return {Howl}
Stop playback and reset to start .