Audio fixes

This commit is contained in:
Sergeanur 2021-01-05 00:32:03 +02:00
parent 150f5302b7
commit 63e9f6d826
2 changed files with 75 additions and 75 deletions

View File

@ -3038,81 +3038,81 @@ 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)
emittingVol = m_anRandomTable[3] % 15 + 45; continue;
if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity) emittingVol = m_anRandomTable[3] % 15 + 45;
emittingVol /= 2; if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
maxDist = 400.f; emittingVol /= 2;
switch (params.m_pPed->m_nSurfaceTouched) { maxDist = 400.f;
case SURFACE_GRASS: switch (params.m_pPed->m_nSurfaceTouched) {
sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1; case SURFACE_GRASS:
break; sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1;
case SURFACE_GRAVEL: break;
case SURFACE_MUD_DRY: case SURFACE_GRAVEL:
sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1; case SURFACE_MUD_DRY:
break; sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
case SURFACE_CAR: break;
case SURFACE_GARAGE_DOOR: case SURFACE_CAR:
case SURFACE_CAR_PANEL: case SURFACE_GARAGE_DOOR:
case SURFACE_THICK_METAL_PLATE: case SURFACE_CAR_PANEL:
case SURFACE_SCAFFOLD_POLE: case SURFACE_THICK_METAL_PLATE:
case SURFACE_LAMP_POST: case SURFACE_SCAFFOLD_POLE:
case SURFACE_FIRE_HYDRANT: case SURFACE_LAMP_POST:
case SURFACE_GIRDER: case SURFACE_FIRE_HYDRANT:
case SURFACE_METAL_CHAIN_FENCE: case SURFACE_GIRDER:
case SURFACE_CONTAINER: case SURFACE_METAL_CHAIN_FENCE:
case SURFACE_NEWS_VENDOR: case SURFACE_CONTAINER:
sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1; case SURFACE_NEWS_VENDOR:
break; sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1;
case SURFACE_SAND: break;
sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1; case SURFACE_SAND:
break; sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
case SURFACE_WATER: break;
sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1; case SURFACE_WATER:
break; sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
case SURFACE_WOOD_CRATES: break;
case SURFACE_WOOD_BENCH: case SURFACE_WOOD_CRATES:
case SURFACE_WOOD_SOLID: case SURFACE_WOOD_BENCH:
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1; case SURFACE_WOOD_SOLID:
break; sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1;
case SURFACE_HEDGE: break;
sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1; case SURFACE_HEDGE:
break; sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1;
default: break;
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1; default:
break; sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1;
} break;
m_sQueueSample.m_nSampleIndex = sampleIndex;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - 28;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
switch (params.m_pPed->m_nMoveState) {
case PEDMOVE_WALK:
emittingVol /= 4;
m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10;
break;
case PEDMOVE_RUN:
emittingVol /= 2;
m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
break;
case PEDMOVE_SPRINT:
m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10;
break;
default:
break;
}
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = 20.0f;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bRequireReflection = true;
} }
m_sQueueSample.m_nSampleIndex = sampleIndex;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
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 += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
switch (params.m_pPed->m_nMoveState) {
case PEDMOVE_WALK:
emittingVol /= 4;
m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10;
break;
case PEDMOVE_RUN:
emittingVol /= 2;
m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
break;
case PEDMOVE_SPRINT:
m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10;
break;
default:
break;
}
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = 20.0f;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bRequireReflection = true;
break; break;
case SOUND_FALL_LAND: case SOUND_FALL_LAND:
case SOUND_FALL_COLLAPSE: case SOUND_FALL_COLLAPSE:

View File

@ -466,7 +466,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)