Skip to content

Commit

Permalink
Upated readme and dist for loops in naomiaro#15
Browse files Browse the repository at this point in the history
  • Loading branch information
Willena committed Oct 2, 2016
1 parent be778b2 commit e59cd10
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ An example of using the event emitter to control the playlist can be found in [/
| `select` | `start, end, track:optional` | Seek to the start time or start/end selection optionally with active track `track`. |
| `startaudiorendering` | (`wav | buffer`) | Request for a downloadable file or web Audio buffer that represent the current work |
| `speedchange` | `speed` | Change de playback speed. Minimum is 0.5x and maximum is 4x |
| `loopnumber` | `number` | -1 : infinite loop. `number` > 1 : perform `number` loops. 0 : disable loops |

#### Events to Listen to

Expand All @@ -283,6 +284,7 @@ An example of using the event emitter to control the playlist can be found in [/
| `finished` | _none_ | Event fired when cursor ( while playing ) reaches the end (maximum duration) |
| `audiorenderingfinished` | `type, data` | Return the result of the rendering in the desired format. `type` can be `buffer` or `wav` and can be used to dertermine the `data` type. When `type` is `wav`, data is a `blob` object that represent the wav file. |
| `speedchanged` | `speed` | When speed is changed, return the value applied to tracks. |
| `newloop` | `remaining` |Event fired when one loop finish, and give the number of remaining loops to come |

## Tests

Expand Down
7 changes: 7 additions & 0 deletions ghpages/_examples/99webaudioeditor.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@
<span class="btn btn-primary btn-seektotime">Seek !</span>
</div>
</form>
<form class="form-inline">
<div class="control-group">
<label for="loopValue">Loop</label>
<input type="number" class="form-control" value="3" id="loopValue"/>
<span class="btn btn-primary set-loop-number">Set loop</span>
</div>
</form>
<div class="sound-status"></div>
<div class="track-drop"></div>
<div class="loading-data"></div>
Expand Down
9 changes: 9 additions & 0 deletions ghpages/js/emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ $container.on("input change", ".speed-slider", function (node) {
displaySoundStatus("Playback speed is now " + node.target.value + "x !");
});

$container.on('click', ".set-loop-number", function () {
ee.emit("loopnumber", document.getElementById("loopValue").value);
});

$container.on("click", ".btn-speed-change", function () {
var value = document.getElementById('speedValue').value;
ee.emit("speedchange", value);
Expand Down Expand Up @@ -349,3 +353,8 @@ ee.on('speedchanged', function (speed) {
document.querySelector(".speed-slider").value = speed;
displaySoundStatus("Received speed : " + speed + "x ");
});

ee.on('newloop', function (number) {
//document.getElementById("loopValue").value = number;
displaySoundStatus(number + " remaining loop ...");
});

0 comments on commit e59cd10

Please sign in to comment.