mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-22 17:19:15 +01:00
Fix cut off sfx on high framerates
This commit is contained in:
parent
f2390deaa9
commit
cacec36dd1
@ -41,6 +41,11 @@ cAudioManager::cAudioManager()
|
|||||||
m_bFifthFrameFlag = FALSE;
|
m_bFifthFrameFlag = FALSE;
|
||||||
m_bTimerJustReset = FALSE;
|
m_bTimerJustReset = FALSE;
|
||||||
m_nTimer = 0;
|
m_nTimer = 0;
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
m_LogicalFrameCounter = 0;
|
||||||
|
m_bLogicalFrameUpdate = FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cAudioManager::~cAudioManager()
|
cAudioManager::~cAudioManager()
|
||||||
@ -100,6 +105,12 @@ cAudioManager::Terminate()
|
|||||||
void
|
void
|
||||||
cAudioManager::Service()
|
cAudioManager::Service()
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
m_bLogicalFrameUpdate = m_LogicalFrameCounter != CTimer::GetLogicalFrameCounter();
|
||||||
|
if(m_bLogicalFrameUpdate)
|
||||||
|
m_LogicalFrameCounter = CTimer::GetLogicalFrameCounter();
|
||||||
|
#endif
|
||||||
|
|
||||||
GenerateIntegerRandomNumberTable();
|
GenerateIntegerRandomNumberTable();
|
||||||
if (m_bTimerJustReset) {
|
if (m_bTimerJustReset) {
|
||||||
ResetAudioLogicTimers(m_nTimer);
|
ResetAudioLogicTimers(m_nTimer);
|
||||||
@ -423,6 +434,9 @@ cAudioManager::IsAudioInitialised() const
|
|||||||
void
|
void
|
||||||
cAudioManager::ServiceSoundEffects()
|
cAudioManager::ServiceSoundEffects()
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if(m_bLogicalFrameUpdate)
|
||||||
|
#endif
|
||||||
m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0;
|
m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0;
|
||||||
if (m_nUserPause && !m_nPreviousUserPause) {
|
if (m_nUserPause && !m_nPreviousUserPause) {
|
||||||
for (int32 i = 0; i < NUM_CHANNELS; i++)
|
for (int32 i = 0; i < NUM_CHANNELS; i++)
|
||||||
@ -712,9 +726,9 @@ cAudioManager::AddReleasingSounds()
|
|||||||
}
|
}
|
||||||
if (!toProcess[i]) {
|
if (!toProcess[i]) {
|
||||||
if (sample.m_nCounter <= 255 || !sample.m_nLoopsRemaining) {
|
if (sample.m_nCounter <= 255 || !sample.m_nLoopsRemaining) {
|
||||||
if (!sample.m_nReleasingVolumeDivider)
|
if (sample.m_nReleasingVolumeDivider == 0)
|
||||||
continue;
|
continue;
|
||||||
if (!sample.m_nLoopCount) {
|
if (sample.m_nLoopCount == 0) {
|
||||||
if (sample.m_nVolumeChange == -1) {
|
if (sample.m_nVolumeChange == -1) {
|
||||||
sample.m_nVolumeChange = sample.m_nVolume / sample.m_nReleasingVolumeDivider;
|
sample.m_nVolumeChange = sample.m_nVolume / sample.m_nReleasingVolumeDivider;
|
||||||
if (sample.m_nVolumeChange <= 0)
|
if (sample.m_nVolumeChange <= 0)
|
||||||
@ -726,6 +740,9 @@ cAudioManager::AddReleasingSounds()
|
|||||||
}
|
}
|
||||||
sample.m_nVolume -= sample.m_nVolumeChange;
|
sample.m_nVolume -= sample.m_nVolumeChange;
|
||||||
}
|
}
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if(m_bLogicalFrameUpdate)
|
||||||
|
#endif
|
||||||
--sample.m_nReleasingVolumeDivider;
|
--sample.m_nReleasingVolumeDivider;
|
||||||
if (m_bFifthFrameFlag) {
|
if (m_bFifthFrameFlag) {
|
||||||
if (sample.m_nReleasingVolumeModificator < 20)
|
if (sample.m_nReleasingVolumeModificator < 20)
|
||||||
|
@ -223,6 +223,10 @@ public:
|
|||||||
uint8 m_nUserPause;
|
uint8 m_nUserPause;
|
||||||
uint8 m_nPreviousUserPause;
|
uint8 m_nPreviousUserPause;
|
||||||
uint32 m_FrameCounter;
|
uint32 m_FrameCounter;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
uint32 m_LogicalFrameCounter;
|
||||||
|
bool8 m_bLogicalFrameUpdate;
|
||||||
|
#endif
|
||||||
|
|
||||||
cAudioManager();
|
cAudioManager();
|
||||||
~cAudioManager();
|
~cAudioManager();
|
||||||
|
@ -16,6 +16,9 @@ float CTimer::ms_fTimeStep;
|
|||||||
float CTimer::ms_fTimeStepNonClipped;
|
float CTimer::ms_fTimeStepNonClipped;
|
||||||
bool CTimer::m_UserPause;
|
bool CTimer::m_UserPause;
|
||||||
bool CTimer::m_CodePause;
|
bool CTimer::m_CodePause;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
uint32 CTimer::m_LogicalFrameCounter;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32 _nCyclesPerMS = 1;
|
uint32 _nCyclesPerMS = 1;
|
||||||
|
|
||||||
@ -49,6 +52,9 @@ void CTimer::Initialise(void)
|
|||||||
m_snTimeInMillisecondsNonClipped = 0;
|
m_snTimeInMillisecondsNonClipped = 0;
|
||||||
m_snPreviousTimeInMilliseconds = 0;
|
m_snPreviousTimeInMilliseconds = 0;
|
||||||
m_snTimeInMilliseconds = 1;
|
m_snTimeInMilliseconds = 1;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
m_LogicalFrameCounter = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
LARGE_INTEGER perfFreq;
|
LARGE_INTEGER perfFreq;
|
||||||
@ -102,6 +108,15 @@ void CTimer::Update(void)
|
|||||||
#endif
|
#endif
|
||||||
frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
|
frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
static double frameTimeLogical = 0.0;
|
||||||
|
frameTimeLogical += ((double)updInCycles / (double)_nCyclesPerMS);
|
||||||
|
while (frameTimeLogical >= 1000.0 / 30.0) {
|
||||||
|
frameTimeLogical -= 1000.0 / 30.0;
|
||||||
|
m_LogicalFrameCounter++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
||||||
|
|
||||||
if ( GetIsPaused() )
|
if ( GetIsPaused() )
|
||||||
@ -126,6 +141,15 @@ void CTimer::Update(void)
|
|||||||
#endif
|
#endif
|
||||||
frameTime = (double)updInMs * ms_fTimeScale;
|
frameTime = (double)updInMs * ms_fTimeScale;
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
static double frameTimeLogical = 0.0;
|
||||||
|
frameTimeLogical += (double)updInMs;
|
||||||
|
while(frameTimeLogical >= 1000.0 / 30.0) {
|
||||||
|
frameTimeLogical -= 1000.0 / 30.0;
|
||||||
|
m_LogicalFrameCounter++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
oldPcTimer = timer;
|
oldPcTimer = timer;
|
||||||
|
|
||||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
||||||
|
@ -11,6 +11,9 @@ class CTimer
|
|||||||
static float ms_fTimeScale;
|
static float ms_fTimeScale;
|
||||||
static float ms_fTimeStep;
|
static float ms_fTimeStep;
|
||||||
static float ms_fTimeStepNonClipped;
|
static float ms_fTimeStepNonClipped;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
static uint32 m_LogicalFrameCounter;
|
||||||
|
#endif
|
||||||
public:
|
public:
|
||||||
static bool m_UserPause;
|
static bool m_UserPause;
|
||||||
static bool m_CodePause;
|
static bool m_CodePause;
|
||||||
@ -61,6 +64,7 @@ public:
|
|||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; }
|
static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; }
|
||||||
static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); }
|
static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); }
|
||||||
|
static uint32 GetLogicalFrameCounter(void) { return m_LogicalFrameCounter; }
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user