├── tests ├── lib │ └── jasmine-2.0.2 │ │ ├── boot.js │ │ ├── MIT.LICENSE │ │ ├── console.js │ │ ├── jasmine.css │ │ ├── jasmine.js │ │ ├── jasmine-html.js │ │ └── jasmine_favicon.png ├── README.md ├── package.json ├── spec │ ├── Helpers.js │ └── SoundSpec.js ├── Gruntfile.js └── tasks │ ├── listips.js │ └── findopenport.js ├── icon.png ├── _assets ├── css │ ├── soundjs.css │ ├── loader.gif │ ├── images │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_4b8e0b_256x240.png │ │ ├── ui-icons_a83300_256x240.png │ │ ├── ui-icons_cccccc_256x240.png │ │ ├── ui-icons_ffffff_256x240.png │ │ ├── ui-bg_flat_30_cccccc_40x100.png │ │ ├── ui-bg_flat_50_5c5c5c_40x100.png │ │ ├── ui-bg_glass_40_ffc73d_1x400.png │ │ ├── ui-bg_loop_25_000000_21x21.png │ │ ├── ui-bg_highlight-hard_20_0972a5_1x100.png │ │ ├── ui-bg_highlight-soft_33_003147_1x100.png │ │ ├── ui-bg_highlight-soft_35_222222_1x100.png │ │ ├── ui-bg_highlight-soft_44_444444_1x100.png │ │ └── ui-bg_highlight-soft_80_eeeeee_1x100.png │ ├── examples.css │ └── shared.css ├── art │ ├── loading.gif │ ├── sparkle_21x23.png │ ├── audioButtonSheet.png │ └── logo_createjs.svg ├── audio │ ├── Humm.mp3 │ ├── Humm.ogg │ ├── Game-Break.mp3 │ ├── Game-Break.ogg │ ├── Game-Death.mp3 │ ├── Game-Death.ogg │ ├── Game-Shot.mp3 │ ├── Game-Shot.ogg │ ├── Game-Spawn.mp3 │ ├── Game-Spawn.ogg │ ├── M-GameBG.mp3 │ ├── M-GameBG.ogg │ ├── R-Damage.mp3 │ ├── R-Damage.ogg │ ├── S-Damage.mp3 │ ├── S-Damage.ogg │ ├── Thunder1.mp3 │ ├── Thunder1.ogg │ ├── ToneWobble.mp3 │ ├── ToneWobble.ogg │ ├── U-CabinBoy3.mp3 │ ├── U-CabinBoy3.ogg │ ├── GU-StealDaisy.mp3 │ ├── GU-StealDaisy.ogg │ ├── Game-AudioSprite.mp3 │ ├── Game-AudioSprite.ogg │ ├── 05-Binrpilot-Underground.mp3 │ └── 05-Binrpilot-Underground.ogg ├── README.md └── js │ └── examples.js ├── docs ├── SoundJS_docs.zip └── soundjs_docs-NEXT.zip ├── examples ├── Game │ ├── sounds │ │ ├── break.mp3 │ │ ├── break.ogg │ │ ├── death.mp3 │ │ ├── death.ogg │ │ ├── music.mp3 │ │ ├── music.ogg │ │ ├── shot.mp3 │ │ ├── shot.ogg │ │ ├── spawn.mp3 │ │ └── spawn.ogg │ ├── Ship.js │ └── SpaceRock.js ├── MediaPlayer │ └── art │ │ ├── player.png │ │ ├── buttonPause.png │ │ ├── buttonPlay.png │ │ ├── buttonStop.png │ │ ├── scubberBar.png │ │ ├── buttonPauseHover.png │ │ ├── buttonPlayHover.png │ │ ├── buttonStopHover.png │ │ └── scrubberPlayhead.png ├── 00_Basics.html ├── 02_PlayOnClick.html └── 01_LoadWithPreloadJS.html ├── src ├── soundjs │ ├── flashaudio │ │ ├── FlashAudioPlugin.swf │ │ └── FlashAudioLoader.js │ ├── version_flashplugin.js │ ├── version_cordovaplugin.js │ ├── version.js │ ├── webaudio │ │ └── WebAudioLoader.js │ ├── data │ │ └── AudioSprite.js │ ├── cordovaaudio │ │ └── CordovaAudioLoader.js │ └── htmlaudio │ │ └── HTMLAudioTagPool.js ├── createjs │ ├── utils │ │ ├── indexOf.js │ │ ├── extend.js │ │ ├── deprecate.js │ │ ├── proxy.js │ │ ├── BrowserDetect.js │ │ └── promote.js │ └── events │ │ └── ErrorEvent.js └── preloadjs │ ├── data │ └── Methods.js │ ├── utils │ ├── Elements.js │ ├── DomUtils.js │ ├── RequestUtils.js │ └── URLUtils.js │ ├── net │ ├── AbstractRequest.js │ ├── MediaTagRequest.js │ └── TagRequest.js │ ├── events │ └── ProgressEvent.js │ └── loaders │ ├── SoundLoader.js │ └── AbstractMediaLoader.js ├── tutorials ├── _shared │ ├── demo.css │ ├── SyntaxHighlighter │ │ ├── MIT-LICENSE │ │ ├── shBrushJScript.js │ │ ├── shBrushXml.js │ │ ├── shThemeDefault.css │ │ ├── shThemeEclipse.css │ │ ├── shThemeCreateJS.css │ │ └── shCore.css │ ├── tutorial.js │ ├── tutorial.css │ └── createjs-logo-horizontal-gray-lightest.svg ├── Basics and Best Practices │ └── sample.html ├── SoundJS and PreloadJS │ ├── internalPreloading.html │ └── preloadjs.html └── Mobile Safe Approach │ └── sample.html ├── .npmignore ├── .gitignore ├── bower.json ├── package.json ├── README_CREATEJS_NAMESPACE.txt ├── LICENSE.txt ├── ISSUE_TEMPLATE.md ├── lib ├── README.md ├── cordovaaudioplugin.min.js └── cordovaaudioplugin-NEXT.min.js └── README.md /tests/lib/jasmine-2.0.2/boot.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lib/jasmine-2.0.2/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lib/jasmine-2.0.2/console.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lib/jasmine-2.0.2/jasmine.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lib/jasmine-2.0.2/jasmine.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lib/jasmine-2.0.2/jasmine-html.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lib/jasmine-2.0.2/jasmine_favicon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/icon.png -------------------------------------------------------------------------------- /_assets/css/soundjs.css: -------------------------------------------------------------------------------- 1 | h1:before { 2 | content:"SOUNDJS "; 3 | } 4 | -------------------------------------------------------------------------------- /_assets/art/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/art/loading.gif -------------------------------------------------------------------------------- /_assets/audio/Humm.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Humm.mp3 -------------------------------------------------------------------------------- /_assets/audio/Humm.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Humm.ogg -------------------------------------------------------------------------------- /_assets/css/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/loader.gif -------------------------------------------------------------------------------- /docs/SoundJS_docs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/docs/SoundJS_docs.zip -------------------------------------------------------------------------------- /_assets/audio/Game-Break.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Game-Break.mp3 -------------------------------------------------------------------------------- /_assets/audio/Game-Break.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Game-Break.ogg -------------------------------------------------------------------------------- /_assets/audio/Game-Death.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Game-Death.mp3 -------------------------------------------------------------------------------- /_assets/audio/Game-Death.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Game-Death.ogg -------------------------------------------------------------------------------- /_assets/audio/Game-Shot.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Game-Shot.mp3 -------------------------------------------------------------------------------- /_assets/audio/Game-Shot.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Game-Shot.ogg -------------------------------------------------------------------------------- /_assets/audio/Game-Spawn.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Game-Spawn.mp3 -------------------------------------------------------------------------------- /_assets/audio/Game-Spawn.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Game-Spawn.ogg -------------------------------------------------------------------------------- /_assets/audio/M-GameBG.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/M-GameBG.mp3 -------------------------------------------------------------------------------- /_assets/audio/M-GameBG.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/M-GameBG.ogg -------------------------------------------------------------------------------- /_assets/audio/R-Damage.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/R-Damage.mp3 -------------------------------------------------------------------------------- /_assets/audio/R-Damage.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/R-Damage.ogg -------------------------------------------------------------------------------- /_assets/audio/S-Damage.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/S-Damage.mp3 -------------------------------------------------------------------------------- /_assets/audio/S-Damage.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/S-Damage.ogg -------------------------------------------------------------------------------- /_assets/audio/Thunder1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Thunder1.mp3 -------------------------------------------------------------------------------- /_assets/audio/Thunder1.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Thunder1.ogg -------------------------------------------------------------------------------- /_assets/audio/ToneWobble.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/ToneWobble.mp3 -------------------------------------------------------------------------------- /_assets/audio/ToneWobble.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/ToneWobble.ogg -------------------------------------------------------------------------------- /docs/soundjs_docs-NEXT.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/docs/soundjs_docs-NEXT.zip -------------------------------------------------------------------------------- /_assets/art/sparkle_21x23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/art/sparkle_21x23.png -------------------------------------------------------------------------------- /_assets/audio/U-CabinBoy3.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/U-CabinBoy3.mp3 -------------------------------------------------------------------------------- /_assets/audio/U-CabinBoy3.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/U-CabinBoy3.ogg -------------------------------------------------------------------------------- /examples/Game/sounds/break.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/Game/sounds/break.mp3 -------------------------------------------------------------------------------- /examples/Game/sounds/break.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/Game/sounds/break.ogg -------------------------------------------------------------------------------- /examples/Game/sounds/death.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/Game/sounds/death.mp3 -------------------------------------------------------------------------------- /examples/Game/sounds/death.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/Game/sounds/death.ogg -------------------------------------------------------------------------------- /examples/Game/sounds/music.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/Game/sounds/music.mp3 -------------------------------------------------------------------------------- /examples/Game/sounds/music.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/Game/sounds/music.ogg -------------------------------------------------------------------------------- /examples/Game/sounds/shot.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/Game/sounds/shot.mp3 -------------------------------------------------------------------------------- /examples/Game/sounds/shot.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/Game/sounds/shot.ogg -------------------------------------------------------------------------------- /examples/Game/sounds/spawn.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/Game/sounds/spawn.mp3 -------------------------------------------------------------------------------- /examples/Game/sounds/spawn.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/Game/sounds/spawn.ogg -------------------------------------------------------------------------------- /_assets/art/audioButtonSheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/art/audioButtonSheet.png -------------------------------------------------------------------------------- /_assets/audio/GU-StealDaisy.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/GU-StealDaisy.mp3 -------------------------------------------------------------------------------- /_assets/audio/GU-StealDaisy.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/GU-StealDaisy.ogg -------------------------------------------------------------------------------- /_assets/audio/Game-AudioSprite.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Game-AudioSprite.mp3 -------------------------------------------------------------------------------- /_assets/audio/Game-AudioSprite.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/Game-AudioSprite.ogg -------------------------------------------------------------------------------- /examples/MediaPlayer/art/player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/MediaPlayer/art/player.png -------------------------------------------------------------------------------- /examples/MediaPlayer/art/buttonPause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/MediaPlayer/art/buttonPause.png -------------------------------------------------------------------------------- /examples/MediaPlayer/art/buttonPlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/MediaPlayer/art/buttonPlay.png -------------------------------------------------------------------------------- /examples/MediaPlayer/art/buttonStop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/MediaPlayer/art/buttonStop.png -------------------------------------------------------------------------------- /examples/MediaPlayer/art/scubberBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/MediaPlayer/art/scubberBar.png -------------------------------------------------------------------------------- /_assets/audio/05-Binrpilot-Underground.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/05-Binrpilot-Underground.mp3 -------------------------------------------------------------------------------- /_assets/audio/05-Binrpilot-Underground.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/audio/05-Binrpilot-Underground.ogg -------------------------------------------------------------------------------- /src/soundjs/flashaudio/FlashAudioPlugin.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/src/soundjs/flashaudio/FlashAudioPlugin.swf -------------------------------------------------------------------------------- /examples/MediaPlayer/art/buttonPauseHover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/MediaPlayer/art/buttonPauseHover.png -------------------------------------------------------------------------------- /examples/MediaPlayer/art/buttonPlayHover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/MediaPlayer/art/buttonPlayHover.png -------------------------------------------------------------------------------- /examples/MediaPlayer/art/buttonStopHover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/MediaPlayer/art/buttonStopHover.png -------------------------------------------------------------------------------- /examples/MediaPlayer/art/scrubberPlayhead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/examples/MediaPlayer/art/scrubberPlayhead.png -------------------------------------------------------------------------------- /_assets/css/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /_assets/css/images/ui-icons_4b8e0b_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-icons_4b8e0b_256x240.png -------------------------------------------------------------------------------- /_assets/css/images/ui-icons_a83300_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-icons_a83300_256x240.png -------------------------------------------------------------------------------- /_assets/css/images/ui-icons_cccccc_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-icons_cccccc_256x240.png -------------------------------------------------------------------------------- /_assets/css/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /_assets/css/images/ui-bg_flat_30_cccccc_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-bg_flat_30_cccccc_40x100.png -------------------------------------------------------------------------------- /_assets/css/images/ui-bg_flat_50_5c5c5c_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-bg_flat_50_5c5c5c_40x100.png -------------------------------------------------------------------------------- /_assets/css/images/ui-bg_glass_40_ffc73d_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-bg_glass_40_ffc73d_1x400.png -------------------------------------------------------------------------------- /_assets/css/images/ui-bg_loop_25_000000_21x21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-bg_loop_25_000000_21x21.png -------------------------------------------------------------------------------- /_assets/README.md: -------------------------------------------------------------------------------- 1 | # _shared folder 2 | 3 | Contains assets that are shared by examples, tutorials, and tests to prevent duplication, and simplify referencing. -------------------------------------------------------------------------------- /_assets/css/images/ui-bg_highlight-hard_20_0972a5_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-bg_highlight-hard_20_0972a5_1x100.png -------------------------------------------------------------------------------- /_assets/css/images/ui-bg_highlight-soft_33_003147_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-bg_highlight-soft_33_003147_1x100.png -------------------------------------------------------------------------------- /_assets/css/images/ui-bg_highlight-soft_35_222222_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-bg_highlight-soft_35_222222_1x100.png -------------------------------------------------------------------------------- /_assets/css/images/ui-bg_highlight-soft_44_444444_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-bg_highlight-soft_44_444444_1x100.png -------------------------------------------------------------------------------- /_assets/css/images/ui-bg_highlight-soft_80_eeeeee_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CreateJS/SoundJS/HEAD/_assets/css/images/ui-bg_highlight-soft_80_eeeeee_1x100.png -------------------------------------------------------------------------------- /tutorials/_shared/demo.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 7px; 4 | background-color: rgba(255,255,255,0); 5 | } 6 | 7 | canvas { 8 | border: solid 1px rgba(0,0,0,0.05); 9 | } -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | _assets 2 | build 3 | bower.json 4 | dev 5 | docs 6 | examples 7 | extras 8 | icon.png 9 | lib/**-NEXT**.js 10 | spikes 11 | src 12 | tests 13 | tutorials 14 | VERSIONS.txt -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | ## Setup and run tests ## 2 | * Run via Grunt 3 | * Install dependencies; npm install; 4 | * Run tests in browser: grunt; 5 | * Run headless: grunt headless; 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build/output/ 3 | build/tmp/ 4 | *TMP* 5 | node_modules/ 6 | spikes/ 7 | .idea/ 8 | *.sublime-project 9 | *.sublime-workspace 10 | config.local.json 11 | docs/**/ 12 | 13 | #----------------------------- 14 | # INVALID FILES 15 | # (for cross OS compatibility) 16 | #----------------------------- 17 | *[\<\>\:\"\/\\\|\?\*]* 18 | **/.sass-cache/ 19 | main.css 20 | *.codekit 21 | tests/.grunt 22 | _SpecRunner.html 23 | -------------------------------------------------------------------------------- /tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SoundJS-UnitTests", 3 | "version": "0.0.1", 4 | "description": "SoundJS unit testing.", 5 | "url": "http://www.createjs.com/#!/SoundJS", 6 | "logo": "assets/docs-icon-SoundJS.png", 7 | "devDependencies": { 8 | "body-parser": "^1.9.2", 9 | "grunt": "~0.4.5", 10 | "grunt-contrib-connect": "^0.9.0", 11 | "grunt-contrib-jasmine": "^0.8.2" 12 | }, 13 | "engine": "node >= 0.10.22" 14 | } 15 | -------------------------------------------------------------------------------- /src/soundjs/version_flashplugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module SoundJS 3 | */ 4 | this.createjs = this.createjs || {}; 5 | 6 | (function () { 7 | 8 | var s = createjs.FlashAudioPlugin = createjs.FlashAudioPlugin || {}; 9 | 10 | /** 11 | * The version string for this release. 12 | * @for FlashAudioPlugin 13 | * @property version 14 | * @type String 15 | * @static 16 | **/ 17 | s.version = /*=version*/""; // injected by build process 18 | 19 | /** 20 | * The build date for this release in UTC format. 21 | * @for FlashAudioPlugin 22 | * @property buildDate 23 | * @type String 24 | * @static 25 | **/ 26 | s.buildDate = /*=date*/""; // injected by build process 27 | 28 | })(); 29 | -------------------------------------------------------------------------------- /src/soundjs/version_cordovaplugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module SoundJS 3 | */ 4 | this.createjs = this.createjs || {}; 5 | 6 | (function () { 7 | 8 | var s = createjs.CordovaAudioPlugin = createjs.CordovaAudioPlugin || {}; 9 | 10 | /** 11 | * The version string for this release. 12 | * @for CordovaAudioPlugin 13 | * @property version 14 | * @type String 15 | * @static 16 | **/ 17 | s.version = /*=version*/""; // injected by build process 18 | 19 | /** 20 | * The build date for this release in UTC format. 21 | * @for CordovaAudioPlugin 22 | * @property buildDate 23 | * @type String 24 | * @static 25 | **/ 26 | s.buildDate = /*=date*/""; // injected by build process 27 | 28 | })(); 29 | -------------------------------------------------------------------------------- /_assets/js/examples.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Very minimal shared code for examples. 3 | */ 4 | 5 | (function() { 6 | if (document.body) { setupEmbed(); } 7 | else { document.addEventListener("DOMContentLoaded", setupEmbed); } 8 | 9 | function setupEmbed() { 10 | if (window.top != window) { 11 | document.body.className += " embedded"; 12 | } 13 | } 14 | 15 | var o = window.examples = {}; 16 | o.showDistractor = function(id) { 17 | var div = id ? document.getElementById(id) : document.querySelector("div canvas").parentNode; 18 | div.className += " loading"; 19 | }; 20 | 21 | o.hideDistractor = function() { 22 | var div = document.querySelector(".loading"); 23 | div.className = div.className.replace(/\bloading\b/); 24 | }; 25 | })(); -------------------------------------------------------------------------------- /tutorials/Basics and Best Practices/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SoundJS", 3 | "version": "1.0.0", 4 | "homepage": "https://github.com/CreateJS/SoundJS", 5 | "authors": [ 6 | "lannymcnie", 7 | "gskinner", 8 | "wdamien" 9 | ], 10 | "description": "A Javascript library for working with Audio. Features a simple interface as the front end to multiple audio APIs via a plugin model. Currently supports WebAudio, HTML5 Audio, and a Flash fallback. Part of the CreateJS suite of libraries.", 11 | "main": "lib/soundjs.js", 12 | "keywords": [ 13 | "sound", 14 | "audio", 15 | "webaudio", 16 | "html5", 17 | "createjs" 18 | ], 19 | "license": "MIT", 20 | "ignore": [ 21 | "**/.*", 22 | "node_modules", 23 | "_assets", 24 | "bower_components", 25 | ".bower.json", 26 | "build", 27 | "dev", 28 | "docs", 29 | "examples", 30 | "icon.png", 31 | "LICENSE.txt", 32 | "README.md", 33 | "src", 34 | "tutorials", 35 | "VERSIONS.txt" 36 | ] 37 | } -------------------------------------------------------------------------------- /src/soundjs/version.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module SoundJS 3 | */ 4 | this.createjs = this.createjs || {}; 5 | 6 | (function () { 7 | 8 | /** 9 | * Static class holding library specific information such as the version and buildDate of the library. 10 | * The SoundJS class has been renamed {{#crossLink "Sound"}}{{/crossLink}}. Please see {{#crossLink "Sound"}}{{/crossLink}} 11 | * for information on using sound. 12 | * @class SoundJS 13 | **/ 14 | var s = createjs.SoundJS = createjs.SoundJS || {}; 15 | 16 | /** 17 | * The version string for this release. 18 | * @property version 19 | * @type String 20 | * @static 21 | **/ 22 | s.version = /*=version*/""; // injected by build process 23 | 24 | /** 25 | * The build date for this release in UTC format. 26 | * @property buildDate 27 | * @type String 28 | * @static 29 | **/ 30 | s.buildDate = /*=date*/""; // injected by build process 31 | 32 | })(); 33 | -------------------------------------------------------------------------------- /_assets/css/examples.css: -------------------------------------------------------------------------------- 1 | body { 2 | width: 960px; 3 | } 4 | 5 | header { 6 | margin-bottom: 1rem; 7 | width: 960px; 8 | } 9 | 10 | h1 { 11 | font-weight: 200; 12 | margin-bottom: 1rem; 13 | } 14 | 15 | h1:before { 16 | content:"EASELJS "; 17 | font-weight: bold; 18 | } 19 | 20 | header p { 21 | margin: 0; 22 | padding: 1em; 23 | background: rgba(250, 252, 255, 0.7); 24 | } 25 | 26 | .content, canvas { 27 | background: white; 28 | } 29 | 30 | .content { 31 | width: 960px; 32 | height: 400px; 33 | overflow: hidden; 34 | padding: 1em; 35 | box-sizing: border-box; 36 | } 37 | 38 | .loading { 39 | position: relative; 40 | } 41 | 42 | .loading:after { 43 | content: url("../art/loading.gif"); 44 | position: absolute; 45 | left: 50%; 46 | top: 50%; 47 | margin: -13px 0 0 -51px; 48 | opacity: 0.8; 49 | } 50 | 51 | #error, #mobile { 52 | width: 960px; 53 | height: 400px; 54 | display:none; 55 | text-align: left; 56 | padding: 1em; 57 | } 58 | 59 | body.embedded header { 60 | display: none; 61 | } 62 | 63 | body.embedded { 64 | margin: 0; 65 | } 66 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "soundjs", 3 | "npmName": "soundjs", 4 | "version": "1.0.2", 5 | "description": "A JavaScript library that provides a simple API, and powerful features to make working with audio a breeze. Easily ties in audio file loading to PreloadJS.", 6 | "main": "lib/soundjs.js", 7 | "jsdelivr": "lib/soundjs.min.js", 8 | "directories": { 9 | "doc": "docs", 10 | "example": "examples", 11 | "lib": "lib", 12 | "test": "tests" 13 | }, 14 | "npmFileMap": [ 15 | { 16 | "basePath": "lib", 17 | "files": [ 18 | "**/*" 19 | ] 20 | } 21 | ], 22 | "repository": { 23 | "type": "git", 24 | "url": "git+https://github.com/CreateJS/SoundJS.git" 25 | }, 26 | "keywords": [ 27 | "createjs", 28 | "soundjs", 29 | "gskinner", 30 | "javascript", 31 | "audio", 32 | "webaudio", 33 | "html5", 34 | "flash" 35 | ], 36 | "author": "gskinner.com, inc.", 37 | "license": "MIT", 38 | "bugs": { 39 | "url": "https://github.com/CreateJS/SoundJS/issues" 40 | }, 41 | "homepage": "https://createjs.com/soundjs/" 42 | } 43 | -------------------------------------------------------------------------------- /README_CREATEJS_NAMESPACE.txt: -------------------------------------------------------------------------------- 1 | In this version of SoundJS, class definitions reside in a "createjs" namespace by default. 2 | 3 | For example, instead of playing a sound like this: 4 | var foo = SoundJS.play(id); 5 | 6 | You will need to reach into the createjs namespace: 7 | var bar = createjs.SoundJS.play(id); 8 | 9 | This functionality is configurable though. You can easily shortcut the namespace or get rid of it completely. 10 | 11 | To shortcut the namespace, just point a different variable at createjs it is loaded: 12 | 13 | 17 | 18 | To remove the namespace, just point the createjs variable at the window before loading the libraries: 19 | 22 | 23 | 24 | This will also make CreateJS libraries compatible with old content that did not use a namespace, such as the output from the Flash Pro Toolkit for CreateJS v1.0. 25 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 gskinner.com, inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tutorials/_shared/SyntaxHighlighter/MIT-LICENSE: -------------------------------------------------------------------------------- 1 | SyntaxHighlighter is Copyright (c) 2004 Alex Gorbatchev 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /tests/spec/Helpers.js: -------------------------------------------------------------------------------- 1 | beforeEach(function () { 2 | this.baseAssetsPath = "../_assets/"; 3 | 4 | this.getFilePath = function (fileObj) { 5 | if (typeof fileObj == "string") { 6 | return this.baseAssetsPath + fileObj; 7 | } else { 8 | return this.baseAssetsPath + fileObj.src; 9 | } 10 | } 11 | 12 | this.findClass = function (selector) { 13 | // search backwards because the last match is more likely the right one 14 | for (var i = document.styleSheets.length - 1; i >= 0; i--) { 15 | var cssRules = document.styleSheets[i].cssRules || 16 | document.styleSheets[i].rules || []; // IE support 17 | for (var c = 0; c < cssRules.length; c++) { 18 | if (cssRules[c].selectorText === selector) { 19 | return true; 20 | } 21 | } 22 | } 23 | return false; 24 | } 25 | 26 | var customMatchers = { 27 | toBeInRange: function (util, customEqualityTesters) { 28 | return { 29 | compare: function (actual, excpected, range) { 30 | var result = {}; 31 | range = range || 0; 32 | 33 | if (actual <= (excpected + range) && actual >= (excpected - range)) { 34 | result.pass = true; 35 | } else { 36 | result.pass = false; 37 | } 38 | return result; 39 | } 40 | }; 41 | } 42 | }; 43 | 44 | jasmine.addMatchers(customMatchers); 45 | }); 46 | -------------------------------------------------------------------------------- /_assets/css/shared.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 3em auto; 3 | padding: 0; 4 | background-color: #eaebee; 5 | font-family: Arial, Verdana, sans-serif; 6 | font-size: 14px; 7 | font-weight: normal; 8 | color: #333; 9 | line-height: 1.4em; 10 | } 11 | 12 | a:link, a:visited { 13 | color: #39f; 14 | text-decoration: none; 15 | } 16 | 17 | a:hover { 18 | text-decoration: underline; 19 | } 20 | 21 | h1, h2 { 22 | color: #FFF; 23 | font-size: 1.6em; 24 | margin-bottom: 0; 25 | padding: 1.5em; 26 | padding-bottom: 1.2em; 27 | background: #374252; 28 | text-transform: uppercase; 29 | } 30 | 31 | h1::after { 32 | display: block; 33 | content: ""; 34 | background: url('../art/logo_createjs.svg') no-repeat; 35 | height:1.5em; 36 | width: 6em; 37 | margin-top: -0.3em; 38 | float: right; 39 | } 40 | 41 | h1 em { 42 | font-weight: 200; 43 | font-style: normal; 44 | } 45 | 46 | h2 { 47 | font-size: 1.3em; 48 | padding: 1em; 49 | padding-bottom: 0.8em; 50 | } 51 | 52 | h3 { 53 | background: #e0e1e5; 54 | color: #374252; 55 | font-size: 1.25em; 56 | padding: 0.5em; 57 | margin-top: 1.25em; 58 | margin-bottom: -0.5em; 59 | position: relative; 60 | } 61 | 62 | code { 63 | color: black; 64 | background-color: rgba(255, 230, 0, 0.33); 65 | padding: 1px 3px; 66 | font-family: Courier New, Courier, serif; 67 | font-weight: bold; 68 | } -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### TODO 2 | - [ ] Is this a question or bug? [Stack Overflow](https://stackoverflow.com/questions/tagged/createjs) is a much better place to ask any questions you may have. 3 | 4 | - [ ] Did you search the [issues](https://github.com/CreateJS/SoundJS/issues) to see if someone else has already reported your issue? If yes, please add more details if you have any! 5 | 6 | - [ ] If you're using an older [version](https://github.com/CreateJS/SoundJS/blob/master/VERSIONS.txt), have you tried the latest? 7 | 8 | - [ ] If you're requesting a new feature; provide as many details as you can. Why do you want this feature? Do you have ideas for how this feature should be implemented? Pseudocode is always welcome! 9 | 10 | 11 | ### Issue Details 12 | * Version used (Ex; 1.0): 13 | 14 | 15 | * Describe whats happening (Include any relevant console errors, a [Gist](https://gist.github.com/) is preferred for longer errors): 16 | 17 | 18 | 19 | * OS & Browser version *(Please be specific)* (Ex; Windows 10 Home, Chrome 62.0.3202.94): 20 | 21 | 22 | 23 | * Do you know of any workarounds? 24 | 25 | 26 | 27 | * Provide any extra details that will help us fix your issue. Including a link to a [CodePen.io](https://codepen.io) or [JSFiddle.net](https://jsfiddle.net) example that shows the issue in isolation will greatly increase the chance of getting a quick response. 28 | -------------------------------------------------------------------------------- /tutorials/_shared/tutorial.js: -------------------------------------------------------------------------------- 1 | function initTutorial() { 2 | formatCodeAreas(); 3 | injectDemos(); 4 | } 5 | 6 | function formatCodeAreas() { 7 | var tags = document.getElementsByTagName("textarea"); 8 | for (var i=tags.length-1; i>=0; i--) { 9 | var e = tags[i]; 10 | if (!e || e.className.indexOf("brush: ") != 0) { continue; } 11 | var code = e.value.replace(/[&]/g,"&").replace(/=0; i--) { 23 | var e = tags[i]; 24 | if (!e || e.className.indexOf("demo") != 0) { continue; } 25 | var src = e.src; 26 | var div = document.createElement("div"); 27 | div.className = "demo"; 28 | e.parentNode.replaceChild(div, e); 29 | div.appendChild(e); 30 | var p = document.createElement("p"); 31 | var srcLabel = src.split("\\").join("/").split("/").pop(); 32 | var html = "Demo"; 33 | if (e.dataset) { html += ": "+(e.dataset.description||""); } 34 | html += ""+srcLabel+""; 35 | p.innerHTML = html; 36 | div.appendChild(p); 37 | } 38 | } -------------------------------------------------------------------------------- /lib/README.md: -------------------------------------------------------------------------------- 1 | # lib directory 2 | This directory contains compressed versions of the SoundJS library, including the most recent tagged release and the 3 | in-progress NEXT release. 4 | 5 | Both combined and minified versions of the library are included. The former being useful for debugging, and the latter 6 | for deployment. 7 | 8 | You can also link to the libraries on the [CreateJS CDN](http://code.createjs.com/), to benefit from faster load times 9 | and shared caching across sites. 10 | 11 | # libraries 12 | * **soundjs.js** the most recent _tagged_ version of all the SoundJS classes. 13 | * **soundjs.min.js** the most recent tagged version, minified and stripped of comments and whitespace. 14 | * **soundjs-NEXT.js** contains the _latest_ SoundJS classes. 15 | * **soundjs-NEXT.min.js** is a minified version of the _latest updates_ to the library. 16 | 17 | ## plugins 18 | SoundJS plugins are also minified for easy inclusion. 19 | * **flashplugin.js** a plugin to utilize Adobe Flash to playback audio. 20 | * **flashplugin.js** a minified version of the flash plugin, stripped of comments and whitespace. 21 | * **cordovaplugin.js** a plugin to utilize Cordova/PhoneGap APIs to playback audio. 22 | * **cordovaplugin.js** a minified version of the cordova plugin, stripped of comments and whitespace. 23 | 24 | 25 | # license 26 | The libraries are ©20107 gskinner.com, inc., and made available under the highly permissive MIT open source software 27 | license. See the source file header for the full license text. 28 | -------------------------------------------------------------------------------- /tutorials/SoundJS and PreloadJS/internalPreloading.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SoundJS demo: Internal Preloading 5 | 6 | 7 | 8 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.initConfig( 3 | { 4 | pkg: grunt.file.readJSON('package.json'), 5 | 6 | jasmine: { 7 | run: { 8 | src: [ 9 | '../lib/soundjs-NEXT.js' 10 | ], 11 | 12 | options: { 13 | specs: 'spec/*Spec.js', 14 | helpers: [ 15 | 'spec/Helpers.js' 16 | ], 17 | vendor: [], 18 | host: 'http://127.0.0.1:<%=connect.serve.options.port%>/' 19 | } 20 | } 21 | }, 22 | 23 | connect: { 24 | serve: { 25 | options: { 26 | keepalive: true, 27 | base: [ 28 | { 29 | path: __dirname, 30 | options: { 31 | index: '_SpecRunner.html' 32 | } 33 | }, '..', '../_assets/', '../lib/', './' 34 | ], 35 | useAvailablePort: true, 36 | port: 8000, 37 | open: true, 38 | } 39 | } 40 | }, 41 | 42 | listips: { 43 | run: { 44 | options: { 45 | label: "Normal" 46 | } 47 | } 48 | } 49 | } 50 | ); 51 | 52 | grunt.registerTask('configureConnectHeadless', function () { 53 | grunt.config('connect.serve.options.keepalive', false); 54 | grunt.config('connect.serve.options.open', false); 55 | }); 56 | 57 | // Load all the tasks we need 58 | grunt.loadNpmTasks('grunt-contrib-jasmine'); 59 | grunt.loadNpmTasks('grunt-contrib-connect'); 60 | grunt.loadTasks('tasks/'); 61 | 62 | grunt.registerTask("default", "Launches browser-based tests", "serve"); 63 | grunt.registerTask("serve", "Launches browser-based tests", ["jasmine:run:build", "listips", "connect"]); 64 | 65 | grunt.registerTask("headless", "phantom"); 66 | grunt.registerTask("phantom", "Launches phantom-based tests", ["configureConnectHeadless", "connect", "jasmine"]); 67 | }; 68 | -------------------------------------------------------------------------------- /tutorials/_shared/SyntaxHighlighter/shBrushJScript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'break case catch continue ' + 25 | 'default delete do else false ' + 26 | 'for function if in instanceof ' + 27 | 'new null return super switch ' + 28 | 'this throw true try typeof var while with' 29 | ; 30 | 31 | var r = SyntaxHighlighter.regexLib; 32 | 33 | this.regexList = [ 34 | { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 35 | { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 36 | { regex: r.singleLineCComments, css: 'comments' }, // one line comments 37 | { regex: r.multiLineCComments, css: 'comments' }, // multiline comments 38 | { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 39 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords 40 | ]; 41 | 42 | this.forHtmlScript(r.scriptScriptTags); 43 | }; 44 | 45 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 46 | Brush.aliases = ['js', 'jscript', 'javascript']; 47 | 48 | SyntaxHighlighter.brushes.JScript = Brush; 49 | 50 | // CommonJS 51 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 52 | })(); 53 | -------------------------------------------------------------------------------- /tutorials/Mobile Safe Approach/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | sample 5 | 6 | 7 | 8 |

