Permalink
Browse files

Updates to SoundJS. This is a 0.2.0 candidate for tagging.

Updates and fixes to library
Updated (and new) examples
Updated docs and libs
Updated build scripts

Signed-off-by: Lanny McNie <lanny@gskinner.com>
  • Loading branch information...
1 parent ab809d1 commit 2441d97920941895dd9081317e5f24a017f72cc7 @lannymcnie lannymcnie committed Apr 13, 2012
View
@@ -1,6 +1,6 @@
SOUNDJS LIBRARY:
-SoundJS is a library to make working with the audio on the web easier. It provides a consistent API for playing audio in different browsers, including using a target plugin model to provide an easy way to provide additional audio plugins like Web Audio, and a Flash fallback. A mechanism has been provided for easily tying in audio preloading to PreloadJS (http://preloadjs.com)
+SoundJS is a library to make working with audio on the web easier. It provides a consistent API for playing audio in different browsers, including using a target plugin model to provide an easy way to provide additional audio plugins like Web Audio, and a Flash fallback. A mechanism has been provided for easily tying in audio preloading to PreloadJS (http://preloadjs.com)
The home page for SoundJS can be found at http://soundjs.com/
View
@@ -2,26 +2,10 @@
* SoundJS
* Visit http://createjs.com/ for documentation, updates and examples.
*
-* Copyright (c) 2012 Grant Skinner
+* Copyright (c) 2011 gskinner.com, inc.
*
-* Permission is hereby granted, free of charge, to any person
-* obtaining a copy of this software and associated documentation
-* files (the "Software"), to deal in the Software without
-* restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following
-* conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
+* Distributed under the terms of the MIT license.
+* http://www.opensource.org/licenses/mit-license.html
+*
+* This notice shall be included in all copies or substantial portions of the Software.
**/
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
Binary file not shown.
View
@@ -62,18 +62,18 @@
var preload;
function init() {
- if (window.top == window) { start(); }
- }
-
- function start() {
- // set references
- /*document.getElementById("canvasWrapper").onselectstart=function(){return false};
- document.getElementById("canvasWrapper").onmousedown=function(){return false};*/
+ if (window.top != window) {
+ document.getElementById("header").style.display = "none";
+ }
- // begin loading content (only sounds to load)
- SoundJS.FlashPlugin.BASE_PATH = "../../src/soundjs/";
- SoundJS.registerPlugins([SoundJS.HTMLAudioPlugin]);
+ SoundJS.FlashPlugin.BASE_PATH = "assets/";
+ if (!SoundJS.checkPlugin(true)) {
+ document.getElementById("error").style.display = "block";
+ document.getElementById("content").style.display = "none";
+ return;
+ }
+ // begin loading content (only sounds to load)
var manifest = [
{id:"begin", src:"assets/Game-Spawn.mp3|../../assets/Game-Spawn.ogg"},
{id:"break", src:"assets/Game-Break.mp3|../../assets/Game-Break.ogg", data:6},
@@ -88,15 +88,8 @@
preload.onComplete = doneLoading;
preload.installPlugin(SoundJS);
preload.loadManifest(manifest);
- /*
- for (var i=0, l=manifest.length; i<l; i++) {
- var item = manifest[i];
- var details = SoundJS.initLoad(item.src, "sound", item.id, item.data);
- details.src;
- }
- setTimeout(doneLoading, 3000);//LM: All local for now.*/
- canvas = document.getElementById("testCanvas");
+ canvas = document.getElementById("gameCanvas");
stage = new Stage(canvas);
messageField = new Text("Loading", "bold 24px Arial", "#FFFFFF");
messageField.maxWidth = 1000;
@@ -118,16 +111,13 @@
var states = "/-\|";
var index = states.indexOf(messageField.text.charAt(8));
var newIndex = (index == -1 || index == states.length-1) ? 0 : index+1;
- messageField.text = "Loading " + preload.progress + "% " + states.charAt(newIndex);
+ messageField.text = "Loading " + (preload.progress*100|0) + "% " + states.charAt(newIndex);
stage.update();
}
function doneLoading() {
clearInterval(loadingInterval);
-
- //associate the canvas with the stage
-
scoreField = new Text("0", "bold 12px Arial", "#FFFFFF");
scoreField.textAlign = "right";
scoreField.x = canvas.width - 10;
@@ -434,13 +424,13 @@
//cross browser issues exist
if(!e){ var e = window.event; }
switch(e.keyCode) {
- case KEYCODE_SPACE: shootHeld = false; return false;
+ case KEYCODE_SPACE: shootHeld = false; break;
case KEYCODE_A:
- case KEYCODE_LEFT: lfHeld = false; return false;
+ case KEYCODE_LEFT: lfHeld = false; break;
case KEYCODE_D:
- case KEYCODE_RIGHT: rtHeld = false; return false;
+ case KEYCODE_RIGHT: rtHeld = false; break;
case KEYCODE_W:
- case KEYCODE_UP: fwdHeld = false; return false;
+ case KEYCODE_UP: fwdHeld = false; break;
}
}
@@ -452,18 +442,34 @@
</script>
<link rel="stylesheet" type="text/css" href="assets/demoStyles.css" />
-<style type="text/css">
- BODY {
- user-select: none;
- }
-</style>
+ <style type="text/css">
+ #content {
+ user-select: none;
+ background-color:#000000;
+ width: 960px;
+ height: 400px;
+ }
+ </style>
</head>
<body onload="init();">
- <!--<p>Example use of SoundJS for a game, game example taken from <a href="http://www.createjs.com/#!EaselJS">EaselJS</a> a canvas management tool.
- Music Copyright &copy; 2010 <a href="http://machinaesupremacy.com">Machinae Supremacy</a> - Lord Krutors Dominion. Used with permission for non commercial use.</p> -->
- <div id="canvasWrapper" class="canvasHolder" style="background-color:#000000; width:960px; height:400px;">
- <canvas id="testCanvas" width="960" height="400px"></canvas>
+
+ <header id="header" class="SoundJS">
+ <h1><span class="text-product">Sound<strong>JS</strong></span> Space Rocks Game</h1>
+ <p>Example use of SoundJS for a game, built <a href="http://www.easeljs.com" target="_blank">EaselJS</a> a canvas management tool.
+ Music Copyright &copy; 2010 <a href="http://machinaesupremacy.com" target="_blank">Machinae Supremacy</a> - Lord Krutors Dominion. Used with permission for non commercial use.</p>
+ </header>
+
+ <div id="content">
+ <canvas id="gameCanvas" width="960" height="400"></canvas>
</div>
+
+ <div id="error">
+ <h1>Sorry!</h1>
+ <p>SoundJS is not currently supported in your browser.</p>
+ <p>We are currently working on support for iOS. Please <a href="http://github.com/CreateJS/SoundJS/issues" target="_blank">log a bug</a>
+ if you see this in any other browsers.</p>
+ </div>
+
</body>
</html>
Oops, something went wrong.

0 comments on commit 2441d97

Please sign in to comment.