summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-08-20 13:28:18 +0200
committerSergeanur <s.anureev@yandex.ua>2021-08-20 13:28:18 +0200
commitef0b5f857db7b58a9bea62c68e89e17f45c0a0de (patch)
treef6dc301c9943146cd1d5c97cd06d73e1767cc147 /src
parentAudio refactoring: (diff)
downloadre3-ef0b5f857db7b58a9bea62c68e89e17f45c0a0de.tar
re3-ef0b5f857db7b58a9bea62c68e89e17f45c0a0de.tar.gz
re3-ef0b5f857db7b58a9bea62c68e89e17f45c0a0de.tar.bz2
re3-ef0b5f857db7b58a9bea62c68e89e17f45c0a0de.tar.lz
re3-ef0b5f857db7b58a9bea62c68e89e17f45c0a0de.tar.xz
re3-ef0b5f857db7b58a9bea62c68e89e17f45c0a0de.tar.zst
re3-ef0b5f857db7b58a9bea62c68e89e17f45c0a0de.zip
Diffstat (limited to 'src')
-rw-r--r--src/audio/AudioManager.cpp10
-rw-r--r--src/audio/AudioManager.h4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 1df4681c..425a897d 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -1113,12 +1113,12 @@ cAudioManager::AdjustSamplesVolume()
}
uint8
-cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist)
+cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float maxDistance, float distance)
{
- float quatIntensity = intensity / 4.0f;
- float diffIntensity = intensity - quatIntensity;
- if (dist > diffIntensity)
- return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity;
+ float minDistance = maxDistance / 4.0f;
+ float diffDistance = maxDistance - minDistance;
+ if (distance > diffDistance)
+ return (minDistance - (distance - diffDistance)) * (float)emittingVolume / minDistance;
return emittingVolume;
}
#endif
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 662e929e..efff4f39 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -59,7 +59,7 @@ public:
// Default value is -3 for whatever reason
#endif
uint32 m_nFinalPriority; // Actual value used to compare priority, calculated using volume and m_nPriority. Lesser value means higher priority
- int8 m_nVolumeChange; // How much m_nVolume should reduce per each frame. Has no effect with EXTERNAL_3D_SOUND
+ int8 m_nVolumeChange; // How much m_nVolume should reduce per each frame.
};
VALIDATE_SIZE(tSound, 92);
@@ -319,7 +319,7 @@ public:
#ifdef EXTERNAL_3D_SOUND // actually must have been && AUDIO_MSS as well
void AdjustSamplesVolume();
- uint8 ComputeEmittingVolume(uint8 emittingVolume, float maxDistance, float dist);
+ uint8 ComputeEmittingVolume(uint8 emittingVolume, float maxDistance, float distance);
#endif
// audio logic