From 2a6a6d0524cb16497f4c9d03c99efb39b1d0f19c Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Tue, 11 Sep 2018 17:50:10 +0300 Subject: [PATCH] Fix some sounds --- public/src/js/controller.js | 2 +- public/src/js/game.js | 13 ++++++------- public/src/js/scoresheet.js | 2 +- public/src/js/songselect.js | 15 ++++++++------- public/src/js/soundbuffer.js | 2 +- public/src/js/tutorial.js | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/public/src/js/controller.js b/public/src/js/controller.js index 9350649..c2029b6 100644 --- a/public/src/js/controller.js +++ b/public/src/js/controller.js @@ -88,7 +88,7 @@ function Controller(selectedSong, songData, autoPlayEnabled){ if (score.fail == 0) { vp = 'fullcombo'; - _this.playSoundMeka('fullcombo', 1350); + _this.playSoundMeka('fullcombo', 1.350); } else if (score.hp >= 50) { vp = 'clear'; } else { diff --git a/public/src/js/game.js b/public/src/js/game.js index 5d1ee77..45f4e86 100644 --- a/public/src/js/game.js +++ b/public/src/js/game.js @@ -199,11 +199,14 @@ function Game(controller, selectedSong, songData){ if(_fadeOutStarted){ if(_musicFadeOut==0){ snd.musicGain.fadeOut(1.6) - _mainAsset.stop(1.6) - snd.musicGain.fadeIn(0, 1.7) } if(_ellapsedTime.ms>=_fadeOutStarted+1600){ controller.fadeOutOver() + _mainAsset.stop() + setTimeout(() => { + snd.musicGain.fadeIn() + snd.musicGain.unmute() + }, 1000) } _musicFadeOut++; } @@ -224,7 +227,7 @@ function Game(controller, selectedSong, songData){ this.toggleMainMusic = function(){ if(_mainMusicPlaying){ - _mainAsset.pause(); + _mainAsset.stop(); _mainMusicPlaying=false; } else{ @@ -237,10 +240,6 @@ function Game(controller, selectedSong, songData){ _fadeOutStarted=false; } - this.pauseSound = function(soundID, stop){ - _soundSystem.pauseSound(soundID, stop); - } - this.getHitcircleSpeed = function(){ return _hitcircleSpeed; } diff --git a/public/src/js/scoresheet.js b/public/src/js/scoresheet.js index 7280ada..0273535 100644 --- a/public/src/js/scoresheet.js +++ b/public/src/js/scoresheet.js @@ -97,7 +97,7 @@ function Scoresheet(controller, score){ } assets.sounds["results"].play() - assets.sounds["bgm_result"].playLoop(0, false, 0, 0.846625) + assets.sounds["bgm_result"].playLoop(0.1, false, 0, 0.847, 17.689) $("#screen").load("/src/views/scoresheet.html", _this.run); diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 7ab7bdd..bea8ef0 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -4,7 +4,6 @@ function SongSelect(){ var _selectedSong = {title:'', folder:'', difficulty:''}; var _preview; var _preview_ended - var _preview_startLoad var _diffNames={ easy:"かんたん", normal:"ふつう", @@ -14,7 +13,7 @@ function SongSelect(){ this.startPreview = function(id, prvtime, first_open=true) { _this.endPreview(); - _preview_startLoad = +new Date + var startLoad = +new Date _preview_ended = false if(first_open){ snd.musicGain.fadeOut(0.4) @@ -28,21 +27,23 @@ function SongSelect(){ if(songObj.sound){ _preview = songObj.sound _preview.gain = snd.previewGain - this.previewLoaded(prvtime) + this.previewLoaded(startLoad, prvtime, first_open) }else{ snd.previewGain.load("/songs/" + id + "/main.mp3").then(sound => { if(!_preview_ended){ songObj.sound = sound _preview = sound - this.previewLoaded(prvtime) + this.previewLoaded(startLoad, prvtime, first_open) } }) } }; - this.previewLoaded = function(prvtime){ + this.previewLoaded = function(startLoad, prvtime, first_open){ var endLoad = +new Date - var delay = Math.max(1000 - Math.min(1000, endLoad - _preview_startLoad), 300) + var difference = endLoad - startLoad + var minDelay = first_open ? 1000 : 300 + var delay = minDelay - Math.min(minDelay, difference) _preview.playLoop(delay / 1000, false, prvtime / 1000) } @@ -142,7 +143,7 @@ function SongSelect(){ } this.createCode = function(){ - assets.sounds["bgm_songsel"].playLoop(0, false, 0, 1.4423958333333333) + assets.sounds["bgm_songsel"].playLoop(0.1, false, 0, 1.442, 3.506) assets.sounds["song-select"].play(0.2); var songElements = [0] diff --git a/public/src/js/soundbuffer.js b/public/src/js/soundbuffer.js index cd4279c..55879a1 100644 --- a/public/src/js/soundbuffer.js +++ b/public/src/js/soundbuffer.js @@ -124,7 +124,7 @@ class Sound{ playLoop(time, absolute, seek1, seek2, until){ time = this.convertTime(time, absolute) seek1 = seek1 || 0 - seek2 = seek2 || seek1 + seek2 = seek2 || 0 until = until || this.duration this.loop = { started: time + until - seek1, diff --git a/public/src/js/tutorial.js b/public/src/js/tutorial.js index 9b9ee2e..725d0f4 100644 --- a/public/src/js/tutorial.js +++ b/public/src/js/tutorial.js @@ -2,7 +2,7 @@ function Tutorial() { var _this = this; this.run = function() { - assets.sounds["bgm_setsume"].playLoop(0, false, 0, 1.0540416666666668) + assets.sounds["bgm_setsume"].playLoop(0.1, false, 0, 1.054, 16.054) $('#tutorial-end-button').click(function(){ assets.sounds["bgm_setsume"].stop();