BTSDS: Piano does not pierce ears as much

This commit is contained in:
Jenny Crowe 2022-03-07 02:34:38 -07:00
parent c6f0da37a2
commit dd3bdaf87c
3 changed files with 11 additions and 7 deletions

View file

@ -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<BeatAction.Action>()
{

View file

@ -40,7 +40,7 @@ namespace RhythmHeavenMania.Util
FindJukebox().GetComponent<AudioSource>().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;

View file

@ -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>();
audioSource.clip = clip;
audioSource.pitch = pitch;
audioSource.volume = volume;
audioSource.loop = looping;
if (beat == -1 && !scheduled)