Fixed a bug where the jingle wouldn't play during level loading if the audio had been loaded previously.

This commit is contained in:
Scott Erickson 2014-02-26 20:23:13 -08:00
parent 74186b7772
commit 8d828939b6
2 changed files with 6 additions and 3 deletions

View file

@ -74,7 +74,6 @@ class AudioPlayer extends CocoClass
filename = "/file/interface/#{name}#{@ext}"
if filename of cache and createjs.Sound.loadComplete filename
@playSound name, volume
createjs.Sound.play name
else
@preloadInterfaceSounds [name] unless filename of cache
@soundsToPlayWhenLoaded[name] = volume

View file

@ -36,8 +36,12 @@ module.exports = class LevelLoader extends CocoClass
playJingle: ->
return if @headless
jingles = ["ident_1", "ident_2"]
AudioPlayer.playInterfaceSound jingles[Math.floor Math.random() * jingles.length]
# Apparently the jingle, when it tries to play immediately during all this loading, you can't hear it.
# Add the timeout to fix this weird behavior.
f = ->
jingles = ["ident_1", "ident_2"]
AudioPlayer.playInterfaceSound jingles[Math.floor Math.random() * jingles.length]
setTimeout f, 500
# Session Loading