Sound gestion improved
This commit is contained in:
parent
96677c8635
commit
b868c2598c
@ -40,7 +40,7 @@ function Controller(selectedSong, songData){
|
|||||||
_view.refresh();
|
_view.refresh();
|
||||||
}
|
}
|
||||||
else if(ms>=0 && !started){ //when music starts
|
else if(ms>=0 && !started){ //when music starts
|
||||||
_game.playSound("main-music");
|
assets.sounds["main-music"].play();
|
||||||
started=true;
|
started=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,9 @@ function Loader(){
|
|||||||
audio.src = '/assets/audio/'+name;
|
audio.src = '/assets/audio/'+name;
|
||||||
audio.load();
|
audio.load();
|
||||||
audio.onloadeddata = function(){
|
audio.onloadeddata = function(){
|
||||||
assets.sounds[id] = audio;
|
assets.sounds[id] = new Audio();
|
||||||
|
assets.sounds[id].src = audio.src;
|
||||||
|
assets.sounds[id].load();
|
||||||
_this.assetLoaded();
|
_this.assetLoaded();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -10,7 +10,7 @@ function loadSong(selectedSong){
|
|||||||
|
|
||||||
this.run = function(){
|
this.run = function(){
|
||||||
|
|
||||||
//assets.sounds["start"]["audio"][0].play();
|
assets.sounds["start"].play();
|
||||||
$("#assets").append("<img id='music-bg' src='/songs/"+_selectedSong.folder+"/bg.png' />");
|
$("#assets").append("<img id='music-bg' src='/songs/"+_selectedSong.folder+"/bg.png' />");
|
||||||
|
|
||||||
var audio = new Audio();
|
var audio = new Audio();
|
||||||
|
@ -14,7 +14,7 @@ function soundSystem(controller){
|
|||||||
_channels[i]["end"] = -1;
|
_channels[i]["end"] = -1;
|
||||||
_channels[i]["audio"] = new Audio();
|
_channels[i]["audio"] = new Audio();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playSound = function(soundID){
|
this.playSound = function(soundID){
|
||||||
|
|
||||||
for(var i=0;i<_channelMAX;i++){ //play in different sounds in different channels
|
for(var i=0;i<_channelMAX;i++){ //play in different sounds in different channels
|
||||||
@ -27,7 +27,7 @@ function soundSystem(controller){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pauseSound = function(soundID, stop){
|
this.pauseSound = function(soundID, stop){
|
||||||
|
Loading…
Reference in New Issue
Block a user