diff --git a/src/js/controller.js b/src/js/controller.js index 2d9d299..f0bc6ac 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -45,8 +45,10 @@ function Controller(selectedSong, songData){ _view.refresh(); } else if(ms>=0 && !started){ //when music shall starts - assets.sounds["main-music"].volume = 0.7; - assets.sounds["main-music"].play(); + setTimeout(function(){ + assets.sounds["main-music"].volume = 0.7; + assets.sounds["main-music"].play(); + }, _songData.generalInfo.audioWait); started=true; } diff --git a/src/js/parsesong.js b/src/js/parsesong.js index 2452fca..9dfd297 100644 --- a/src/js/parsesong.js +++ b/src/js/parsesong.js @@ -2,7 +2,7 @@ function ParseSong(fileContent){ var _this = this; var _data = fileContent; - var _generalInfo={audioFilename:""}; + var _generalInfo={audioFilename:"", audioWait:0}; var _metadata={title:'', artist:''}; var _difficulty={sliderMultiplier:0, sliderTickRate:0, approachRate:0}; var _beatInfo={beatInterval:0, bpm:0}; @@ -120,6 +120,9 @@ function ParseSong(fileContent){ case 'SliderMultiple': _generalInfo.audioFilename = key; break; + case 'AudioWait': + _generalInfo.audioWait = parseInt(key); + break; } } diff --git a/src/js/songselect.js b/src/js/songselect.js index 244649a..a484917 100644 --- a/src/js/songselect.js +++ b/src/js/songselect.js @@ -19,7 +19,7 @@ function SongSelect(){ var delay = end - start; var no_delay = first_open ? 0 : 300; - _preview.currentTime = 10.0; + _preview.currentTime = _preview.duration/2-10; _preview.loop = true; _preview.volume = 0.5;