Cleanup audiocode and fix for ComputeDopplerEffectedFrequency

This commit is contained in:
Filip Gawin 2020-04-07 15:44:31 +02:00
parent f192d7052e
commit bf2316bd54
4 changed files with 637 additions and 630 deletions

View File

@ -154,18 +154,18 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
m_sQueueSample.m_counter = counter; m_sQueueSample.m_counter = counter;
m_sQueueSample.m_vecPos = col->m_vecPosition; m_sQueueSample.m_vecPos = col->m_vecPosition;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIsDistant = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.field_16 = 7; m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol; m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = m_sQueueSample.m_nLoopEnd =
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 4.0f; m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
m_sQueueSample.field_56 = 0; m_sQueueSample.m_bReleasingSoundFlag = 0;
m_sQueueSample.field_76 = 5; m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();
@ -274,15 +274,15 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
if(counter >= 255) counter = 28; if(counter >= 255) counter = 28;
m_sQueueSample.m_vecPos = col->m_vecPosition; m_sQueueSample.m_vecPos = col->m_vecPosition;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIsDistant = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.field_16 = 11; m_sQueueSample.m_nReleasingVolumeModificator = 11;
m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_bEmittingVolume = emittingVol; m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.field_48 = 4.0f; m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
m_sQueueSample.field_56 = 1; m_sQueueSample.m_bReleasingSoundFlag = 1;
m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();

File diff suppressed because it is too large Load Diff

View File

@ -141,10 +141,10 @@ public:
int32 m_counter; int32 m_counter;
int32 m_nSampleIndex; int32 m_nSampleIndex;
uint8 m_bBankIndex; uint8 m_bBankIndex;
bool m_bIsDistant; bool m_bIs2D;
uint8 field_14; uint8 field_14;
uint8 field_15; uint8 field_15;
int32 field_16; int32 m_nReleasingVolumeModificator;
int32 m_nFrequency; int32 m_nFrequency;
uint8 m_bVolume; uint8 m_bVolume;
uint8 field_25; uint8 field_25;
@ -158,24 +158,24 @@ public:
uint8 field_45; uint8 field_45;
uint8 field_46; uint8 field_46;
uint8 field_47; uint8 field_47;
float field_48; float m_fSpeedMultiplier;
float m_fSoundIntensity; float m_fSoundIntensity;
uint8 field_56; bool m_bReleasingSoundFlag;
uint8 field_57; uint8 field_57;
uint8 field_58; uint8 field_58;
uint8 field_59; uint8 field_59;
CVector m_vecPos; CVector m_vecPos;
bool m_bReverbFlag; bool m_bReverbFlag;
uint8 m_bLoopsRemaining; uint8 m_bLoopsRemaining;
bool m_bRequireReflection; bool m_bRequireReflection; // Used for oneshots
uint8 m_bOffset; uint8 m_bOffset;
int32 field_76; int32 m_nReleasingVolumeDivider;
uint8 m_bIsProcessed; uint8 m_bIsProcessed;
uint8 m_bLoopEnded; uint8 m_bLoopEnded;
uint8 field_82; uint8 field_82;
uint8 field_83; uint8 field_83;
int32 calculatedVolume; int32 calculatedVolume;
int8 field_88; int8 m_nVolumeChange;
uint8 field_89; uint8 field_89;
uint8 field_90; uint8 field_90;
uint8 field_91; uint8 field_91;
@ -210,7 +210,7 @@ class tPedComment
{ {
public: public:
int32 m_nSampleIndex; int32 m_nSampleIndex;
int32 m_entityIndex; int32 m_nEntityIndex;
CVector m_vecPos; CVector m_vecPos;
float m_fDistance; float m_fDistance;
uint8 m_bVolume; uint8 m_bVolume;
@ -226,9 +226,9 @@ class cPedComments
{ {
public: public:
tPedComment m_asPedComments[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS]; tPedComment m_asPedComments[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
uint8 indexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS]; uint8 m_nIndexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
uint8 nrOfCommentsInBank[NUM_PED_COMMENTS_BANKS]; uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS];
uint8 activeBank; uint8 m_nActiveBank;
uint8 gap_1163[1]; uint8 gap_1163[1];
// reversed all methods // reversed all methods
@ -289,22 +289,22 @@ class cAudioManager
{ {
public: public:
bool m_bIsInitialised; bool m_bIsInitialised;
uint8 field_1; uint8 field_1; // unused
uint8 field_2; bool m_bFifthFrameFlag;
uint8 m_bActiveSamples; uint8 m_bActiveSamples;
uint8 field_4; uint8 field_4; // unused
bool m_bDynamicAcousticModelingStatus; bool m_bDynamicAcousticModelingStatus;
uint8 field_6; uint8 field_6; // unused
uint8 field_7; uint8 field_7; // unused
float speedOfSound; float m_fSpeedOfSound;
bool m_bTimerJustReset; bool m_bTimerJustReset;
uint8 field_13; uint8 field_13; // unused
uint8 field_14; uint8 field_14; // unused
uint8 field_15; uint8 field_15; // unused
int32 m_nTimer; int32 m_nTimer;
tSound m_sQueueSample; tSound m_sQueueSample;
bool m_bActiveSampleQueue; bool m_bActiveSampleQueue;
uint8 gap_109[3]; uint8 gap_109[3]; // unused
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_bSampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS]; uint8 m_bSampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS];
@ -328,10 +328,10 @@ public:
int32 m_nBridgeEntity; int32 m_nBridgeEntity;
cMissionAudio m_sMissionAudio; cMissionAudio m_sMissionAudio;
int32 m_anRandomTable[5]; int32 m_anRandomTable[5];
uint8 field_19192; uint8 field_19192; // time?
uint8 m_bUserPause; uint8 m_bUserPause;
uint8 m_bPreviousUserPause; uint8 m_bPreviousUserPause;
uint8 field_19195; // time? uint8 field_19195; // unused
uint32 m_FrameCounter; uint32 m_FrameCounter;
// getters // getters

View File

@ -128,18 +128,18 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_counter = 0; m_sQueueSample.m_counter = 0;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE; m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIsDistant = true; m_sQueueSample.m_bIs2D = true;
m_sQueueSample.field_16 = 10; m_sQueueSample.m_nReleasingVolumeModificator = 10;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE); m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.m_bVolume = m_anRandomTable[2] % 20 + 15; m_sQueueSample.m_bVolume = m_anRandomTable[2] % 20 + 15;
m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume; m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE); m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.field_56 = 0; m_sQueueSample.m_bReleasingSoundFlag = 0;
m_sQueueSample.m_bReverbFlag = false; m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bOffset = 63; m_sQueueSample.m_bOffset = 63;
m_sQueueSample.field_76 = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();
} }