A few small audio changes

This commit is contained in:
Sergeanur 2021-08-20 14:28:18 +03:00
parent c168786b42
commit ef0b5f857d
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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