summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-05-28 18:03:16 +0200
committerSergeanur <s.anureev@yandex.ua>2021-06-24 20:32:44 +0200
commitcacec36dd1dd6141986631ae22d6d40a64358a41 (patch)
tree4d9da021ceb5e0ce8ec78bc6bfe040b1bd809979 /src/audio
parentMake sampman stream functions default to stream 0 (diff)
downloadre3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar
re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar.gz
re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar.bz2
re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar.lz
re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar.xz
re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar.zst
re3-cacec36dd1dd6141986631ae22d6d40a64358a41.zip
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/AudioManager.cpp21
-rw-r--r--src/audio/AudioManager.h4
2 files changed, 23 insertions, 2 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 5312bfad..69126c23 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -41,6 +41,11 @@ cAudioManager::cAudioManager()
m_bFifthFrameFlag = FALSE;
m_bTimerJustReset = FALSE;
m_nTimer = 0;
+
+#ifdef FIX_BUGS
+ m_LogicalFrameCounter = 0;
+ m_bLogicalFrameUpdate = FALSE;
+#endif
}
cAudioManager::~cAudioManager()
@@ -100,6 +105,12 @@ cAudioManager::Terminate()
void
cAudioManager::Service()
{
+#ifdef FIX_BUGS
+ m_bLogicalFrameUpdate = m_LogicalFrameCounter != CTimer::GetLogicalFrameCounter();
+ if(m_bLogicalFrameUpdate)
+ m_LogicalFrameCounter = CTimer::GetLogicalFrameCounter();
+#endif
+
GenerateIntegerRandomNumberTable();
if (m_bTimerJustReset) {
ResetAudioLogicTimers(m_nTimer);
@@ -423,6 +434,9 @@ cAudioManager::IsAudioInitialised() const
void
cAudioManager::ServiceSoundEffects()
{
+#ifdef FIX_BUGS
+ if(m_bLogicalFrameUpdate)
+#endif
m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0;
if (m_nUserPause && !m_nPreviousUserPause) {
for (int32 i = 0; i < NUM_CHANNELS; i++)
@@ -712,9 +726,9 @@ cAudioManager::AddReleasingSounds()
}
if (!toProcess[i]) {
if (sample.m_nCounter <= 255 || !sample.m_nLoopsRemaining) {
- if (!sample.m_nReleasingVolumeDivider)
+ if (sample.m_nReleasingVolumeDivider == 0)
continue;
- if (!sample.m_nLoopCount) {
+ if (sample.m_nLoopCount == 0) {
if (sample.m_nVolumeChange == -1) {
sample.m_nVolumeChange = sample.m_nVolume / sample.m_nReleasingVolumeDivider;
if (sample.m_nVolumeChange <= 0)
@@ -726,6 +740,9 @@ cAudioManager::AddReleasingSounds()
}
sample.m_nVolume -= sample.m_nVolumeChange;
}
+#ifdef FIX_BUGS
+ if(m_bLogicalFrameUpdate)
+#endif
--sample.m_nReleasingVolumeDivider;
if (m_bFifthFrameFlag) {
if (sample.m_nReleasingVolumeModificator < 20)
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 70302745..dcd6c7c4 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -223,6 +223,10 @@ public:
uint8 m_nUserPause;
uint8 m_nPreviousUserPause;
uint32 m_FrameCounter;
+#ifdef FIX_BUGS
+ uint32 m_LogicalFrameCounter;
+ bool8 m_bLogicalFrameUpdate;
+#endif
cAudioManager();
~cAudioManager();