Hello World.

9 | 10 | 11 | 12 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /tutorials/SoundJS and PreloadJS/preloadjs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SoundJS demo: Using PreloadJS 5 | 6 | 7 | 8 | 9 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /tests/tasks/listips.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 gskinner.com, inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | module.exports = function (grunt) { 27 | var os = require('os'); 28 | 29 | grunt.registerMultiTask('listips', 'Prints a list of active ips.', function() { 30 | var opts = this.options({"port": 80}); 31 | 32 | var port = opts.port; 33 | var label = opts.label?'('+opts.label+') ':''; 34 | 35 | if (port == 80) { 36 | port = ''; 37 | } else { 38 | port = ':'+port; 39 | } 40 | 41 | var interfaces = os.networkInterfaces(); 42 | var addresses = []; 43 | for (var n in interfaces) { 44 | for (var n2 in interfaces[n]) { 45 | var address = interfaces[n][n2]; 46 | if (address.family == 'IPv4' && !address.internal) { 47 | addresses.push('http://'+address.address+port); 48 | } 49 | } 50 | } 51 | 52 | addresses.push('http://localhost'+port); 53 | grunt.log.subhead('\n'+label+'Listening on:\n\t', addresses.join('\n\t ')); 54 | }); 55 | } 56 | -------------------------------------------------------------------------------- /src/createjs/utils/indexOf.js: -------------------------------------------------------------------------------- 1 | /* 2 | * indexOf 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * @class Utility Methods 38 | */ 39 | 40 | /** 41 | * Finds the first occurrence of a specified value searchElement in the passed in array, and returns the index of 42 | * that value. Returns -1 if value is not found. 43 | * 44 | * var i = createjs.indexOf(myArray, myElementToFind); 45 | * 46 | * @method indexOf 47 | * @param {Array} array Array to search for searchElement 48 | * @param searchElement Element to find in array. 49 | * @return {Number} The first index of searchElement in array. 50 | */ 51 | createjs.indexOf = function (array, searchElement){ 52 | "use strict"; 53 | 54 | for (var i = 0,l=array.length; i < l; i++) { 55 | if (searchElement === array[i]) { 56 | return i; 57 | } 58 | } 59 | return -1; 60 | }; 61 | -------------------------------------------------------------------------------- /src/preloadjs/data/Methods.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Methods 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function() { 38 | 39 | "use strict"; 40 | 41 | /** 42 | * Defines the method types for XHR requests. Currently, PreloadJS only supports "POST" and "GET", however 43 | * any HTML method can be used with PreloadJS utilities. 44 | * 45 | * @class Methods 46 | * @static 47 | */ 48 | var s = {}; 49 | 50 | /** 51 | * Defines a POST request, use for a method value when loading data. 52 | * @property POST 53 | * @type {string} 54 | * @default post 55 | * @static 56 | */ 57 | s.POST = "POST"; 58 | 59 | /** 60 | * Defines a GET request, use for a method value when loading data. 61 | * @property GET 62 | * @type {string} 63 | * @default get 64 | * @static 65 | */ 66 | s.GET = "GET"; 67 | 68 | createjs.Methods = s; 69 | }()); 70 | -------------------------------------------------------------------------------- /tutorials/_shared/SyntaxHighlighter/shBrushXml.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | function process(match, regexInfo) 25 | { 26 | var constructor = SyntaxHighlighter.Match, 27 | code = match[0], 28 | tag = new XRegExp('(<|<)[\\s\\/\\?]*(?[:\\w-\\.]+)', 'xg').exec(code), 29 | result = [] 30 | ; 31 | 32 | if (match.attributes != null) 33 | { 34 | var attributes, 35 | regex = new XRegExp('(? [\\w:\\-\\.]+)' + 36 | '\\s*=\\s*' + 37 | '(? ".*?"|\'.*?\'|\\w+)', 38 | 'xg'); 39 | 40 | while ((attributes = regex.exec(code)) != null) 41 | { 42 | result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); 43 | result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); 44 | } 45 | } 46 | 47 | if (tag != null) 48 | result.push( 49 | new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword') 50 | ); 51 | 52 | return result; 53 | } 54 | 55 | this.regexList = [ 56 | { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // 57 | { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // 58 | { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } 59 | ]; 60 | }; 61 | 62 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 63 | Brush.aliases = ['xml', 'xhtml', 'xslt', 'html']; 64 | 65 | SyntaxHighlighter.brushes.Xml = Brush; 66 | 67 | // CommonJS 68 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 69 | })(); 70 | -------------------------------------------------------------------------------- /src/createjs/utils/extend.js: -------------------------------------------------------------------------------- 1 | /* 2 | * extend 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * @class Utility Methods 38 | */ 39 | 40 | /** 41 | * Sets up the prototype chain and constructor property for a new class. 42 | * 43 | * This should be called right after creating the class constructor. 44 | * 45 | * function MySubClass() {} 46 | * createjs.extend(MySubClass, MySuperClass); 47 | * MySubClass.prototype.doSomething = function() { } 48 | * 49 | * var foo = new MySubClass(); 50 | * console.log(foo instanceof MySuperClass); // true 51 | * console.log(foo.prototype.constructor === MySubClass); // true 52 | * 53 | * @method extend 54 | * @param {Function} subclass The subclass. 55 | * @param {Function} superclass The superclass to extend. 56 | * @return {Function} Returns the subclass's new prototype. 57 | */ 58 | createjs.extend = function(subclass, superclass) { 59 | "use strict"; 60 | 61 | function o() { this.constructor = subclass; } 62 | o.prototype = superclass.prototype; 63 | return (subclass.prototype = new o()); 64 | }; 65 | -------------------------------------------------------------------------------- /tutorials/_shared/tutorial.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 3em; 3 | padding: 0; 4 | background-color: #eaebee; 5 | font-family: Arial, Verdana, sans-serif; 6 | font-size: 14px; 7 | font-weight: normal; 8 | color: #333; 9 | line-height: 1.4em; 10 | } 11 | 12 | article { 13 | width: 55em; 14 | margin-left: auto; 15 | margin-right: auto; 16 | } 17 | 18 | a:link, a:visited { 19 | color: #39f; 20 | text-decoration: none; 21 | } 22 | 23 | a:hover { 24 | text-decoration: underline; 25 | } 26 | 27 | header p { 28 | color: #999b9f; 29 | margin: 0; 30 | padding: 0.8em; 31 | line-height: 1.6em; 32 | font-size: 0.9em; 33 | } 34 | 35 | header p strong { 36 | color: #808387; 37 | text-transform: uppercase; 38 | } 39 | 40 | h1::after { 41 | display: block; 42 | content: ""; 43 | background: url('../_shared/createjs-logo-horizontal-gray-lightest.svg') no-repeat; 44 | height:2em; 45 | width: 6em; 46 | margin-top: -0.1em; 47 | float: right; 48 | } 49 | 50 | h1, h2 { 51 | color: #FFF; 52 | font-size: 1.6em; 53 | margin-bottom: 0; 54 | padding: 1.5em; 55 | padding-bottom: 1.2em; 56 | background: #374252; 57 | text-transform: uppercase; 58 | } 59 | 60 | h1 em { 61 | font-weight: 200; 62 | font-style: normal; 63 | } 64 | 65 | h2 { 66 | font-size: 1.3em; 67 | padding: 1em; 68 | padding-bottom: 0.8em; 69 | } 70 | 71 | h3 { 72 | background: #e0e1e5; 73 | color: #374252; 74 | font-size: 1.25em; 75 | padding: 0.5em; 76 | margin-top: 1.25em; 77 | margin-bottom: -0.5em; 78 | position: relative; 79 | } 80 | 81 | div.demo { 82 | border: solid 2px rgba(255, 255, 255, 0.4); 83 | } 84 | 85 | div.demo p { 86 | margin: 0; 87 | padding: 4px; 88 | font-size: 0.9em; 89 | } 90 | 91 | textarea { 92 | width: 100%; 93 | height: 60px; 94 | } 95 | 96 | div.demo p a { 97 | float: right; 98 | } 99 | 100 | iframe.demo { 101 | background-color: rgba(255, 255, 255, 0.25); 102 | border: none; 103 | margin-right: 8px; 104 | } 105 | 106 | code { 107 | color: black; 108 | background-color: rgba(255, 230, 0, 0.33); 109 | padding: 1px 3px; 110 | font-family: Courier New, Courier, serif; 111 | font-weight: bold; 112 | } 113 | 114 | A code, code A { 115 | color: rgb(0, 0, 172); 116 | } 117 | 118 | .highlight { 119 | background-color: rgba(250, 252, 255, 0.7); 120 | margin: 0; 121 | padding: 0.8em; 122 | } -------------------------------------------------------------------------------- /tests/tasks/findopenport.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 gskinner.com, inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | module.exports = function (grunt) { 27 | var net = require('net'); 28 | var _callback; 29 | var _ports; 30 | var _opts; 31 | var _done; 32 | 33 | grunt.registerMultiTask('findopenport', 'Prints a list of active ips.', function() { 34 | _opts = this.options(); 35 | 36 | _done = this.async(); 37 | _ports = _opts['ports'] || [80, 8888, 9000, 9999, 9001]; 38 | checkNext(); 39 | }); 40 | 41 | function checkNext() { 42 | if (!_ports.length) { 43 | grunt.option(_portName, -1); 44 | _done(); 45 | return; 46 | } 47 | 48 | check(_ports.shift(), function(success, port) { 49 | if (!success) { 50 | checkNext(); 51 | } else { 52 | //grunt.option(_portName, port); 53 | var configNames = Array.isArray(_opts.configName)?_opts.configName:[_opts.configName]; 54 | 55 | configNames.forEach(function(item) { 56 | grunt.config.set(item, port); 57 | }); 58 | _done(); 59 | } 60 | }); 61 | } 62 | 63 | function check(port, callback) { 64 | var server = net.createServer(); 65 | server.on('error', function(e) { 66 | callback(false, port); 67 | }); 68 | 69 | server.listen(port, function() { 70 | callback(true, port); 71 | server.close(); 72 | }); 73 | } 74 | }; 75 | -------------------------------------------------------------------------------- /src/preloadjs/utils/Elements.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Elements 3 | * 4 | * Visit http://createjs.com/ for documentation, updates and examples. 5 | * 6 | * 7 | * Copyright (c) 2012 gskinner.com, inc. 8 | * 9 | * Permission is hereby granted, free of charge, to any person 10 | * obtaining a copy of this software and associated documentation 11 | * files (the "Software"), to deal in the Software without 12 | * restriction, including without limitation the rights to use, 13 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, and to permit persons to whom the 15 | * Software is furnished to do so, subject to the following 16 | * conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be 19 | * included in all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | * OTHER DEALINGS IN THE SOFTWARE. 29 | */ 30 | 31 | /** 32 | * @module PreloadJS 33 | */ 34 | 35 | (function () { 36 | 37 | /** 38 | * Convenience methods for creating various elements used by PrelaodJS. 39 | * 40 | * @class DomUtils 41 | */ 42 | var s = {}; 43 | 44 | s.a = function() { 45 | return s.el("a"); 46 | } 47 | 48 | s.svg = function() { 49 | return s.el("svg"); 50 | } 51 | 52 | s.object = function() { 53 | return s.el("object"); 54 | } 55 | 56 | s.image = function() { 57 | return s.el("image"); 58 | } 59 | 60 | s.img = function() { 61 | return s.el("img"); 62 | } 63 | 64 | s.style = function() { 65 | return s.el("style"); 66 | } 67 | 68 | s.link = function() { 69 | return s.el("link"); 70 | } 71 | 72 | s.script = function() { 73 | return s.el("script"); 74 | } 75 | 76 | s.audio = function() { 77 | return s.el("audio"); 78 | } 79 | 80 | s.video = function() { 81 | return s.el("video"); 82 | } 83 | 84 | s.text = function(value) { 85 | return document.createTextNode(value); 86 | } 87 | 88 | s.el = function(name) { 89 | return document.createElement(name); 90 | } 91 | 92 | createjs.Elements = s; 93 | 94 | }()); 95 | -------------------------------------------------------------------------------- /src/preloadjs/net/AbstractRequest.js: -------------------------------------------------------------------------------- 1 | /* 2 | * AbstractRequest 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | /** 41 | * A base class for actual data requests, such as {{#crossLink "XHRRequest"}}{{/crossLink}}, {{#crossLink "TagRequest"}}{{/crossLink}}, 42 | * and {{#crossLink "MediaRequest"}}{{/crossLink}}. PreloadJS loaders will typically use a data loader under the 43 | * hood to get data. 44 | * @class AbstractRequest 45 | * @param {LoadItem} item 46 | * @constructor 47 | */ 48 | var AbstractRequest = function (item) { 49 | this._item = item; 50 | }; 51 | 52 | var p = createjs.extend(AbstractRequest, createjs.EventDispatcher); 53 | 54 | // public methods 55 | /** 56 | * Begin a load. 57 | * @method load 58 | */ 59 | p.load = function() {}; 60 | 61 | /** 62 | * Clean up a request. 63 | * @method destroy 64 | */ 65 | p.destroy = function() {}; 66 | 67 | /** 68 | * Cancel an in-progress request. 69 | * @method cancel 70 | */ 71 | p.cancel = function() {}; 72 | 73 | createjs.AbstractRequest = createjs.promote(AbstractRequest, "EventDispatcher"); 74 | 75 | }()); -------------------------------------------------------------------------------- /src/createjs/events/ErrorEvent.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Event 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | (function() { 37 | "use strict"; 38 | 39 | /** 40 | * A general error {{#crossLink "Event"}}{{/crossLink}}, that describes an error that occurred, as well as any details. 41 | * @class ErrorEvent 42 | * @param {String} [title] The error title 43 | * @param {String} [message] The error description 44 | * @param {Object} [data] Additional error data 45 | * @constructor 46 | */ 47 | function ErrorEvent(title, message, data) { 48 | this.Event_constructor("error"); 49 | 50 | /** 51 | * The short error title, which indicates the type of error that occurred. 52 | * @property title 53 | * @type String 54 | */ 55 | this.title = title; 56 | 57 | /** 58 | * The verbose error message, containing details about the error. 59 | * @property message 60 | * @type String 61 | */ 62 | this.message = message; 63 | 64 | /** 65 | * Additional data attached to an error. 66 | * @property data 67 | * @type {Object} 68 | */ 69 | this.data = data; 70 | } 71 | 72 | var p = createjs.extend(ErrorEvent, createjs.Event); 73 | 74 | p.clone = function() { 75 | return new createjs.ErrorEvent(this.title, this.message, this.data); 76 | }; 77 | 78 | createjs.ErrorEvent = createjs.promote(ErrorEvent, "Event"); 79 | 80 | }()); -------------------------------------------------------------------------------- /src/createjs/utils/deprecate.js: -------------------------------------------------------------------------------- 1 | /* 2 | * extend 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * @class Utility Methods 38 | */ 39 | 40 | /** 41 | * Wraps deprecated methods so they still be used, but throw warnings to developers. 42 | * 43 | * obj.deprecatedMethod = createjs.deprecate("Old Method Name", obj._fallbackMethod); 44 | * 45 | * The recommended approach for deprecated properties is: 46 | * 47 | * try { 48 | * Obj ect.defineProperties(object, { 49 | * readyOnlyProp: { get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }) }, 50 | * readWriteProp: { 51 | * get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }), 52 | * set: createjs.deprecate("readOnlyProp", function(val) { this.alternateProp = val; }) 53 | * }); 54 | * } catch (e) {} 55 | * 56 | * @method deprecate 57 | * @param {Function} [fallbackMethod=null] A method to call when the deprecated method is used. See the example for how 58 | * @param {String} [name=null] The name of the method or property to display in the console warning. 59 | * to deprecate properties. 60 | * @return {Function} If a fallbackMethod is supplied, returns a closure that will call the fallback method after 61 | * logging the warning in the console. 62 | */ 63 | createjs.deprecate = function(fallbackMethod, name) { 64 | "use strict"; 65 | return function() { 66 | var msg = "Deprecated property or method '"+name+"'. See docs for info."; 67 | console && (console.warn ? console.warn(msg) : console.log(msg)); 68 | return fallbackMethod && fallbackMethod.apply(this, arguments); 69 | } 70 | }; -------------------------------------------------------------------------------- /src/createjs/utils/proxy.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Proxy 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * Various utilities that the CreateJS Suite uses. Utilities are created as separate files, and will be available on the 38 | * createjs namespace directly. 39 | * 40 | *

Example

41 | * 42 | * myObject.addEventListener("change", createjs.proxy(myMethod, scope)); 43 | * 44 | * @class Utility Methods 45 | * @main Utility Methods 46 | */ 47 | 48 | (function() { 49 | "use strict"; 50 | 51 | /** 52 | * A function proxy for methods. By default, JavaScript methods do not maintain scope, so passing a method as a 53 | * callback will result in the method getting called in the scope of the caller. Using a proxy ensures that the 54 | * method gets called in the correct scope. 55 | * 56 | * Additional arguments can be passed that will be applied to the function when it is called. 57 | * 58 | *

Example

59 | * 60 | * myObject.addEventListener("event", createjs.proxy(myHandler, this, arg1, arg2)); 61 | * 62 | * function myHandler(arg1, arg2) { 63 | * // This gets called when myObject.myCallback is executed. 64 | * } 65 | * 66 | * @method proxy 67 | * @param {Function} method The function to call 68 | * @param {Object} scope The scope to call the method name on 69 | * @param {mixed} [arg] * Arguments that are appended to the callback for additional params. 70 | * @public 71 | * @static 72 | */ 73 | createjs.proxy = function (method, scope) { 74 | var aArgs = Array.prototype.slice.call(arguments, 2); 75 | return function () { 76 | return method.apply(scope, Array.prototype.slice.call(arguments, 0).concat(aArgs)); 77 | }; 78 | } 79 | 80 | }()); 81 | -------------------------------------------------------------------------------- /examples/Game/Ship.js: -------------------------------------------------------------------------------- 1 | (function (window) { 2 | 3 | function Ship() { 4 | this.Container_constructor(); 5 | 6 | this.shipFlame = new createjs.Shape(); 7 | this.shipBody = new createjs.Shape(); 8 | 9 | this.addChild(this.shipFlame); 10 | this.addChild(this.shipBody); 11 | 12 | this.makeShape(); 13 | this.timeout = 0; 14 | this.thrust = 0; 15 | this.vX = 0; 16 | this.vY = 0; 17 | } 18 | var p = createjs.extend(Ship, createjs.Container); 19 | 20 | // public properties: 21 | Ship.TOGGLE = 60; 22 | Ship.MAX_THRUST = 2; 23 | Ship.MAX_VELOCITY = 5; 24 | 25 | // public properties: 26 | p.shipFlame; 27 | p.shipBody; 28 | 29 | p.timeout; 30 | p.thrust; 31 | 32 | p.vX; 33 | p.vY; 34 | 35 | p.bounds; 36 | p.hit; 37 | 38 | 39 | // public methods: 40 | p.makeShape = function () { 41 | //draw ship body 42 | var g = this.shipBody.graphics; 43 | g.clear(); 44 | g.beginStroke("#FFFFFF"); 45 | 46 | g.moveTo(0, 10); //nose 47 | g.lineTo(5, -6); //rfin 48 | g.lineTo(0, -2); //notch 49 | g.lineTo(-5, -6); //lfin 50 | g.closePath(); // nose 51 | 52 | 53 | //draw ship flame 54 | var o = this.shipFlame; 55 | o.scaleX = 0.5; 56 | o.scaleY = 0.5; 57 | o.y = -5; 58 | 59 | g = o.graphics; 60 | g.clear(); 61 | g.beginStroke("#FFFFFF"); 62 | 63 | g.moveTo(2, 0); //ship 64 | g.lineTo(4, -3); //rpoint 65 | g.lineTo(2, -2); //rnotch 66 | g.lineTo(0, -5); //tip 67 | g.lineTo(-2, -2); //lnotch 68 | g.lineTo(-4, -3); //lpoint 69 | g.lineTo(-2, -0); //ship 70 | 71 | //furthest visual element 72 | this.bounds = 10; 73 | this.hit = this.bounds; 74 | } 75 | 76 | p.tick = function (event) { 77 | //move by velocity 78 | this.x += this.vX; 79 | this.y += this.vY; 80 | 81 | //with thrust flicker a flame every Ship.TOGGLE frames, attenuate thrust 82 | if (this.thrust > 0) { 83 | this.timeout++; 84 | this.shipFlame.alpha = 1; 85 | 86 | if (this.timeout > Ship.TOGGLE) { 87 | this.timeout = 0; 88 | if (this.shipFlame.scaleX == 1) { 89 | this.shipFlame.scaleX = 0.5; 90 | this.shipFlame.scaleY = 0.5; 91 | } else { 92 | this.shipFlame.scaleX = 1; 93 | this.shipFlame.scaleY = 1; 94 | } 95 | } 96 | this.thrust -= 0.5; 97 | } else { 98 | this.shipFlame.alpha = 0; 99 | this.thrust = 0; 100 | } 101 | } 102 | 103 | p.accelerate = function () { 104 | //increase push amount for acceleration 105 | this.thrust += this.thrust + 0.6; 106 | if (this.thrust >= Ship.MAX_THRUST) { 107 | this.thrust = Ship.MAX_THRUST; 108 | } 109 | 110 | //accelerate 111 | this.vX += Math.sin(this.rotation * (Math.PI / -180)) * this.thrust; 112 | this.vY += Math.cos(this.rotation * (Math.PI / -180)) * this.thrust; 113 | 114 | //cap max speeds 115 | this.vX = Math.min(Ship.MAX_VELOCITY, Math.max(-Ship.MAX_VELOCITY, this.vX)); 116 | this.vY = Math.min(Ship.MAX_VELOCITY, Math.max(-Ship.MAX_VELOCITY, this.vY)); 117 | } 118 | 119 | window.Ship = createjs.promote(Ship, "Container"); 120 | 121 | }(window)); 122 | -------------------------------------------------------------------------------- /src/preloadjs/events/ProgressEvent.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ProgressEvent 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function (scope) { 38 | "use strict"; 39 | 40 | // constructor 41 | /** 42 | * A CreateJS {{#crossLink "Event"}}{{/crossLink}} that is dispatched when progress changes. 43 | * @class ProgressEvent 44 | * @param {Number} loaded The amount that has been loaded. This can be any number relative to the total. 45 | * @param {Number} [total=1] The total amount that will load. This will default to 1, so if the `loaded` value is 46 | * a percentage (between 0 and 1), it can be omitted. 47 | * @todo Consider having this event be a "fileprogress" event as well 48 | * @constructor 49 | */ 50 | function ProgressEvent(loaded, total) { 51 | this.Event_constructor("progress"); 52 | 53 | /** 54 | * The amount that has been loaded (out of a total amount) 55 | * @property loaded 56 | * @type {Number} 57 | */ 58 | this.loaded = loaded; 59 | 60 | /** 61 | * The total "size" of the load. 62 | * @property total 63 | * @type {Number} 64 | * @default 1 65 | */ 66 | this.total = (total == null) ? 1 : total; 67 | 68 | /** 69 | * The percentage (out of 1) that the load has been completed. This is calculated using `loaded/total`. 70 | * @property progress 71 | * @type {Number} 72 | * @default 0 73 | */ 74 | this.progress = (total == 0) ? 0 : this.loaded / this.total; 75 | }; 76 | 77 | var p = createjs.extend(ProgressEvent, createjs.Event); 78 | 79 | /** 80 | * Returns a clone of the ProgressEvent instance. 81 | * @method clone 82 | * @return {ProgressEvent} a clone of the Event instance. 83 | **/ 84 | p.clone = function() { 85 | return new createjs.ProgressEvent(this.loaded, this.total); 86 | }; 87 | 88 | createjs.ProgressEvent = createjs.promote(ProgressEvent, "Event"); 89 | 90 | }(window)); -------------------------------------------------------------------------------- /src/soundjs/webaudio/WebAudioLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * WebAudioLoader 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module SoundJS 32 | */ 33 | 34 | // namespace: 35 | this.createjs = this.createjs || {}; 36 | 37 | (function () { 38 | "use strict"; 39 | 40 | /** 41 | * Loader provides a mechanism to preload Web Audio content via PreloadJS or internally. Instances are returned to 42 | * the preloader, and the load method is called when the asset needs to be requested. 43 | * 44 | * @class WebAudioLoader 45 | * @param {String} loadItem The item to be loaded 46 | * @extends XHRRequest 47 | * @protected 48 | */ 49 | function Loader(loadItem) { 50 | this.AbstractLoader_constructor(loadItem, true, createjs.Types.SOUND); 51 | 52 | }; 53 | var p = createjs.extend(Loader, createjs.AbstractLoader); 54 | 55 | /** 56 | * web audio context required for decoding audio 57 | * @property context 58 | * @type {AudioContext} 59 | * @static 60 | */ 61 | Loader.context = null; 62 | 63 | 64 | // public methods 65 | p.toString = function () { 66 | return "[WebAudioLoader]"; 67 | }; 68 | 69 | 70 | // private methods 71 | p._createRequest = function() { 72 | this._request = new createjs.XHRRequest(this._item, false); 73 | this._request.setResponseType("arraybuffer"); 74 | }; 75 | 76 | p._sendComplete = function (event) { 77 | // OJR we leave this wrapped in Loader because we need to reference src and the handler only receives a single argument, the decodedAudio 78 | Loader.context.decodeAudioData(this._rawResult, 79 | createjs.proxy(this._handleAudioDecoded, this), 80 | createjs.proxy(this._sendError, this)); 81 | }; 82 | 83 | 84 | /** 85 | * The audio has been decoded. 86 | * @method handleAudioDecoded 87 | * @param decoded 88 | * @protected 89 | */ 90 | p._handleAudioDecoded = function (decodedAudio) { 91 | this._result = decodedAudio; 92 | this.AbstractLoader__sendComplete(); 93 | }; 94 | 95 | createjs.WebAudioLoader = createjs.promote(Loader, "AbstractLoader"); 96 | }()); 97 | -------------------------------------------------------------------------------- /src/createjs/utils/BrowserDetect.js: -------------------------------------------------------------------------------- 1 | /* 2 | * BrowserDetect 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * @class Utility Methods 38 | */ 39 | (function() { 40 | "use strict"; 41 | 42 | /** 43 | * An object that determines the current browser, version, operating system, and other environment 44 | * variables via user agent string. 45 | * 46 | * Used for audio because feature detection is unable to detect the many limitations of mobile devices. 47 | * 48 | *

Example

49 | * 50 | * if (createjs.BrowserDetect.isIOS) { // do stuff } 51 | * 52 | * @property BrowserDetect 53 | * @type {Object} 54 | * @param {Boolean} isFirefox True if our browser is Firefox. 55 | * @param {Boolean} isOpera True if our browser is opera. 56 | * @param {Boolean} isChrome True if our browser is Chrome. Note that Chrome for Android returns true, but is a 57 | * completely different browser with different abilities. 58 | * @param {Boolean} isIOS True if our browser is safari for iOS devices (iPad, iPhone, and iPod). 59 | * @param {Boolean} isAndroid True if our browser is Android. 60 | * @param {Boolean} isBlackberry True if our browser is Blackberry. 61 | * @constructor 62 | * @static 63 | */ 64 | function BrowserDetect() { 65 | throw "BrowserDetect cannot be instantiated"; 66 | }; 67 | 68 | var agent = BrowserDetect.agent = window.navigator.userAgent; 69 | BrowserDetect.isWindowPhone = (agent.indexOf("IEMobile") > -1) || (agent.indexOf("Windows Phone") > -1); 70 | BrowserDetect.isFirefox = (agent.indexOf("Firefox") > -1); 71 | BrowserDetect.isOpera = (window.opera != null); 72 | BrowserDetect.isChrome = (agent.indexOf("Chrome") > -1); // NOTE that Chrome on Android returns true but is a completely different browser with different abilities 73 | BrowserDetect.isIOS = (agent.indexOf("iPod") > -1 || agent.indexOf("iPhone") > -1 || agent.indexOf("iPad") > -1) && !BrowserDetect.isWindowPhone; 74 | BrowserDetect.isAndroid = (agent.indexOf("Android") > -1) && !BrowserDetect.isWindowPhone; 75 | BrowserDetect.isBlackberry = (agent.indexOf("Blackberry") > -1); 76 | 77 | createjs.BrowserDetect = BrowserDetect; 78 | 79 | }()); 80 | -------------------------------------------------------------------------------- /tutorials/_shared/SyntaxHighlighter/shThemeDefault.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: white !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: white !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: white !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #e0e0e0 !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: black !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: black !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #afafaf !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #6ce26c !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #6ce26c !important; 43 | color: white !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: blue !important; 53 | background: white !important; 54 | border: 1px solid #6ce26c !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: blue !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: red !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: white !important; 64 | background: #6ce26c !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: white !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: black !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: black !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #008200 !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: blue !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: #006699 !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: gray !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: #aa7700 !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #009900 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #ff1493 !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: #0066cc !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: #006699 !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: gray !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: #ff1493 !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: red !important; 113 | } 114 | 115 | .syntaxhighlighter .keyword { 116 | font-weight: bold !important; 117 | } 118 | -------------------------------------------------------------------------------- /src/soundjs/data/AudioSprite.js: -------------------------------------------------------------------------------- 1 | // NOTE this is "Class" is purely to document audioSprite Setup and usage. 2 | /** 3 | * @module SoundJS 4 | */ 5 | 6 | /** 7 | * Note: AudioSprite is not a class, but its usage is easily lost in the documentation, so it has been called 8 | * out here for quick reference. 9 | * 10 | * Audio sprites are much like CSS sprites or image sprite sheets: multiple audio assets grouped into a single file. 11 | * Audio sprites work around limitations in certain browsers, where only a single sound can be loaded and played at a 12 | * time. We recommend at least 300ms of silence between audio clips to deal with HTML audio tag inaccuracy, and to prevent 13 | * accidentally playing bits of the neighbouring clips. 14 | * 15 | * Benefits of Audio Sprites: 16 | *
    17 | *
  • More robust support for older browsers and devices that only allow a single audio instance, such as iOS 5.
  • 18 | *
  • They provide a work around for the Internet Explorer 9 audio tag limit, which restricts how many different 19 | * sounds that could be loaded at once.
  • 20 | *
  • Faster loading by only requiring a single network request for several sounds, especially on mobile devices 21 | * where the network round trip for each file can add significant latency.
  • 22 | *
23 | * 24 | * Drawbacks of Audio Sprites 25 | *
    26 | *
  • No guarantee of smooth looping when using HTML or Flash audio. If you have a track that needs to loop 27 | * smoothly and you are supporting non-web audio browsers, do not use audio sprites for that sound if you can avoid 28 | * it.
  • 29 | *
  • No guarantee that HTML audio will play back immediately, especially the first time. In some browsers 30 | * (Chrome!), HTML audio will only load enough to play through at the current download speed – so we rely on the 31 | * `canplaythrough` event to determine if the audio is loaded. Since audio sprites must jump ahead to play specific 32 | * sounds, the audio may not yet have downloaded fully.
  • 33 | *
  • Audio sprites share the same core source, so if you have a sprite with 5 sounds and are limited to 2 34 | * concurrently playing instances, you can only play 2 of the sounds at the same time.
  • 35 | *
36 | * 37 | *

Example

38 | * 39 | * createjs.Sound.initializeDefaultPlugins(); 40 | * var assetsPath = "./assets/"; 41 | * var sounds = [{ 42 | * src:"MyAudioSprite.ogg", data: { 43 | * audioSprite: [ 44 | * {id:"sound1", startTime:0, duration:500}, 45 | * {id:"sound2", startTime:1000, duration:400}, 46 | * {id:"sound3", startTime:1700, duration: 1000} 47 | * ]} 48 | * } 49 | * ]; 50 | * createjs.Sound.alternateExtensions = ["mp3"]; 51 | * createjs.Sound.on("fileload", loadSound); 52 | * createjs.Sound.registerSounds(sounds, assetsPath); 53 | * // after load is complete 54 | * createjs.Sound.play("sound2"); 55 | * 56 | * You can also create audio sprites on the fly by setting the startTime and duration when creating an new AbstractSoundInstance. 57 | * 58 | * createjs.Sound.play("MyAudioSprite", {startTime: 1000, duration: 400}); 59 | * 60 | * The excellent CreateJS community has created a tool to create audio sprites, available at 61 | * https://github.com/tonistiigi/audiosprite, 62 | * as well as a jsfiddle to convert the output 63 | * to SoundJS format. 64 | * 65 | * @class AudioSprite 66 | * @since 0.6.0 67 | */ 68 | -------------------------------------------------------------------------------- /src/createjs/utils/promote.js: -------------------------------------------------------------------------------- 1 | /* 2 | * promote 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * Copyright (c) 2010 gskinner.com, inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * @module CreateJS 31 | */ 32 | 33 | // namespace: 34 | this.createjs = this.createjs||{}; 35 | 36 | /** 37 | * @class Utility Methods 38 | */ 39 | 40 | /** 41 | * Promotes any methods on the super class that were overridden, by creating an alias in the format `prefix_methodName`. 42 | * It is recommended to use the super class's name as the prefix. 43 | * An alias to the super class's constructor is always added in the format `prefix_constructor`. 44 | * This allows the subclass to call super class methods without using `function.call`, providing better performance. 45 | * 46 | * For example, if `MySubClass` extends `MySuperClass`, and both define a `draw` method, then calling `promote(MySubClass, "MySuperClass")` 47 | * would add a `MySuperClass_constructor` method to MySubClass and promote the `draw` method on `MySuperClass` to the 48 | * prototype of `MySubClass` as `MySuperClass_draw`. 49 | * 50 | * This should be called after the class's prototype is fully defined. 51 | * 52 | * function ClassA(name) { 53 | * this.name = name; 54 | * } 55 | * ClassA.prototype.greet = function() { 56 | * return "Hello "+this.name; 57 | * } 58 | * 59 | * function ClassB(name, punctuation) { 60 | * this.ClassA_constructor(name); 61 | * this.punctuation = punctuation; 62 | * } 63 | * createjs.extend(ClassB, ClassA); 64 | * ClassB.prototype.greet = function() { 65 | * return this.ClassA_greet()+this.punctuation; 66 | * } 67 | * createjs.promote(ClassB, "ClassA"); 68 | * 69 | * var foo = new ClassB("World", "!?!"); 70 | * console.log(foo.greet()); // Hello World!?! 71 | * 72 | * @method promote 73 | * @param {Function} subclass The class to promote super class methods on. 74 | * @param {String} prefix The prefix to add to the promoted method names. Usually the name of the superclass. 75 | * @return {Function} Returns the subclass. 76 | */ 77 | createjs.promote = function(subclass, prefix) { 78 | "use strict"; 79 | 80 | var subP = subclass.prototype, supP = (Object.getPrototypeOf&&Object.getPrototypeOf(subP))||subP.__proto__; 81 | if (supP) { 82 | subP[(prefix+="_") + "constructor"] = supP.constructor; // constructor is not always innumerable 83 | for (var n in supP) { 84 | if (subP.hasOwnProperty(n) && (typeof supP[n] == "function")) { subP[prefix + n] = supP[n]; } 85 | } 86 | } 87 | return subclass; 88 | }; 89 | -------------------------------------------------------------------------------- /examples/00_Basics.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SoundJS: Basics 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |

Basics

16 | 17 |

This example registers and plays a sound with SoundJS.

18 |
19 | 20 |
21 |

Startup.

22 |
23 | 24 |
25 |

Sorry!

26 | 27 |

SoundJS is not currently supported in your browser.

28 | 29 |

Please log a bug 30 | with the device and browser you are using. Thank you.

31 |
32 | 33 |
34 |

Sorry!

35 | 36 |

Mobile devices require sound to be played inside of user events, which 37 | this demo does not do.

38 | 39 |

Please log a bug 40 | with the OS and browser if you see this on a device that is not mobile. 41 | Thank you.

42 |
43 | 44 | 45 | 47 | 48 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/preloadjs/utils/DomUtils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * DomUtils 3 | * Visit http://createjs.com/ for documentation, updates and examples. 4 | * 5 | * 6 | * Copyright (c) 2012 gskinner.com, inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | /** 31 | * @module PreloadJS 32 | */ 33 | 34 | (function () { 35 | 36 | /** 37 | * A few utilities for interacting with the dom. 38 | * @class DomUtils 39 | */ 40 | var s = { 41 | container: null 42 | }; 43 | 44 | s.appendToHead = function (el) { 45 | s.getHead().appendChild(el); 46 | } 47 | 48 | s.appendToBody = function (el) { 49 | if (s.container == null) { 50 | s.container = document.createElement("div"); 51 | s.container.id = "preloadjs-container"; 52 | var style = s.container.style; 53 | style.visibility = "hidden"; 54 | style.position = "absolute"; 55 | style.width = s.container.style.height = "10px"; 56 | style.overflow = "hidden"; 57 | style.transform = style.msTransform = style.webkitTransform = style.oTransform = "translate(-10px, -10px)"; //LM: Not working 58 | s.getBody().appendChild(s.container); 59 | } 60 | s.container.appendChild(el); 61 | } 62 | 63 | s.getHead = function () { 64 | return document.head || document.getElementsByTagName("head")[0]; 65 | } 66 | 67 | s.getBody = function () { 68 | return document.body || document.getElementsByTagName("body")[0]; 69 | } 70 | 71 | s.removeChild = function(el) { 72 | if (el.parent) { 73 | el.parent.removeChild(el); 74 | } 75 | } 76 | 77 | /** 78 | * Check if item is a valid HTMLImageElement 79 | * @method isImageTag 80 | * @param {Object} item 81 | * @returns {Boolean} 82 | * @static 83 | */ 84 | s.isImageTag = function(item) { 85 | return item instanceof HTMLImageElement; 86 | }; 87 | 88 | /** 89 | * Check if item is a valid HTMLAudioElement 90 | * @method isAudioTag 91 | * @param {Object} item 92 | * @returns {Boolean} 93 | * @static 94 | */ 95 | s.isAudioTag = function(item) { 96 | if (window.HTMLAudioElement) { 97 | return item instanceof HTMLAudioElement; 98 | } else { 99 | return false; 100 | } 101 | }; 102 | 103 | /** 104 | * Check if item is a valid HTMLVideoElement 105 | * @method isVideoTag 106 | * @param {Object} item 107 | * @returns {Boolean} 108 | * @static 109 | */ 110 | s.isVideoTag = function(item) { 111 | if (window.HTMLVideoElement) { 112 | return item instanceof HTMLVideoElement; 113 | } else { 114 | return false; 115 | } 116 | }; 117 | 118 | createjs.DomUtils = s; 119 | 120 | }()); 121 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SoundJS 2 | 3 | SoundJS is a library to make working with audio on the web easier. It provides a consistent API for playing audio in 4 | different browsers, including using a target plugin model to provide an easy way to provide additional audio plugins 5 | like a Flash fallback (included, but must be used separately from the combined/minified version). 6 | 7 | A mechanism has been provided for easily tying in audio preloading to [PreloadJS](http://createjs.com/preloadjs/). 8 | 9 | 10 | ## Example 11 | 12 | ```javascript 13 | createjs.Sound.on("fileload", handleLoadComplete); 14 | createjs.Sound.alternateExtensions = ["mp3"]; 15 | createjs.Sound.registerSound({src:"path/to/sound.ogg", id:"sound"}); 16 | function handleLoadComplete(event) { 17 | createjs.Sound.play("sound"); 18 | } 19 | ``` 20 | 21 | ## License 22 | Built by gskinner.com, and released for free under the MIT license, which means you can use it for almost any purpose 23 | (including commercial projects). We appreciate credit where possible, but it is not a requirement. 24 | 25 | 26 | ## Support and Resources 27 | * Find examples and more information at the [SoundJS web site](http://soundjs.com/) 28 | * Read the [documentation](http://createjs.com/docs/soundjs/) 29 | * Discuss, share projects, and interact with other users on [reddit](http://www.reddit.com/r/createjs/). 30 | * Ask technical questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/soundjs). 31 | * File verified bugs or formal feature requests using Issues on [GitHub](https://github.com/CreateJS/SoundJS/issues). 32 | * Have a look at the included [examples](https://github.com/CreateJS/SoundJS/tree/master/examples) and 33 | [API documentation](http://createjs.com/docs/soundjs/) for more in-depth information. 34 | 35 | 36 | ## Classes 37 | 38 | ### [Sound](http://createjs.com/Docs/SoundJS/classes/Sound.html) 39 | The core API for playing sounds. Call createjs.Sound.play(sound, ...options), and a sound instance is created that can be 40 | used to control the audio, and dispatches events when it is complete, loops, or is interrupted. 41 | 42 | ### [SoundInstance](http://createjs.com/Docs/SoundJS/classes/AbstractSoundInstance.html) 43 | A controllable sound object that wraps the actual plugin implementation, providing a consistent API for audio playback, 44 | no matter what happens in the background. Sound instances can be paused, muted, and stopped; and the volume, pan (where 45 | available), and position changed using the simple API. 46 | 47 | ### [WebAudioPlugin](http://createjs.com/Docs/SoundJS/classes/WebAudioPlugin.html) 48 | The default, built-in plugin, which uses Web Audio APIs to playback sounds. Note that WebAudio will fail to load when 49 | run locally, and the HTML audio plugin will be used instead. 50 | 51 | ### [HTMLAudioPlugin](http://createjs.com/Docs/SoundJS/classes/HTMLAudioPlugin.html) 52 | The fallback built-in plugin, which manages audio playback via the HTML5