Skip to content

Commit

Permalink
Cleanup audio loading, add promise polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
milcktoast committed Nov 16, 2015
1 parent ceb5eac commit e7ef688
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
7 changes: 4 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"private": true,
"version": "0.0.0",
"dependencies": {
"red-sass": "~0.2.0",
"particulate": "~0.3.2",
"handlebars": "1.3.0",
"native-promise-only": "~0.8.0-a",
"noise": "[email protected]:josephg/noisejs.git#3861daee43d62f809126eb9783cf4091d4796ee8",
"particulate": "~0.3.2",
"qunit": "~1.18.0",
"noise": "[email protected]:josephg/noisejs.git#3861daee43d62f809126eb9783cf4091d4796ee8"
"red-sass": "~0.2.0"
}
}
1 change: 1 addition & 0 deletions static/js/libs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('lib/native-promise-only/lib/npo.src');
require('lib/handlebars/handlebars.runtime');
require('lib/particulate/dist/particulate');
require('lib/noise/perlin');
Expand Down
12 changes: 7 additions & 5 deletions static/js/scenes/MainScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,15 @@ MainScene.prototype.initAudio = function () {
audio.playSound(sounds.bg);
audio.addListener('mute', this, 'muteSounds');
audio.addListener('unmute', this, 'unmuteSounds');
this.triggerListeners('load:audio');
return audio.loadBuffer(sounds.wave);
}.bind(this)).then(function () {
setTimeout(this.triggerListeners.bind(this, 'load:audio'), 0);
}.bind(this));

audio.loadBuffer(sounds.wave).then(function () {
this.medusae.addListener('phase:top', this, 'audioPhaseTop');
audio.loadBuffer(sounds.bubblesLow);
audio.loadBuffer(sounds.bubblesHigh);
}.bind(this));

audio.loadBuffer(sounds.bubblesLow);
audio.loadBuffer(sounds.bubblesHigh);
};

MainScene.prototype.playSound = function (params) {
Expand Down

0 comments on commit e7ef688

Please sign in to comment.