diff --git a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs index c69dd1c6..f3719ec3 100644 --- a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs +++ b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs @@ -188,7 +188,7 @@ namespace RhythmHeavenMania.Games.BuiltToScaleDS public void PlayPiano(float beat, float length, int semiTones) { var pianoPitch = Mathf.Pow(2f, (1f / 12f) * semiTones); - var pianoSource = Jukebox.PlayOneShotGame("builtToScaleDS/Piano", -1, pianoPitch, true); + var pianoSource = Jukebox.PlayOneShotGame("builtToScaleDS/Piano", -1, pianoPitch, 0.8f, true); BeatAction.New(gameObject, new List() { diff --git a/Assets/Scripts/Util/Jukebox.cs b/Assets/Scripts/Util/Jukebox.cs index 3dca5ccc..953a44ce 100644 --- a/Assets/Scripts/Util/Jukebox.cs +++ b/Assets/Scripts/Util/Jukebox.cs @@ -40,7 +40,7 @@ namespace RhythmHeavenMania.Util FindJukebox().GetComponent().volume = volume; } - public static AudioSource PlayOneShot(string name, float beat = -1, float pitch = 1f, bool looping = false) + public static AudioSource PlayOneShot(string name, float beat = -1, float pitch = 1f, float volume = 1f, bool looping = false) { GameObject oneShot = new GameObject("oneShot"); @@ -53,6 +53,7 @@ namespace RhythmHeavenMania.Util snd.clip = clip; snd.beat = beat; snd.pitch = pitch; + snd.volume = volume; snd.looping = looping; // snd.pitch = (clip.length / Conductor.instance.secPerBeat); @@ -61,7 +62,7 @@ namespace RhythmHeavenMania.Util return audioSource; } - public static AudioSource PlayOneShotScheduled(string name, double targetTime, float pitch = 1f, bool looping = false) + public static AudioSource PlayOneShotScheduled(string name, double targetTime, float pitch = 1f, float volume = 1f, bool looping = false) { GameObject oneShot = new GameObject("oneShotScheduled"); @@ -74,6 +75,7 @@ namespace RhythmHeavenMania.Util audioSource.clip = clip; snd.clip = clip; snd.pitch = pitch; + snd.volume = volume; snd.looping = looping; snd.scheduled = true; @@ -85,21 +87,21 @@ namespace RhythmHeavenMania.Util return audioSource; } - public static AudioSource PlayOneShotGame(string name, float beat = -1, float pitch = 1f, bool looping = false) + public static AudioSource PlayOneShotGame(string name, float beat = -1, float pitch = 1f, float volume = 1f, bool looping = false) { if (GameManager.instance.currentGame == name.Split('/')[0]) { - return PlayOneShot($"games/{name}", beat, pitch, looping); + return PlayOneShot($"games/{name}", beat, pitch, volume, looping); } return null; } - public static AudioSource PlayOneShotScheduledGame(string name, double targetTime, float pitch = 1f, bool looping = false) + public static AudioSource PlayOneShotScheduledGame(string name, double targetTime, float pitch = 1f, float volume = 1f, bool looping = false) { if (GameManager.instance.currentGame == name.Split('/')[0]) { - return PlayOneShotScheduled($"games/{name}", targetTime, pitch, looping); + return PlayOneShotScheduled($"games/{name}", targetTime, pitch, volume, looping); } return null; diff --git a/Assets/Scripts/Util/Sound.cs b/Assets/Scripts/Util/Sound.cs index 66f51a14..4af7351d 100644 --- a/Assets/Scripts/Util/Sound.cs +++ b/Assets/Scripts/Util/Sound.cs @@ -8,6 +8,7 @@ namespace RhythmHeavenMania.Util { public AudioClip clip; public float pitch = 1; + public float volume = 1; // For use with PlayOneShotScheduled public bool scheduled; @@ -31,6 +32,7 @@ namespace RhythmHeavenMania.Util audioSource = GetComponent(); audioSource.clip = clip; audioSource.pitch = pitch; + audioSource.volume = volume; audioSource.loop = looping; if (beat == -1 && !scheduled)