diff --git a/README.md b/README.md index e49cc041..268902d5 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/ghpages/_examples/99webaudioeditor.html b/ghpages/_examples/99webaudioeditor.html index b35cdd90..5572bbc3 100644 --- a/ghpages/_examples/99webaudioeditor.html +++ b/ghpages/_examples/99webaudioeditor.html @@ -111,6 +111,13 @@ Seek ! +
diff --git a/ghpages/js/emitter.js b/ghpages/js/emitter.js index 27e065ee..04cad4b4 100644 --- a/ghpages/js/emitter.js +++ b/ghpages/js/emitter.js @@ -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); @@ -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 ..."); +});