A bit more audio cleanup
This commit is contained in:
parent
853dab23f5
commit
7ba5b3c353
@ -305,9 +305,9 @@ cAudioManager::cAudioManager()
|
|||||||
m_fSpeedOfSound = 6.86f;
|
m_fSpeedOfSound = 6.86f;
|
||||||
m_nTimeSpent = 50;
|
m_nTimeSpent = 50;
|
||||||
m_nActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS;
|
m_nActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS;
|
||||||
m_bActiveSampleQueue = 1;
|
m_nActiveSampleQueue = 1;
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
m_bActiveSampleQueue = 0;
|
m_nActiveSampleQueue = 0;
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
ClearActiveSamples();
|
ClearActiveSamples();
|
||||||
GenerateIntegerRandomNumberTable();
|
GenerateIntegerRandomNumberTable();
|
||||||
@ -337,15 +337,15 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
|
|||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
if (sample != 0) {
|
if (sample != 0) {
|
||||||
for (; i < sample; i++) {
|
for (; i < sample; i++) {
|
||||||
if (m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]].m_nCalculatedVolume >
|
if (m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]].m_nCalculatedVolume >
|
||||||
m_asSamples[m_bActiveSampleQueue][sample].m_nCalculatedVolume)
|
m_asSamples[m_nActiveSampleQueue][sample].m_nCalculatedVolume)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i < sample) {
|
if (i < sample) {
|
||||||
memmove(&m_abSampleQueueIndexTable[m_bActiveSampleQueue][i + 1], &m_abSampleQueueIndexTable[m_bActiveSampleQueue][i], m_nActiveSamples - i - 1);
|
memmove(&m_abSampleQueueIndexTable[m_nActiveSampleQueue][i + 1], &m_abSampleQueueIndexTable[m_nActiveSampleQueue][i], m_nActiveSamples - i - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_abSampleQueueIndexTable[m_bActiveSampleQueue][i] = sample;
|
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -415,7 +415,7 @@ cAudioManager::AddReleasingSounds()
|
|||||||
{
|
{
|
||||||
bool toProcess[44]; // why not 27?
|
bool toProcess[44]; // why not 27?
|
||||||
|
|
||||||
int8 queue = m_bActiveSampleQueue == 0;
|
int8 queue = m_nActiveSampleQueue == 0;
|
||||||
|
|
||||||
for (int32 i = 0; i < m_SampleRequestQueuesStatus[queue]; i++) {
|
for (int32 i = 0; i < m_SampleRequestQueuesStatus[queue]; i++) {
|
||||||
tSound &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]];
|
tSound &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]];
|
||||||
@ -423,9 +423,9 @@ cAudioManager::AddReleasingSounds()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
toProcess[i] = false;
|
toProcess[i] = false;
|
||||||
for (int32 j = 0; j < m_SampleRequestQueuesStatus[m_bActiveSampleQueue]; j++) {
|
for (int32 j = 0; j < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; j++) {
|
||||||
if (sample.m_nEntityIndex == m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]].m_nEntityIndex &&
|
if (sample.m_nEntityIndex == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nEntityIndex &&
|
||||||
sample.m_nCounter == m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]].m_nCounter) {
|
sample.m_nCounter == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nCounter) {
|
||||||
toProcess[i] = true;
|
toProcess[i] = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -468,13 +468,13 @@ cAudioManager::AddSampleToRequestedQueue()
|
|||||||
|
|
||||||
if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
|
if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
|
||||||
calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (maxVolume - m_sQueueSample.m_nVolume);
|
calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (maxVolume - m_sQueueSample.m_nVolume);
|
||||||
sampleIndex = m_SampleRequestQueuesStatus[m_bActiveSampleQueue];
|
sampleIndex = m_SampleRequestQueuesStatus[m_nActiveSampleQueue];
|
||||||
if (sampleIndex >= m_nActiveSamples) {
|
if (sampleIndex >= m_nActiveSamples) {
|
||||||
sampleIndex = m_abSampleQueueIndexTable[m_bActiveSampleQueue][m_nActiveSamples - 1];
|
sampleIndex = m_abSampleQueueIndexTable[m_nActiveSampleQueue][m_nActiveSamples - 1];
|
||||||
if (m_asSamples[m_bActiveSampleQueue][sampleIndex].m_nCalculatedVolume <= calculatedVolume)
|
if (m_asSamples[m_nActiveSampleQueue][sampleIndex].m_nCalculatedVolume <= calculatedVolume)
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
++m_SampleRequestQueuesStatus[m_bActiveSampleQueue];
|
++m_SampleRequestQueuesStatus[m_nActiveSampleQueue];
|
||||||
}
|
}
|
||||||
m_sQueueSample.m_nCalculatedVolume = calculatedVolume;
|
m_sQueueSample.m_nCalculatedVolume = calculatedVolume;
|
||||||
m_sQueueSample.m_bLoopEnded = false;
|
m_sQueueSample.m_bLoopEnded = false;
|
||||||
@ -493,7 +493,7 @@ cAudioManager::AddSampleToRequestedQueue()
|
|||||||
if (!m_bDynamicAcousticModelingStatus)
|
if (!m_bDynamicAcousticModelingStatus)
|
||||||
m_sQueueSample.m_bReverbFlag = false;
|
m_sQueueSample.m_bReverbFlag = false;
|
||||||
|
|
||||||
m_asSamples[m_bActiveSampleQueue][sampleIndex] = m_sQueueSample;
|
m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample;
|
||||||
|
|
||||||
AddDetailsToRequestedOrderList(sampleIndex);
|
AddDetailsToRequestedOrderList(sampleIndex);
|
||||||
if (bReflections)
|
if (bReflections)
|
||||||
@ -567,9 +567,9 @@ void
|
|||||||
cAudioManager::ClearRequestedQueue()
|
cAudioManager::ClearRequestedQueue()
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < m_nActiveSamples; i++) {
|
for (int32 i = 0; i < m_nActiveSamples; i++) {
|
||||||
m_abSampleQueueIndexTable[m_bActiveSampleQueue][i] = m_nActiveSamples;
|
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = m_nActiveSamples;
|
||||||
}
|
}
|
||||||
m_SampleRequestQueuesStatus[m_bActiveSampleQueue] = 0;
|
m_SampleRequestQueuesStatus[m_nActiveSampleQueue] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32
|
int32
|
||||||
@ -3538,12 +3538,12 @@ cAudioManager::ProcessActiveQueues()
|
|||||||
CVector position;
|
CVector position;
|
||||||
|
|
||||||
for (int32 i = 0; i < m_nActiveSamples; i++) {
|
for (int32 i = 0; i < m_nActiveSamples; i++) {
|
||||||
m_asSamples[m_bActiveSampleQueue][i].m_bIsProcessed = false;
|
m_asSamples[m_nActiveSampleQueue][i].m_bIsProcessed = false;
|
||||||
m_asActiveSamples[i].m_bIsProcessed = false;
|
m_asActiveSamples[i].m_bIsProcessed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) {
|
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; ++i) {
|
||||||
tSound &sample = m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]];
|
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
||||||
if (sample.m_nSampleIndex != NO_SAMPLE) {
|
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 &&
|
if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex && sample.m_nCounter == m_asActiveSamples[j].m_nCounter &&
|
||||||
@ -3627,8 +3627,8 @@ cAudioManager::ProcessActiveQueues()
|
|||||||
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
|
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) {
|
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; ++i) {
|
||||||
tSound &sample = m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][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_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) {
|
if (sample.m_nCounter > 255 && sample.m_nLoopCount && sample.m_nLoopsRemaining) {
|
||||||
--sample.m_nLoopsRemaining;
|
--sample.m_nLoopsRemaining;
|
||||||
@ -7489,7 +7489,7 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound)
|
|||||||
params.m_bDistanceCalculated = true;
|
params.m_bDistanceCalculated = true;
|
||||||
params.m_fDistance = distSquared;
|
params.m_fDistance = distSquared;
|
||||||
params.m_pPed = nil;
|
params.m_pPed = nil;
|
||||||
SetupPedComments(¶ms, SOUND_8A);
|
SetupPedComments(¶ms, SOUND_INJURED_PED_MALE_PRISON);
|
||||||
}
|
}
|
||||||
gCellNextTime = time + 500 + m_anRandomTable[3] % 1500;
|
gCellNextTime = time + 500 + m_anRandomTable[3] % 1500;
|
||||||
}
|
}
|
||||||
@ -9197,17 +9197,17 @@ void
|
|||||||
cAudioManager::ResetTimers(uint32 time)
|
cAudioManager::ResetTimers(uint32 time)
|
||||||
{
|
{
|
||||||
if (m_bIsInitialised) {
|
if (m_bIsInitialised) {
|
||||||
m_bTimerJustReset = 1;
|
m_bTimerJustReset = true;
|
||||||
m_nTimer = time;
|
m_nTimer = time;
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
if (m_bActiveSampleQueue) {
|
if (m_nActiveSampleQueue) {
|
||||||
m_bActiveSampleQueue = 0;
|
m_nActiveSampleQueue = 0;
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
m_bActiveSampleQueue = 1;
|
m_nActiveSampleQueue = 1;
|
||||||
} else {
|
} else {
|
||||||
m_bActiveSampleQueue = 1;
|
m_nActiveSampleQueue = 1;
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
m_bActiveSampleQueue = 0;
|
m_nActiveSampleQueue = 0;
|
||||||
}
|
}
|
||||||
ClearActiveSamples();
|
ClearActiveSamples();
|
||||||
ClearMissionAudio();
|
ClearMissionAudio();
|
||||||
@ -9228,7 +9228,7 @@ cAudioManager::Service()
|
|||||||
if (m_bTimerJustReset) {
|
if (m_bTimerJustReset) {
|
||||||
ResetAudioLogicTimers(m_nTimer);
|
ResetAudioLogicTimers(m_nTimer);
|
||||||
MusicManager.ResetTimers(m_nTimer);
|
MusicManager.ResetTimers(m_nTimer);
|
||||||
m_bTimerJustReset = 0;
|
m_bTimerJustReset = false;
|
||||||
}
|
}
|
||||||
if (m_bIsInitialised) {
|
if (m_bIsInitialised) {
|
||||||
m_nPreviousUserPause = m_nUserPause;
|
m_nPreviousUserPause = m_nUserPause;
|
||||||
@ -9251,18 +9251,18 @@ cAudioManager::ServiceSoundEffects()
|
|||||||
SampleManager.StopChannel(i);
|
SampleManager.StopChannel(i);
|
||||||
|
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
if (m_bActiveSampleQueue) {
|
if (m_nActiveSampleQueue) {
|
||||||
m_bActiveSampleQueue = 0;
|
m_nActiveSampleQueue = 0;
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
m_bActiveSampleQueue = 1;
|
m_nActiveSampleQueue = 1;
|
||||||
} else {
|
} else {
|
||||||
m_bActiveSampleQueue = 1;
|
m_nActiveSampleQueue = 1;
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
m_bActiveSampleQueue = 0;
|
m_nActiveSampleQueue = 0;
|
||||||
}
|
}
|
||||||
ClearActiveSamples();
|
ClearActiveSamples();
|
||||||
}
|
}
|
||||||
m_bActiveSampleQueue = m_bActiveSampleQueue != 1;
|
m_nActiveSampleQueue = m_nActiveSampleQueue != 1;
|
||||||
ProcessReverb();
|
ProcessReverb();
|
||||||
ProcessSpecial();
|
ProcessSpecial();
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
@ -9294,10 +9294,10 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
|
|||||||
for (uint8 i = 0; i < m_nActiveSamples + 1; ++i)
|
for (uint8 i = 0; i < m_nActiveSamples + 1; ++i)
|
||||||
SampleManager.StopChannel(i);
|
SampleManager.StopChannel(i);
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
if (m_bActiveSampleQueue)
|
if (m_nActiveSampleQueue == 0)
|
||||||
m_bActiveSampleQueue = 0;
|
m_nActiveSampleQueue = 1;
|
||||||
else
|
else
|
||||||
m_bActiveSampleQueue = 1;
|
m_nActiveSampleQueue = 0;
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
ClearActiveSamples();
|
ClearActiveSamples();
|
||||||
int8 current = SampleManager.SetCurrent3DProvider(which);
|
int8 current = SampleManager.SetCurrent3DProvider(which);
|
||||||
@ -9330,17 +9330,16 @@ cAudioManager::SetEffectsMasterVolume(uint8 volume) const
|
|||||||
void
|
void
|
||||||
cAudioManager::SetEntityStatus(int32 id, uint8 status)
|
cAudioManager::SetEntityStatus(int32 id, uint8 status)
|
||||||
{
|
{
|
||||||
if (m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && m_asAudioEntities[id].m_bIsUsed) {
|
if (m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && m_asAudioEntities[id].m_bIsUsed)
|
||||||
m_asAudioEntities[id].m_nStatus = status;
|
m_asAudioEntities[id].m_nStatus = status;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::SetMissionAudioLocation(float x, float y, float z)
|
cAudioManager::SetMissionAudioLocation(float x, float y, float z)
|
||||||
{
|
{
|
||||||
if (m_bIsInitialised) {
|
if (m_bIsInitialised) {
|
||||||
m_sMissionAudio.m_bPredefinedProperties = 0;
|
m_sMissionAudio.m_bPredefinedProperties = false;
|
||||||
m_sMissionAudio.m_vecPos = {x, y, z};
|
m_sMissionAudio.m_vecPos = CVector(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9370,7 +9369,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq)
|
|||||||
|
|
||||||
uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100;
|
uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100;
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance);
|
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance);
|
||||||
if (m_sQueueSample.m_nVolume) {
|
if (m_sQueueSample.m_nVolume != 0) {
|
||||||
m_sQueueSample.m_nCounter = 3;
|
m_sQueueSample.m_nCounter = 3;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE;
|
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE;
|
||||||
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
||||||
@ -9400,7 +9399,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol)
|
|||||||
|
|
||||||
int32 vol = ComputeVolume(emittingVol, 440.0f, m_sQueueSample.m_fDistance);
|
int32 vol = ComputeVolume(emittingVol, 440.0f, m_sQueueSample.m_fDistance);
|
||||||
m_sQueueSample.m_nVolume = vol;
|
m_sQueueSample.m_nVolume = vol;
|
||||||
if (m_sQueueSample.m_nVolume) {
|
if (m_sQueueSample.m_nVolume != 0) {
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY;
|
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY;
|
||||||
m_sQueueSample.m_nCounter = 0;
|
m_sQueueSample.m_nCounter = 0;
|
||||||
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
||||||
@ -9427,9 +9426,9 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
|
|||||||
if (m_sQueueSample.m_fDistance >= 240.f)
|
if (m_sQueueSample.m_fDistance >= 240.f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 240.f, m_sQueueSample.m_fDistance);
|
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 240.0f, m_sQueueSample.m_fDistance);
|
||||||
|
|
||||||
if (m_sQueueSample.m_nVolume) {
|
if (m_sQueueSample.m_nVolume != 0) {
|
||||||
m_sQueueSample.m_nCounter = 5;
|
m_sQueueSample.m_nCounter = 5;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
|
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
|
||||||
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
||||||
@ -9469,7 +9468,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
|
|||||||
emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100;
|
emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100;
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance);
|
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance);
|
||||||
|
|
||||||
if (m_sQueueSample.m_nVolume) {
|
if (m_sQueueSample.m_nVolume != 0) {
|
||||||
m_sQueueSample.m_nCounter = 1;
|
m_sQueueSample.m_nCounter = 1;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
|
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
|
||||||
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
||||||
@ -9499,7 +9498,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
|
|||||||
|
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 170.f, m_sQueueSample.m_fDistance);
|
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 170.f, m_sQueueSample.m_fDistance);
|
||||||
|
|
||||||
if (m_sQueueSample.m_nVolume) {
|
if (m_sQueueSample.m_nVolume != 0) {
|
||||||
m_sQueueSample.m_nCounter = 2;
|
m_sQueueSample.m_nCounter = 2;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE;
|
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE;
|
||||||
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
||||||
@ -9529,7 +9528,7 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
|
|||||||
float soundIntensity;
|
float soundIntensity;
|
||||||
tPedComment pedComment;
|
tPedComment pedComment;
|
||||||
|
|
||||||
if (ped) {
|
if (ped != nil) {
|
||||||
switch (sound) {
|
switch (sound) {
|
||||||
case SOUND_AMMUNATION_WELCOME_1:
|
case SOUND_AMMUNATION_WELCOME_1:
|
||||||
pedComment.m_nSampleIndex = SFX_AMMU_D;
|
pedComment.m_nSampleIndex = SFX_AMMU_D;
|
||||||
@ -9547,88 +9546,58 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
soundIntensity = 50.f;
|
soundIntensity = 50.0f;
|
||||||
|
|
||||||
if (params->m_fDistance < SQR(soundIntensity)) {
|
|
||||||
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
|
|
||||||
if (sound != SOUND_PAGER) {
|
|
||||||
switch (sound) {
|
|
||||||
case SOUND_AMMUNATION_WELCOME_1:
|
|
||||||
case SOUND_AMMUNATION_WELCOME_2:
|
|
||||||
case SOUND_AMMUNATION_WELCOME_3:
|
|
||||||
emittingVol = maxVolume;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), m_sQueueSample.m_vecPos, 1, 0, 0, 0, 0, 0, 0)) {
|
|
||||||
emittingVol = maxVolume;
|
|
||||||
} else {
|
|
||||||
emittingVol = 31;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance);
|
|
||||||
pedComment.m_nProcess = 10;
|
|
||||||
if (m_sQueueSample.m_nVolume) {
|
|
||||||
pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex;
|
|
||||||
pedComment.m_vecPos = m_sQueueSample.m_vecPos;
|
|
||||||
pedComment.m_fDistance = m_sQueueSample.m_fDistance;
|
|
||||||
pedComment.m_bVolume = m_sQueueSample.m_nVolume;
|
|
||||||
m_sPedComments.Add(&pedComment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
switch (sound) {
|
switch (sound) {
|
||||||
case SOUND_PED_HELI_PLAYER_FOUND:
|
case SOUND_PED_HELI_PLAYER_FOUND:
|
||||||
soundIntensity = 400.f;
|
soundIntensity = 400.0f;
|
||||||
pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 29 + SFX_POLICE_HELI_1;
|
pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_POLICE_HELI_1, SFX_POLICE_HELI_29);
|
||||||
break;
|
break;
|
||||||
case SOUND_PED_BODYCAST_HIT:
|
case SOUND_PED_BODYCAST_HIT:
|
||||||
if (CTimer::GetTimeInMilliseconds() <= gNextCryTime)
|
if (CTimer::GetTimeInMilliseconds() <= gNextCryTime)
|
||||||
return;
|
return;
|
||||||
soundIntensity = 50.f;
|
soundIntensity = 50.0f;
|
||||||
gNextCryTime = CTimer::GetTimeInMilliseconds() + 500;
|
gNextCryTime = CTimer::GetTimeInMilliseconds() + 500;
|
||||||
pedComment.m_nSampleIndex = (m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] & 3) + SFX_PLASTER_BLOKE_1;
|
pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_PLASTER_BLOKE_1, SFX_PLASTER_BLOKE_4);
|
||||||
break;
|
break;
|
||||||
case SOUND_INJURED_PED_MALE_OUCH:
|
case SOUND_INJURED_PED_MALE_OUCH:
|
||||||
case SOUND_8A:
|
case SOUND_INJURED_PED_MALE_PRISON:
|
||||||
soundIntensity = 50.f;
|
soundIntensity = 50.0f;
|
||||||
pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 15 + SFX_GENERIC_MALE_GRUNT_1;
|
pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_MALE_GRUNT_1, SFX_GENERIC_MALE_GRUNT_15);
|
||||||
break;
|
break;
|
||||||
case SOUND_INJURED_PED_FEMALE:
|
case SOUND_INJURED_PED_FEMALE:
|
||||||
soundIntensity = 50.f;
|
soundIntensity = 50.0f;
|
||||||
pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 11 + SFX_GENERIC_FEMALE_GRUNT_1;
|
pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_FEMALE_GRUNT_1, SFX_GENERIC_FEMALE_GRUNT_11);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params->m_fDistance < SQR(soundIntensity)) {
|
if (params->m_fDistance < SQR(soundIntensity)) {
|
||||||
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
|
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
|
||||||
if (sound != SOUND_PAGER) {
|
if (sound != SOUND_PAGER) {
|
||||||
switch (sound) {
|
switch (sound) {
|
||||||
case SOUND_AMMUNATION_WELCOME_1:
|
case SOUND_AMMUNATION_WELCOME_1:
|
||||||
case SOUND_AMMUNATION_WELCOME_2:
|
case SOUND_AMMUNATION_WELCOME_2:
|
||||||
case SOUND_AMMUNATION_WELCOME_3:
|
case SOUND_AMMUNATION_WELCOME_3:
|
||||||
|
emittingVol = maxVolume;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), m_sQueueSample.m_vecPos, true, false, false, false, false, false))
|
||||||
emittingVol = maxVolume;
|
emittingVol = maxVolume;
|
||||||
break;
|
else
|
||||||
default:
|
emittingVol = 31;
|
||||||
if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), m_sQueueSample.m_vecPos, 1, 0, 0, 0, 0, 0, 0)) {
|
break;
|
||||||
emittingVol = maxVolume;
|
}
|
||||||
} else {
|
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance);
|
||||||
emittingVol = 31;
|
pedComment.m_nProcess = 10;
|
||||||
}
|
if (m_sQueueSample.m_nVolume != 0) {
|
||||||
break;
|
pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex;
|
||||||
}
|
pedComment.m_vecPos = m_sQueueSample.m_vecPos;
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance);
|
pedComment.m_fDistance = m_sQueueSample.m_fDistance;
|
||||||
pedComment.m_nProcess = 10;
|
pedComment.m_bVolume = m_sQueueSample.m_nVolume;
|
||||||
if (m_sQueueSample.m_nVolume) {
|
m_sPedComments.Add(&pedComment);
|
||||||
pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex;
|
|
||||||
pedComment.m_vecPos = m_sQueueSample.m_vecPos;
|
|
||||||
pedComment.m_fDistance = m_sQueueSample.m_fDistance;
|
|
||||||
pedComment.m_bVolume = m_sQueueSample.m_nVolume;
|
|
||||||
m_sPedComments.Add(&pedComment);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9771,8 +9740,8 @@ cAudioManager::UsesSirenSwitching(int32 model) const
|
|||||||
void
|
void
|
||||||
cAudioManager::AdjustSamplesVolume()
|
cAudioManager::AdjustSamplesVolume()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_SampleRequestQueuesStatus[m_bActiveSampleQueue]; i++) {
|
for (int i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
|
||||||
tSound *pSample = &m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i] + 1];
|
tSound *pSample = &m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] + 1];
|
||||||
|
|
||||||
if (!pSample->m_bIs2D)
|
if (!pSample->m_bIs2D)
|
||||||
pSample->m_nEmittingVolume = ComputeEmittingVolume(pSample->m_nEmittingVolume, pSample->m_fSoundIntensity, pSample->m_fDistance);
|
pSample->m_nEmittingVolume = ComputeEmittingVolume(pSample->m_nEmittingVolume, pSample->m_fSoundIntensity, pSample->m_fDistance);
|
||||||
|
@ -167,7 +167,7 @@ public:
|
|||||||
bool m_bTimerJustReset;
|
bool m_bTimerJustReset;
|
||||||
int32 m_nTimer;
|
int32 m_nTimer;
|
||||||
tSound m_sQueueSample;
|
tSound m_sQueueSample;
|
||||||
bool m_bActiveSampleQueue;
|
uint8 m_nActiveSampleQueue;
|
||||||
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
|
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
|
||||||
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
|
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
|
||||||
uint8 m_SampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS];
|
uint8 m_SampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS];
|
||||||
@ -202,6 +202,7 @@ public:
|
|||||||
uint32 GetFrameCounter() const { return m_FrameCounter; }
|
uint32 GetFrameCounter() const { return m_FrameCounter; }
|
||||||
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
|
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
|
||||||
int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
|
int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
|
||||||
|
int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; }
|
||||||
bool IsMissionAudioPlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; }
|
bool IsMissionAudioPlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; }
|
||||||
|
|
||||||
// "Should" be in alphabetic order, except "getXTalkSfx"
|
// "Should" be in alphabetic order, except "getXTalkSfx"
|
||||||
|
@ -140,7 +140,7 @@ enum eSound : int16
|
|||||||
SOUND_PED_TAXI_CALL = 135,
|
SOUND_PED_TAXI_CALL = 135,
|
||||||
SOUND_INJURED_PED_MALE_OUCH = 136,
|
SOUND_INJURED_PED_MALE_OUCH = 136,
|
||||||
SOUND_INJURED_PED_FEMALE = 137,
|
SOUND_INJURED_PED_FEMALE = 137,
|
||||||
SOUND_8A = 138,
|
SOUND_INJURED_PED_MALE_PRISON = 138,
|
||||||
SOUND_RACE_START_3 = 139,
|
SOUND_RACE_START_3 = 139,
|
||||||
SOUND_RACE_START_2 = 140,
|
SOUND_RACE_START_2 = 140,
|
||||||
SOUND_RACE_START_1 = 141,
|
SOUND_RACE_START_1 = 141,
|
||||||
|
Loading…
Reference in New Issue
Block a user