Audio fixes

This commit is contained in:
Sergeanur 2021-01-05 00:31:31 +02:00
parent 33fd33b03a
commit 32d3ea0a2d
3 changed files with 109 additions and 104 deletions

View file

@ -4201,7 +4201,8 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
switch (sound) { switch (sound) {
case SOUND_STEP_START: case SOUND_STEP_START:
case SOUND_STEP_END: case SOUND_STEP_END:
if (!params.m_pPed->bIsLooking) { if (params.m_pPed->bIsInTheAir)
continue;
emittingVol = m_anRandomTable[3] % 15 + 45; emittingVol = m_anRandomTable[3] % 15 + 45;
if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity) if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
emittingVol /= 2; emittingVol /= 2;
@ -4247,7 +4248,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
} }
m_sQueueSample.m_nSampleIndex = sampleIndex; m_sQueueSample.m_nSampleIndex = sampleIndex;
m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - 32; m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - SOUND_STEP_START + 1;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
switch (params.m_pPed->m_nMoveState) { switch (params.m_pPed->m_nMoveState) {
@ -4275,11 +4276,11 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = true; m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bRequireReflection = true; m_sQueueSample.m_bRequireReflection = true;
}
break; break;
case SOUND_FALL_LAND: case SOUND_FALL_LAND:
case SOUND_FALL_COLLAPSE: case SOUND_FALL_COLLAPSE:
if (!ped->bIsLooking) { if (params.m_pPed->bIsInTheAir)
continue;
maxDist = SQR(30); maxDist = SQR(30);
emittingVol = m_anRandomTable[3] % 20 + 80; emittingVol = m_anRandomTable[3] % 20 + 80;
if (ped->m_nSurfaceTouched == SURFACE_WATER) { if (ped->m_nSurfaceTouched == SURFACE_WATER) {
@ -4303,7 +4304,6 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = true; m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bRequireReflection = true; m_sQueueSample.m_bRequireReflection = true;
}
break; break;
case SOUND_FIGHT_37: case SOUND_FIGHT_37:
m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1; m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
@ -4342,6 +4342,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nFrequency = 20000; m_sQueueSample.m_nFrequency = 20000;
goto AddFightSound; goto AddFightSound;
case SOUND_FIGHT_46: case SOUND_FIGHT_46:
case SOUND_187:
m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5; m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5;
m_sQueueSample.m_nFrequency = 18000; m_sQueueSample.m_nFrequency = 18000;
goto AddFightSound; goto AddFightSound;
@ -4461,7 +4462,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
continue; continue;
m_sQueueSample.m_nSampleIndex = SFX_CAR_ACCEL_13; m_sQueueSample.m_nSampleIndex = SFX_CAR_ACCEL_13;
m_sQueueSample.m_nBankIndex = SFX_BANK_0; // SFX_BANK_CAR_CHAINSAW m_sQueueSample.m_nBankIndex = SFX_BANK_0; // SFX_BANK_CAR_CHAINSAW
m_sQueueSample.m_nCounter = 64; m_sQueueSample.m_nCounter = 70;
m_sQueueSample.m_nFrequency = 27000; m_sQueueSample.m_nFrequency = 27000;
m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSpeedMultiplier = 3.0f;
@ -5159,7 +5160,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3;
} }
} }
break; continue;
default: default:
SetupPedComments(params, sound); SetupPedComments(params, sound);
continue; continue;

View file

@ -10,6 +10,7 @@
#include "sampman.h" #include "sampman.h"
#include "Camera.h" #include "Camera.h"
#include "World.h" #include "World.h"
#include "ZoneCull.h"
cAudioManager AudioManager; cAudioManager AudioManager;
@ -589,7 +590,7 @@ cAudioManager::AddSampleToRequestedQueue()
} }
m_sQueueSample.m_nCalculatedVolume = calculatedVolume; m_sQueueSample.m_nCalculatedVolume = calculatedVolume;
m_sQueueSample.m_bLoopEnded = false; m_sQueueSample.m_bLoopEnded = false;
if (m_sQueueSample.m_bIs2D) { if (m_sQueueSample.m_bIs2D || CCullZones::InRoomForAudio()) {
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
m_sQueueSample.m_nLoopsRemaining = 0; m_sQueueSample.m_nLoopsRemaining = 0;
} }
@ -601,6 +602,9 @@ cAudioManager::AddSampleToRequestedQueue()
} }
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
if ( m_bReverb && m_sQueueSample.m_bIs2D )
m_sQueueSample.field_4C = 30;
if (!m_bDynamicAcousticModelingStatus) if (!m_bDynamicAcousticModelingStatus)
m_sQueueSample.m_bReverbFlag = false; m_sQueueSample.m_bReverbFlag = false;
@ -647,9 +651,9 @@ cAudioManager::AddReflectionsToRequestedQueue()
emittingVolume = m_sQueueSample.m_nVolume; emittingVolume = m_sQueueSample.m_nVolume;
oldFreq = m_sQueueSample.m_nFrequency; oldFreq = m_sQueueSample.m_nFrequency;
} else { } else {
emittingVolume = (m_sQueueSample.m_nVolume / 2) + (m_sQueueSample.m_nVolume / 16); emittingVolume = (9 * m_sQueueSample.m_nVolume) / 16;
} }
m_sQueueSample.m_fSoundIntensity = m_sQueueSample.m_fSoundIntensity / 2.f; m_sQueueSample.m_fSoundIntensity /= 2.f;
int halfOldFreq = oldFreq >> 1; int halfOldFreq = oldFreq >> 1;

View file

@ -521,7 +521,7 @@ void CStream::Pause()
if ( !HasSource() ) return; if ( !HasSource() ) return;
ALint sourceState = AL_PAUSED; ALint sourceState = AL_PAUSED;
alGetSourcei(m_pAlSources[0], AL_SOURCE_STATE, &sourceState); alGetSourcei(m_pAlSources[0], AL_SOURCE_STATE, &sourceState);
if (sourceState != AL_PAUSED ) if (sourceState != AL_PAUSED)
alSourcePause(m_pAlSources[0]); alSourcePause(m_pAlSources[0]);
alGetSourcei(m_pAlSources[1], AL_SOURCE_STATE, &sourceState); alGetSourcei(m_pAlSources[1], AL_SOURCE_STATE, &sourceState);
if (sourceState != AL_PAUSED) if (sourceState != AL_PAUSED)