summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-08-12 14:01:58 +0200
committerSergeanur <s.anureev@yandex.ua>2021-08-12 14:01:58 +0200
commit8759c2edf0f4bbd850b1837d1e571f5326792a2a (patch)
tree66f2e2c41a8c18390761bd3997deaa779deba4e5 /src
parentRefactor cAudioManager::ProcessActiveQueues, fix doppler effect (diff)
downloadre3-8759c2edf0f4bbd850b1837d1e571f5326792a2a.tar
re3-8759c2edf0f4bbd850b1837d1e571f5326792a2a.tar.gz
re3-8759c2edf0f4bbd850b1837d1e571f5326792a2a.tar.bz2
re3-8759c2edf0f4bbd850b1837d1e571f5326792a2a.tar.lz
re3-8759c2edf0f4bbd850b1837d1e571f5326792a2a.tar.xz
re3-8759c2edf0f4bbd850b1837d1e571f5326792a2a.tar.zst
re3-8759c2edf0f4bbd850b1837d1e571f5326792a2a.zip
Diffstat (limited to 'src')
-rw-r--r--src/audio/AudioLogic.cpp2
-rw-r--r--src/audio/AudioManager.cpp28
2 files changed, 15 insertions, 15 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index cf54ce53..043b3941 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -1367,7 +1367,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
#ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 85);
SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z);
- SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.f, 12.5f);
+ SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 50.0f * 0.25f);
#else
SampleManager.SetChannelVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, ComputeVolume(85, 50.0f, m_sQueueSample.m_fDistance));
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 8063cfd6..6bd51fa6 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -546,7 +546,7 @@ cAudioManager::ComputePan(float dist, CVector *vec)
index = Min(63, ABS(index));
if (vec->x > 0.f)
- return Max(20, 63 - PanTable[index]);
+ return Max(20, 63 - (int8)PanTable[index]);
return Min(107, PanTable[index] + 63);
}
@@ -820,10 +820,10 @@ cAudioManager::ProcessActiveQueues()
m_asActiveSamples[i].m_bIsProcessed = FALSE;
}
- for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; ++i) {
+ for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
if (sample.m_nSampleIndex != NO_SAMPLE) {
- for (int32 j = 0; j < m_nActiveSamples; ++j) {
+ for (int32 j = 0; j < m_nActiveSamples; j++) {
if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex && sample.m_nCounter == m_asActiveSamples[j].m_nCounter &&
sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
if (sample.m_nLoopCount) {
@@ -906,16 +906,16 @@ cAudioManager::ProcessActiveQueues()
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
}
}
- for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; ++i) {
+ for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
if (!sample.m_bIsProcessed && !sample.m_bLoopEnded && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
- if (sample.m_nCounter > 255 && sample.m_nLoopCount && sample.m_nLoopsRemaining) {
- --sample.m_nLoopsRemaining;
+ if (sample.m_nCounter > 255 && sample.m_nLoopCount != 0 && sample.m_nLoopsRemaining != 0) {
+ sample.m_nLoopsRemaining--;
sample.m_nReleasingVolumeDivider = 1;
} else {
- for (uint8 j = 0; j < m_nActiveSamples; ++j) {
+ for (uint8 j = 0; j < m_nActiveSamples; j++) {
if (!m_asActiveSamples[j].m_bIsProcessed) {
- if (sample.m_nLoopCount) {
+ if (sample.m_nLoopCount != 0) {
samplesPerFrame = sample.m_nFrequency / m_nTimeSpent;
samplesToPlay = sample.m_nLoopCount * SampleManager.GetSampleLength(sample.m_nSampleIndex);
if (samplesPerFrame == 0)
@@ -939,7 +939,7 @@ cAudioManager::ProcessActiveQueues()
#ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannelEmittingVolume(j, emittingVol);
#else
- SampleManager.SetChannelVolume(j, m_asActiveSamples[j].m_nVolume);
+ SampleManager.SetChannelVolume(j, emittingVol);
SampleManager.SetChannelPan(j, m_asActiveSamples[j].m_nOffset);
#endif
SampleManager.SetChannelLoopPoints(j, m_asActiveSamples[j].m_nLoopStart, m_asActiveSamples[j].m_nLoopEnd);
@@ -951,12 +951,12 @@ cAudioManager::ProcessActiveQueues()
if (offset == 63)
x = 0.f;
else if (offset >= 63)
- x = (offset - 63) * 1000.f / 63;
+ x = (offset - 63) * 1000.0f / 63;
else
- x = -(63 - offset) * 1000.f / 63;
+ x = -(63 - offset) * 1000.0f / 63;
usedX = x;
- usedY = 0.f;
- usedZ = 0.f;
+ usedY = 0.0f;
+ usedZ = 0.0f;
m_asActiveSamples[j].m_fSoundIntensity = 100000.0f;
} else {
usedX = position.x;
@@ -991,7 +991,7 @@ cAudioManager::ClearRequestedQueue()
void
cAudioManager::ClearActiveSamples()
{
- for (int32 i = 0; i < m_nActiveSamples; i++) {
+ for (uint8 i = 0; i < m_nActiveSamples; i++) {
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
m_asActiveSamples[i].m_nCounter = 0;
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;