From 913c0787ef784932c6bf74e51af091763f5b329d Mon Sep 17 00:00:00 2001 From: Bui Date: Mon, 4 Feb 2019 09:14:42 +0000 Subject: [PATCH 1/3] audio overhaul --- public/src/js/about.js | 2 +- public/src/js/assets.js | 122 +++++++++++++++++------------------ public/src/js/controller.js | 6 +- public/src/js/game.js | 10 +-- public/src/js/importsongs.js | 2 +- public/src/js/keyboard.js | 6 +- public/src/js/loadsong.js | 6 +- public/src/js/mekadon.js | 2 +- public/src/js/scoresheet.js | 16 ++--- public/src/js/session.js | 2 +- public/src/js/songselect.js | 38 +++++------ public/src/js/titlescreen.js | 6 +- public/src/js/tutorial.js | 2 +- public/src/js/view.js | 4 +- 14 files changed, 112 insertions(+), 112 deletions(-) diff --git a/public/src/js/about.js b/public/src/js/about.js index 15d54f4..8c9f2e2 100644 --- a/public/src/js/about.js +++ b/public/src/js/about.js @@ -53,7 +53,7 @@ touched = true } this.clean() - assets.sounds["don"].play() + assets.sounds["se_don"].play() localStorage.setItem("tutorial", "true") setTimeout(() => { new SongSelect("about", false, touched) diff --git a/public/src/js/assets.js b/public/src/js/assets.js index 589e36e..a5e74f0 100644 --- a/public/src/js/assets.js +++ b/public/src/js/assets.js @@ -80,76 +80,76 @@ var assets = { "results_tetsuohana.png" ], "audioSfx": [ - "don.wav", - "ka.wav", - "start.wav", + "se_cancel.wav", + "se_don.wav", + "se_ka.wav", + "se_pause.wav", - "combo-50-meka.wav", - "combo-100-meka.wav", - "combo-200-meka.wav", - "combo-300-meka.wav", - "combo-400-meka.wav", - "combo-500-meka.wav", - "combo-600-meka.wav", - "combo-700-meka.wav", - "combo-800-meka.wav", - "combo-900-meka.wav", - "combo-1000-meka.wav", - "combo-1100-meka.wav", - "combo-1200-meka.wav", - "combo-1300-meka.wav", - "combo-1400-meka.wav", - "combo-over1500-meka.wav", - "fullcombo-meka.wav", + "v_combo_50_meka.wav", + "v_combo_100_meka.wav", + "v_combo_200_meka.wav", + "v_combo_300_meka.wav", + "v_combo_400_meka.wav", + "v_combo_500_meka.wav", + "v_combo_600_meka.wav", + "v_combo_700_meka.wav", + "v_combo_800_meka.wav", + "v_combo_900_meka.wav", + "v_combo_1000_meka.wav", + "v_combo_1100_meka.wav", + "v_combo_1200_meka.wav", + "v_combo_1300_meka.wav", + "v_combo_1400_meka.wav", + "v_combo_over1500_meka.wav", - "song-select.wav", - "title.ogg", - "pause.wav", - "cancel.wav", - "results.ogg", - "sanka.wav" + "v_fullcombo_meka.wav", + "v_renda_meka.wav", + "v_results.wav", + "v_sanka.wav", + "v_songsel.wav", + "v_start.wav", + "v_title.wav" ], "audioSfxLR": [ - "note_don.ogg", - "note_ka.ogg", - "balloon.ogg", - "renda.ogg", - "renda-meka.ogg", - - "combo-50.wav", - "combo-100.wav", - "combo-200.wav", - "combo-300.wav", - "combo-400.wav", - "combo-500.wav", - "combo-600.wav", - "combo-700.wav", - "combo-800.wav", - "combo-900.wav", - "combo-1000.wav", - "combo-1100.wav", - "combo-1200.wav", - "combo-1300.wav", - "combo-1400.wav", - "combo-over1500.wav", + "neiro_1_don.wav", + "neiro_1_ka.wav", + + "se_balloon.wav", + "se_gameclear.wav", + "se_gamefail.wav", + "se_gamefullcombo.wav", + "se_results_countup.wav", + "se_results_crown.wav", + + "v_combo_50.wav", + "v_combo_100.wav", + "v_combo_200.wav", + "v_combo_300.wav", + "v_combo_400.wav", + "v_combo_500.wav", + "v_combo_600.wav", + "v_combo_700.wav", + "v_combo_800.wav", + "v_combo_900.wav", + "v_combo_1000.wav", + "v_combo_1100.wav", + "v_combo_1200.wav", + "v_combo_1300.wav", + "v_combo_1400.wav", + "v_combo_over1500.wav", - "fullcombo.wav", - "gamefullcombo.wav", - "gameclear.wav", - "gamefail.wav", - - "results_fullcombo.ogg", - "results_fullcombo2.ogg", - "results_crown.ogg", - "results_countup.wav" + "v_fullcombo.wav", + "v_renda.wav", + "v_results_fullcombo.wav", + "v_results_fullcombo2.wav" ], "audioSfxLoud": [ - "diffsel.wav" + "v_diffsel.wav" ], "audioMusic": [ - "bgm_songsel.ogg", - "bgm_result.ogg", - "bgm_setsume.ogg" + "bgm_songsel.mp3", + "bgm_result.mp3", + "bgm_setsume.mp3" ], "audioOgg": "note_ka.ogg", "fonts": [ diff --git a/public/src/js/controller.js b/public/src/js/controller.js index 793997f..ef7dca3 100644 --- a/public/src/js/controller.js +++ b/public/src/js/controller.js @@ -125,14 +125,14 @@ class Controller{ if(Math.round(score.gauge / 2) - 1 >= 25){ if(score.bad === 0){ vp = "fullcombo" - this.playSoundMeka("fullcombo", 1.350) + this.playSoundMeka("v_fullcombo", 1.350) }else{ vp = "clear" } }else{ vp = "fail" } - this.playSound("game" + vp) + this.playSound("se_game" + vp) } displayResults(){ if(this.multiplayer !== 2){ @@ -167,7 +167,7 @@ class Controller{ playSoundMeka(soundID, time){ var meka = "" if(this.autoPlayEnabled && !this.multiplayer){ - meka = "-meka" + meka = "_meka" } this.playSound(soundID + meka, time) } diff --git a/public/src/js/game.js b/public/src/js/game.js index 75ad645..2df56d0 100644 --- a/public/src/js/game.js +++ b/public/src/js/game.js @@ -83,8 +83,8 @@ class Game{ if(drumrollNotes && !circle.rendaPlayed && ms < endTime){ circle.rendaPlayed = true if(this.rules.difficulty === "easy"){ - assets.sounds["renda" + this.controller.snd].stop() - this.controller.playSoundMeka("renda") + assets.sounds["v_renda" + this.controller.snd].stop() + this.controller.playSoundMeka("v_renda") } } if(!circle.beatMSCopied){ @@ -353,7 +353,7 @@ class Game{ } togglePause(){ if(!this.paused){ - assets.sounds["pause"].play() + assets.sounds["se_pause"].play() this.paused = true this.latestDate = Date.now() this.mainAsset.stop() @@ -363,7 +363,7 @@ class Game{ this.view.lastMousemove = this.view.getMS() this.view.cursorHidden = false }else{ - assets.sounds["cancel"].play() + assets.sounds["se_cancel"].play() this.paused = false var currentDate = Date.now() this.startDate += currentDate - this.latestDate @@ -422,7 +422,7 @@ class Game{ this.globalScore.maxCombo = this.combo } if(this.combo === 50 || this.combo > 0 && this.combo % 100 === 0 && this.combo < 1500 || this.combo > 0 && this.combo % 500 === 0){ - this.controller.playSoundMeka("combo-" + (this.combo <= 1400 ? this.combo : "over1500")) + this.controller.playSoundMeka("v_combo_" + (this.combo <= 1400 ? this.combo : "over1500")) } this.view.updateCombo(this.combo) } diff --git a/public/src/js/importsongs.js b/public/src/js/importsongs.js index a6c194b..bf669ea 100644 --- a/public/src/js/importsongs.js +++ b/public/src/js/importsongs.js @@ -389,7 +389,7 @@ assets.songs = this.songs assets.customSongs = true assets.customSelected = 0 - assets.sounds["don"].play() + assets.sounds["se_don"].play() this.songSelect.clean() setTimeout(() => { loader.screen.removeChild(this.loaderDiv) diff --git a/public/src/js/keyboard.js b/public/src/js/keyboard.js index 977fdde..6d938ac 100644 --- a/public/src/js/keyboard.js +++ b/public/src/js/keyboard.js @@ -159,7 +159,7 @@ class Keyboard{ this.checkKey(this.kbd["don_l"], "menu", moveMenuConfirm) this.checkKey(this.kbd["don_r"], "menu", moveMenuConfirm) if(moveMenu && this.game.isPaused()){ - assets.sounds["ka"].play() + assets.sounds["se_ka"].play() this.controller.view.pauseMove(moveMenu) } } @@ -190,9 +190,9 @@ class Keyboard{ && circle.getType() === "balloon" && circle.requiredHits - circle.timesHit <= 1 ){ - this.controller.playSound("balloon") + this.controller.playSound("se_balloon") }else{ - this.controller.playSound("note_" + sound) + this.controller.playSound("neiro_1_" + sound) } this.keyTime[sound] = this.keyTime[keyCode] }) diff --git a/public/src/js/loadsong.js b/public/src/js/loadsong.js index 3669604..8bf1da4 100644 --- a/public/src/js/loadsong.js +++ b/public/src/js/loadsong.js @@ -20,7 +20,7 @@ class LoadSong{ var song = this.selectedSong var id = song.folder var promises = [] - assets.sounds["start"].play() + assets.sounds["v_start"].play() song.songBg = this.randInt(1, 5) song.songStage = this.randInt(1, 3) @@ -263,7 +263,7 @@ class LoadSong{ p2.send("gamestart") }else{ if(!repeat){ - assets.sounds["sanka"].play() + assets.sounds["v_sanka"].play() } setTimeout(() => { this.startMultiplayer(true) @@ -279,7 +279,7 @@ class LoadSong{ event.preventDefault() } p2.send("leave") - assets.sounds["don"].play() + assets.sounds["se_don"].play() this.cancelButton.style.pointerEvents = "none" } clean(){ diff --git a/public/src/js/mekadon.js b/public/src/js/mekadon.js index eaadde8..cca80e2 100644 --- a/public/src/js/mekadon.js +++ b/public/src/js/mekadon.js @@ -84,7 +84,7 @@ class Mekadon{ } if(type === "balloon"){ if(circle.requiredHits == 1){ - assets.sounds["balloon"].play() + assets.sounds["se_balloon"].play() } this.game.checkBalloon(circle) }else if(type === "drumroll" || type === "daiDrumroll"){ diff --git a/public/src/js/scoresheet.js b/public/src/js/scoresheet.js index c90381f..11676a7 100644 --- a/public/src/js/scoresheet.js +++ b/public/src/js/scoresheet.js @@ -47,7 +47,7 @@ class Scoresheet{ this.redrawBind = this.redraw.bind(this) this.redraw() - assets.sounds["results"].play() + assets.sounds["v_results"].play() assets.sounds["bgm_result"].playLoop(3, false, 0, 0.847, 17.689) if(p2.session){ @@ -106,7 +106,7 @@ class Scoresheet{ if(!p2.session){ this.state.screen = "scoresShown" this.state.screenMS = this.getMS() - assets.sounds["note_don"].play() + assets.sounds["neiro_1_don"].play() } } toSongsel(fromP2){ @@ -115,7 +115,7 @@ class Scoresheet{ this.state.screen = "fadeOut" this.state.screenMS = this.getMS() if(!fromP2){ - assets.sounds["note_don"].play() + assets.sounds["neiro_1_don"].play() } } } @@ -646,12 +646,12 @@ class Scoresheet{ if(this.state.screen === "fadeIn" && elapsed >= 1200 && !this.state["fullcomboPlayed" + p]){ this.state["fullcomboPlayed" + p] = true if(crownType === "gold"){ - this.playSound("results_fullcombo" + (p === 1 ? "2" : ""), p) + this.playSound("v_results_fullcombo" + (p === 1 ? "2" : ""), p) } } if(this.state.screen === "fadeIn" && elapsed >= 1650 && !this.state["crownPlayed" + p]){ this.state["crownPlayed" + p] = true - this.playSound("results_crown", p) + this.playSound("se_results_crown", p) } this.draw.crown({ ctx: ctx, @@ -759,13 +759,13 @@ class Scoresheet{ if(this.state.countupShown){ if(!this.state["countup" + p]){ this.state["countup" + p] = true - this.loopSound("results_countup", p, [0.1, false, 0, 0, 0.07]) + this.loopSound("se_results_countup", p, [0.1, false, 0, 0, 0.07]) } }else if(this.state["countup" + p]){ this.state["countup" + p] = false - this.stopSound("results_countup", p) + this.stopSound("se_results_countup", p) if(this.state.screen === "fadeIn"){ - this.playSound("note_don", p) + this.playSound("neiro_1_don", p) } } diff --git a/public/src/js/session.js b/public/src/js/session.js index c660c92..fb967c9 100644 --- a/public/src/js/session.js +++ b/public/src/js/session.js @@ -57,7 +57,7 @@ class Session{ event.preventDefault() } this.clean() - assets.sounds["don"].play() + assets.sounds["se_don"].play() setTimeout(() => { new SongSelect(false, false, this.touchEnabled) }, 500) diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 9ca2234..f8462be 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -229,7 +229,7 @@ class SongSelect{ }else if((!p2.session || fadeIn) && "selectedSong" in localStorage){ this.selectedSong = Math.min(Math.max(0, localStorage["selectedSong"] |0), this.songs.length - 1) } - assets.sounds["song-select"].play() + assets.sounds["v_songsel"].play() snd.musicGain.fadeOut() this.playBgm(false) } @@ -420,7 +420,7 @@ class SongSelect{ this.toOptions(1) }else if(moveBy === this.diffOptions.length + 4){ this.state.ura = !this.state.ura - assets.sounds["ka"].play() + assets.sounds["se_ka"].play() if(this.selectedDiff === this.diffOptions.length + 4 && !this.state.ura){ this.state.move = -1 } @@ -546,7 +546,7 @@ class SongSelect{ var soundsDelay = Math.abs((scroll + resize) / moveBy) for(var i = 0; i < Math.abs(moveBy) - 1; i++){ - assets.sounds["ka"].play((resize + i * soundsDelay) / 1000) + assets.sounds["se_ka"].play((resize + i * soundsDelay) / 1000) } this.pointer(false) } @@ -556,7 +556,7 @@ class SongSelect{ this.state.move = moveBy this.state.moveMS = this.getMS() - 500 this.state.locked = 1 - assets.sounds["ka"].play() + assets.sounds["se_ka"].play() } } @@ -587,14 +587,14 @@ class SongSelect{ this.selectedDiff = this.diffOptions.length + 3 } - assets.sounds["don"].play() - assets.sounds["song-select"].stop() - assets.sounds["diffsel"].play(0.3) + assets.sounds["se_don"].play() + assets.sounds["v_songsel"].stop() + assets.sounds["v_diffsel"].play(0.3) }else if(currentSong.action === "back"){ this.clean() this.toTitleScreen() }else if(currentSong.action === "random"){ - assets.sounds["don"].play() + assets.sounds["se_don"].play() this.state.locked = true do{ var i = Math.floor(Math.random() * this.songs.length) @@ -627,15 +627,15 @@ class SongSelect{ this.state.locked = true this.state.moveHover = null - assets.sounds["diffsel"].stop() - assets.sounds["cancel"].play() + assets.sounds["v_diffsel"].stop() + assets.sounds["se_cancel"].play() } } toLoadSong(difficulty, shift, ctrl, touch){ this.clean() var selectedSong = this.songs[this.selectedSong] - assets.sounds["diffsel"].stop() - assets.sounds["don"].play() + assets.sounds["v_diffsel"].stop() + assets.sounds["se_don"].play() try{ if(assets.customSongs){ @@ -673,7 +673,7 @@ class SongSelect{ } toOptions(moveBy){ if(!p2.session){ - assets.sounds["ka"].play() + assets.sounds["se_ka"].play() this.selectedDiff = 1 do{ this.state.options = this.mod(this.optionsList.length, this.state.options + moveBy) @@ -682,7 +682,7 @@ class SongSelect{ } toTitleScreen(){ if(!p2.session){ - assets.sounds["cancel"].play() + assets.sounds["se_cancel"].play() this.clean() setTimeout(() => { new Titlescreen() @@ -690,14 +690,14 @@ class SongSelect{ } } toTutorial(){ - assets.sounds["don"].play() + assets.sounds["se_don"].play() this.clean() setTimeout(() => { new Tutorial(true) }, 500) } toAbout(){ - assets.sounds["don"].play() + assets.sounds["se_don"].play() this.clean() setTimeout(() => { new About(this.touchEnabled) @@ -712,7 +712,7 @@ class SongSelect{ }else{ localStorage["selectedSong"] = this.selectedSong - assets.sounds["don"].play() + assets.sounds["se_don"].play() this.clean() setTimeout(() => { new Session(this.touchEnabled) @@ -723,7 +723,7 @@ class SongSelect{ if(assets.customSongs){ assets.customSongs = false assets.songs = assets.songsDefault - assets.sounds["don"].play() + assets.sounds["se_don"].play() this.clean() setTimeout(() => { new SongSelect("browse", false, this.touchEnabled) @@ -951,7 +951,7 @@ class SongSelect{ var scroll = resize2 - resize - scrollDelay * 2 var elapsed = ms - this.state.moveMS if(this.state.move && ms > this.state.moveMS + resize2 - scrollDelay){ - assets.sounds["ka"].play() + assets.sounds["se_ka"].play() this.selectedSong = this.mod(this.songs.length, this.selectedSong + this.state.move) this.state.move = 0 this.state.locked = 2 diff --git a/public/src/js/titlescreen.js b/public/src/js/titlescreen.js index 0b3f545..9f7c4b5 100644 --- a/public/src/js/titlescreen.js +++ b/public/src/js/titlescreen.js @@ -19,7 +19,7 @@ class Titlescreen{ pageEvents.add(this.titleScreen, ["mousedown", "touchstart"], this.onPressed.bind(this)) pageEvents.add(this.langDropdown, "change", this.langChange.bind(this)) - assets.sounds["title"].play() + assets.sounds["v_title"].play() this.gamepad = new Gamepad({ "13": ["a", "b", "x", "y", "start", "ls", "rs"] }, pressed => { @@ -59,7 +59,7 @@ class Titlescreen{ } this.titleScreen.style.cursor = "auto" this.clean() - assets.sounds["don"].play() + assets.sounds["se_don"].play() this.goNext() } goNext(fromP2){ @@ -133,7 +133,7 @@ class Titlescreen{ clean(){ this.gamepad.clean() this.logo.clean() - assets.sounds["title"].stop() + assets.sounds["v_title"].stop() pageEvents.keyRemove(this, "all") pageEvents.remove(this.titleScreen, ["mousedown", "touchstart"]) pageEvents.remove(this.langDropdown, "change") diff --git a/public/src/js/tutorial.js b/public/src/js/tutorial.js index f3f2697..7de7e31 100644 --- a/public/src/js/tutorial.js +++ b/public/src/js/tutorial.js @@ -63,7 +63,7 @@ class Tutorial{ touched = true } this.clean() - assets.sounds["don"].play() + assets.sounds["se_don"].play() localStorage.setItem("tutorial", "true") setTimeout(() => { new SongSelect(this.fromSongSel ? "tutorial" : false, false, touched) diff --git a/public/src/js/view.js b/public/src/js/view.js index 81743da..61513d0 100644 --- a/public/src/js/view.js +++ b/public/src/js/view.js @@ -1630,10 +1630,10 @@ } switch(pos){ case 1: - assets.sounds["don"].play() + assets.sounds["se_don"].play() return this.controller.restartSong() case 2: - assets.sounds["don"].play() + assets.sounds["se_don"].play() return this.controller.songSelection() default: return this.controller.togglePause()