mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-09 19:25:10 +00:00
Fix rockers pitch bend (#789)
This commit is contained in:
parent
ac08cf44ad
commit
a322d48329
1 changed files with 11 additions and 4 deletions
|
@ -220,9 +220,8 @@ namespace HeavenStudio.Games.Scripts_Rockers
|
|||
if (bending || !strumming) return;
|
||||
bending = true;
|
||||
lastBendPitch = pitch;
|
||||
if (chordSound != null)
|
||||
{
|
||||
chordSound.BendUp(0.05f, SoundByte.GetPitchFromSemiTones(SoundByte.GetSemitonesFromPitch(chordSound.pitch, true) + pitch, true));
|
||||
if (chordSound != null) {
|
||||
chordSound.BendUp(0.05f, GetBentPitch(chordSound.pitch, pitch));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -230,7 +229,7 @@ namespace HeavenStudio.Games.Scripts_Rockers
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue