Skip to content

Commit

Permalink
Merge pull request #10 from ebeigarts/reload
Browse files Browse the repository at this point in the history
Functionality to clear the notes [Fixes #8]
  • Loading branch information
meenie committed Mar 6, 2014
2 parents 1ee2a4d + a2fe542 commit f70e379
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -72,6 +72,11 @@ as it's default rhythm notation.</td>
<td>Stop the music with a slight fade out. If you don't want the fade, pass in false.</td>
</tr>
<tr>
<td><code>destroy()</code></td>
<td>n/a</td>
<td>Stop the music and destroy all the instruments and notes.</td>
</tr>
<tr>
<td><code>play()</code></td>
<td>n/a</td>
<td>Play the music.</td>
Expand Down
13 changes: 12 additions & 1 deletion src/band.js
Expand Up @@ -276,6 +276,8 @@
* @param json
*/
this.load = function(json) {
this.destroy();

if (! json) {
throw new Error('JSON is required for this method to work.');
}
Expand Down Expand Up @@ -352,7 +354,7 @@
};

/**
* Stop playing all music and reset the song
* Stop playing all music and rewind the song
*
* @param fadeOut boolean - should the song fade out?
*/
Expand Down Expand Up @@ -382,6 +384,15 @@
}
};

/**
* Stop playing all music and destroy all instruments and notes
*/
this.destroy = function() {
this.stop(false);
totalDuration = 0;
instruments = [];
}

/**
* Set Master Volume
*/
Expand Down

0 comments on commit f70e379

Please sign in to comment.