Merge pull request #791 from RHeavenStudio/cherry-pick-release_1_patches-a99a6f0380d3750c479c77de802d6a9748ba88ec

Fix Rockers pitch bend
This commit is contained in:
minenice55 2024-03-14 01:22:36 +00:00 committed by GitHub
commit aeb873d67f
1 changed files with 11 additions and 4 deletions

View File

@ -220,9 +220,8 @@ namespace HeavenStudio.Games.Scripts_Rockers
if (bending || !strumming) return; if (bending || !strumming) return;
bending = true; bending = true;
lastBendPitch = pitch; lastBendPitch = pitch;
if (chordSound != null) if (chordSound != null) {
{ chordSound.BendUp(0.05f, GetBentPitch(chordSound.pitch, pitch));
chordSound.BendUp(0.05f, SoundByte.GetPitchFromSemiTones(SoundByte.GetSemitonesFromPitch(chordSound.pitch, true) + pitch, true));
} }
else else
{ {
@ -230,7 +229,7 @@ namespace HeavenStudio.Games.Scripts_Rockers
{ {
if (stringSounds[i] != null) if (stringSounds[i] != null)
{ {
stringSounds[i].BendUp(0.05f, SoundByte.GetPitchFromSemiTones(SoundByte.GetSemitonesFromPitch(stringSounds[i].pitch, true) + pitch, true)); stringSounds[i].BendUp(0.05f, GetBentPitch(stringSounds[i].pitch, pitch));
} }
} }
} }
@ -299,6 +298,14 @@ namespace HeavenStudio.Games.Scripts_Rockers
{ {
anim.DoScaledAnimationAsync((JJ ? "JJ" : "") + name, time); anim.DoScaledAnimationAsync((JJ ? "JJ" : "") + name, time);
} }
private float GetBentPitch(float pitch, int bend)
{
float unscaledPitch = chordSound.pitch / Conductor.instance.musicSource.pitch;
float bendPitch = SoundByte.GetPitchFromSemiTones(bend, false);
return (unscaledPitch * bendPitch) * Conductor.instance.musicSource.pitch;
}
} }
} }