From 8518e0f62d7923e906393adf3f2c4a34563bbcd8 Mon Sep 17 00:00:00 2001 From: Nikita Vilunov Date: Tue, 29 Oct 2024 13:37:32 +0100 Subject: [PATCH] fix track gap and durochka sound level --- Assets/DurochkaLoop.mp3 | 4 ++-- Assets/DurochkaStart.mp3 | 4 ++-- MuzikaGromche/Plugin.cs | 24 ++++++++++++------------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Assets/DurochkaLoop.mp3 b/Assets/DurochkaLoop.mp3 index 8671508..1069909 100644 --- a/Assets/DurochkaLoop.mp3 +++ b/Assets/DurochkaLoop.mp3 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3b14d0747d5daba265e0123dea06b9835421a4650b69c620629388cb82c1ee3a -size 472358 +oid sha256:99a03cbc6b947d1c71120d5c05af2f7fe39e79d9f4599f69c1ce644dc7234e3a +size 463119 diff --git a/Assets/DurochkaStart.mp3 b/Assets/DurochkaStart.mp3 index c6ddb0b..6f0f55f 100644 --- a/Assets/DurochkaStart.mp3 +++ b/Assets/DurochkaStart.mp3 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51e1b09713487ca6ae462a03e9f5aa0368664ed90532c550784f12f2a19b41fb -size 979698 +oid sha256:b3f718dcd7837305e11dca97553923840e9cb36abe28b0fa1574d90df3de0be9 +size 893586 diff --git a/MuzikaGromche/Plugin.cs b/MuzikaGromche/Plugin.cs index 7145fbf..159cf2c 100644 --- a/MuzikaGromche/Plugin.cs +++ b/MuzikaGromche/Plugin.cs @@ -142,11 +142,8 @@ namespace MuzikaGromche // if just started winding up // then stop the default music... __instance.farAudio.Stop(); - __instance.farAudio.Pause(); - } - - if (__instance.currentBehaviourStateIndex is 1 && !__instance.farAudio.isPlaying) - { + __instance.creatureVoice.Stop(); + // ...and start modded music var seed = RoundManager.Instance.dungeonGenerator.Generator.ChosenSeed; var sha = SHA256.Create(); @@ -163,9 +160,11 @@ namespace MuzikaGromche Debug.Log($"Seed is {seed}, chosen track is {trackId} out of {Plugin.Tracks.Length} tracks"); Plugin.CurrentTrack = Plugin.Tracks[trackId]; __instance.popUpTimer = Plugin.CurrentTrack.WindUpTimer; - Debug.Log($"Playing start music: maxDistance: {__instance.farAudio.maxDistance}, minDistance: {__instance.farAudio.minDistance}, volume: {__instance.farAudio.volume}, spread: {__instance.farAudio.spread}"); __instance.farAudio.maxDistance = 150; - __instance.farAudio.PlayOneShot(Plugin.CurrentTrack.LoadedStart); + __instance.farAudio.clip = Plugin.CurrentTrack.LoadedStart; + __instance.farAudio.loop = false; + Debug.Log($"Playing start music: maxDistance: {__instance.farAudio.maxDistance}, minDistance: {__instance.farAudio.minDistance}, volume: {__instance.farAudio.volume}, spread: {__instance.farAudio.spread}"); + __instance.farAudio.Play(); } if (__instance.currentBehaviourStateIndex is 2 && __state.prevStateindex != 2) @@ -176,8 +175,6 @@ namespace MuzikaGromche __instance.StopCoroutine(Plugin.JesterLightSwitching); Plugin.JesterLightSwitching = null; } - - Plugin.JesterLightSwitching = __instance.StartCoroutine(rotateColors()); } @@ -193,12 +190,15 @@ namespace MuzikaGromche } } - if (__instance.currentBehaviourStateIndex is 2 && !__instance.creatureVoice.isPlaying && !__instance.farAudio.isPlaying) + if (__instance.currentBehaviourStateIndex is 2 && !__instance.creatureVoice.isPlaying) { - Debug.Log($"Playing loop music: maxDistance: {__instance.creatureVoice.maxDistance}, minDistance: {__instance.creatureVoice.minDistance}, volume: {__instance.creatureVoice.volume}, spread: {__instance.creatureVoice.spread}"); __instance.creatureVoice.maxDistance = 150; __instance.creatureVoice.clip = Plugin.CurrentTrack.LoadedLoop; - __instance.creatureVoice.Play(); + var time = __instance.farAudio.time; + var delay = Plugin.CurrentTrack.LoadedStart.length - time; + Debug.Log($"Start length: {Plugin.CurrentTrack.LoadedStart.length}; played time: {time}"); + Debug.Log($"Playing loop music: maxDistance: {__instance.creatureVoice.maxDistance}, minDistance: {__instance.creatureVoice.minDistance}, volume: {__instance.creatureVoice.volume}, spread: {__instance.creatureVoice.spread}, in seconds: {delay}"); + __instance.creatureVoice.PlayDelayed(delay); } } }