Permalink
Browse files

damn that's a deep hole

  • Loading branch information...
1 parent dde1929 commit a0a15fb32f82cb2fc749dbab92fd072eced2383f @matthackedit committed Apr 16, 2012
Showing with 17 additions and 16 deletions.
  1. +7 −5 audia.js
  2. +6 −0 example/example.js
  3. +4 −11 example/index.html
View
@@ -287,9 +287,7 @@ var Audia = (function () {
if (this._paused) {
refreshBufferSource(this);
} else {
- this.pause();
- refreshBufferSource(this);
- this.play();
+ this.bufferSource.loop = value;
}
}
});
@@ -395,8 +393,12 @@ var Audia = (function () {
if (!object.paused) {
if (object.currentTime >= object.duration) {
object.dispatchEvent("ended"/*, TODO*/);
- object._startTime = audioContext.currentTime;
- if (!object.loop) {
+
+ if (object.loop) {
+ console.log('yes loop');
+ object._startTime = audioContext.currentTime;
+ } else {
+ console.log('no loop');
object._paused = true;
}
}
View
@@ -120,6 +120,12 @@
shopMusic.stop();
}, false);
+ // Loop
+ var loopShop = document.getElementById("loop-shop");
+ loopShop.addEventListener("click", function () {
+ shopMusic.loop = loopShop.checked;
+ }, false);
+
// Current time
var currentTimeShop = document.getElementById("current-time-shop");
setInterval(function () {
View
@@ -23,29 +23,22 @@
</label>
</p>
-
-
-
-
-
-
-
-
-
-
<hr>
<h2>Win song from <a href="http://www.lostdecadegames.com/onslaught_arena/">Onslaught!</a></h2>
<p>
<button id="play-shop">Play</button>
<button id="pause-shop">Pause</button>
<button id="stop-shop">Stop</button>
+ <label>
+ <input checked id="loop-shop" type="checkbox"> Loop
+ </label>
</p>
<p>
Current time: <span id="current-time-shop">0</span>
</p>
<p>
- <input id="current-time-value-shop" type="text" value="24.6">
+ <input id="current-time-value-shop" type="text" value="4.5">
<button id="set-current-time-shop">Set</button>
</p>
<p>

0 comments on commit a0a15fb

Please sign in to comment.