Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 8926041

Browse files
committed
Fix global pitch not resetting with Activity
Resolve #160
1 parent aea5154 commit 8926041

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Managers/PerformanceMan.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,23 @@ namespace RTE {
7272
}
7373
m_MSPFAverage /= m_MSPFs.size();
7474

75+
float pitch = 1.0F;
76+
7577
// Update the SimSpeed; if set to do one sim update per frame, adjust global sound pitch to match the ratio of sim time over real time.
7678
// TODO: This belongs in TimerMan so figure out where exactly to shove it in it.
7779
if (g_TimerMan.IsOneSimUpdatePerFrame()) {
7880
m_SimSpeed = g_TimerMan.GetDeltaTimeMS() / static_cast<float>(m_MSPFAverage);
7981

8082
// TODO: This should be built into the SimSpeed setter (which again, should be in TimerMan) so you can't screw it up.
81-
if (g_TimerMan.IsSimSpeedLimited() && m_SimSpeed > 1.0) { m_SimSpeed = 1.0; }
83+
if (g_TimerMan.IsSimSpeedLimited() && m_SimSpeed > 1.0F) { m_SimSpeed = 1.0F; }
8284

8385
// Soften the ratio of the pitch adjustment so it's not such an extreme effect on the audio
8486
// TODO: This coefficient should probably move to SettingsMan and be loaded from ini. That way this effect can be lessened or even turned off entirely by users. 0.35 is a good default value though.
85-
float pitch = m_SimSpeed + (1.0F - m_SimSpeed) * 0.35;
86-
g_AudioMan.SetGlobalPitch(pitch);
87+
pitch = m_SimSpeed + (1.0F - m_SimSpeed) * 0.35F;
8788
} else {
88-
m_SimSpeed = 1.0;
89+
m_SimSpeed = 1.0F;
8990
}
91+
g_AudioMan.SetGlobalPitch(pitch);
9092
}
9193

9294
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)