Port audio changes from master

This commit is contained in:
Sergeanur 2021-08-18 15:49:06 +03:00
parent dff327df40
commit a13089cd2e
10 changed files with 271 additions and 237 deletions

View file

@ -205,7 +205,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
m_sQueueSample.m_nVolume =
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_nVolume) {
if(m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nSampleIndex = gOneShotCol[s1];
switch(m_sQueueSample.m_nSampleIndex) {
case SFX_COL_TARMAC_1:
@ -271,7 +271,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bReverbFlag = TRUE;
m_sQueueSample.m_bRequireReflection = FALSE;
SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@ -287,7 +287,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
if(emittingVol) {
CalculateDistance(distCalculated, m_sQueueSample.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_nVolume) {
if(m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_vecPos = col.m_vecPosition;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@ -301,7 +301,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
m_sQueueSample.m_bRequireReflection = FALSE;
SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}

File diff suppressed because it is too large Load diff

View file

@ -32,7 +32,9 @@ cAudioManager::cAudioManager()
ClearActiveSamples();
GenerateIntegerRandomNumberTable();
m_bDoubleVolume = FALSE;
#ifdef AUDIO_REFLECTIONS
m_bDynamicAcousticModelingStatus = TRUE;
#endif
for (int i = 0; i < NUM_AUDIOENTITIES; i++) {
m_asAudioEntities[i].m_bIsUsed = FALSE;
@ -116,7 +118,9 @@ cAudioManager::Service()
if (m_bIsInitialised) {
m_nPreviousUserPause = m_nUserPause;
m_nUserPause = CTimer::GetIsUserPaused();
#ifdef AUDIO_REFLECTIONS
UpdateReflections();
#endif
ServiceSoundEffects();
MusicManager.Service();
}
@ -451,11 +455,13 @@ cAudioManager::ReacquireDigitalHandle()
}
}
#ifdef AUDIO_REFLECTIONS
void
cAudioManager::SetDynamicAcousticModelingStatus(bool8 status)
{
m_bDynamicAcousticModelingStatus = status;
}
#endif
bool8
cAudioManager::CheckForAnAudioFileOnCD()
@ -628,9 +634,11 @@ cAudioManager::InterrogateAudioEntities()
void
cAudioManager::AddSampleToRequestedQueue()
{
int32 calculatedVolume;
uint32 calculatedVolume;
uint8 sampleIndex;
#ifdef AUDIO_REFLECTIONS
bool8 bReflections;
#endif
if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (MAX_VOLUME - m_sQueueSample.m_nVolume);
@ -644,11 +652,12 @@ cAudioManager::AddSampleToRequestedQueue()
}
m_sQueueSample.m_nCalculatedVolume = calculatedVolume;
m_sQueueSample.m_bLoopEnded = FALSE;
#ifdef AUDIO_REFLECTIONS
if (m_sQueueSample.m_bIs2D || CCullZones::InRoomForAudio()) {
m_sQueueSample.m_bRequireReflection = FALSE;
m_sQueueSample.m_nLoopsRemaining = 0;
}
if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount) {
if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount > 0) {
bReflections = m_sQueueSample.m_bRequireReflection;
} else {
bReflections = FALSE;
@ -657,16 +666,19 @@ cAudioManager::AddSampleToRequestedQueue()
m_sQueueSample.m_bRequireReflection = FALSE;
if ( m_bReverb && m_sQueueSample.m_bIs2D )
m_sQueueSample.field_4C = 30;
m_sQueueSample.m_nFrontRearOffset = 30;
if (!m_bDynamicAcousticModelingStatus)
m_sQueueSample.m_bReverbFlag = FALSE;
#endif
m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample;
AddDetailsToRequestedOrderList(sampleIndex);
#ifdef AUDIO_REFLECTIONS
if (bReflections)
AddReflectionsToRequestedQueue();
#endif
}
}
@ -674,7 +686,7 @@ void
cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
{
uint32 i = 0;
if (sample != 0) {
if (sample > 0) {
for (; i < sample; i++) {
if (m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]].m_nCalculatedVolume >
m_asSamples[m_nActiveSampleQueue][sample].m_nCalculatedVolume)
@ -687,6 +699,7 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
}
#ifdef AUDIO_REFLECTIONS
void
cAudioManager::AddReflectionsToRequestedQueue()
{
@ -710,7 +723,7 @@ cAudioManager::AddReflectionsToRequestedQueue()
}
m_sQueueSample.m_SoundIntensity /= 2.f;
int halfOldFreq = oldFreq >> 1;
uint32 halfOldFreq = oldFreq >> 1;
for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
if ( CTimer::GetIsSlowMotionActive() )
@ -726,15 +739,15 @@ cAudioManager::AddReflectionsToRequestedQueue()
if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
m_sQueueSample.m_nCounter = oldCounter + (i + 1) * 256;
if (m_sQueueSample.m_nLoopCount) {
if (m_sQueueSample.m_nLoopCount > 0) {
if ( CTimer::GetIsSlowMotionActive() ) {
m_sQueueSample.m_nFrequency = halfOldFreq + ((halfOldFreq * i) / ARRAY_SIZE(m_afReflectionsDistances));
} else {
noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
if (noise <= 0)
m_sQueueSample.m_nFrequency += noise;
else
if (noise > 0)
m_sQueueSample.m_nFrequency -= noise;
else
m_sQueueSample.m_nFrequency += noise;
}
}
m_sQueueSample.m_nReleasingVolumeModificator += 20;
@ -869,6 +882,7 @@ cAudioManager::UpdateReflections()
}
#endif
}
#endif // AUDIO_REFLECTIONS
void
cAudioManager::AddReleasingSounds()
@ -895,8 +909,11 @@ cAudioManager::AddReleasingSounds()
break;
}
}
if (!toProcess[i]) {
if (sample.m_nCounter <= 255 || sample.m_nLoopsRemaining == 0) {
if(!toProcess[i]) {
#ifdef AUDIO_REFLECTIONS
if(sample.m_nCounter <= 255 || sample.m_nLoopsRemaining == 0) // check if not reflection
#endif
{
if (sample.m_nReleasingVolumeDivider == 0)
continue;
if (sample.m_nLoopCount == 0) {
@ -1064,14 +1081,17 @@ cAudioManager::ProcessActiveQueues()
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 != 0 && sample.m_nLoopsRemaining != 0) {
#ifdef AUDIO_REFLECTIONS
if (sample.m_nCounter > 255 && sample.m_nLoopCount > 0 && sample.m_nLoopsRemaining > 0) { // check if reflection
sample.m_nLoopsRemaining--;
sample.m_nReleasingVolumeDivider = 1;
} else {
} else
#endif
{
for (uint8 j = 0; j < m_nActiveSamples; j++) {
uint8 k = (j + field_6) % m_nActiveSamples;
if (!m_asActiveSamples[k].m_bIsProcessed) {
if (sample.m_nLoopCount != 0) {
if (sample.m_nLoopCount > 0) {
samplesPerFrame = sample.m_nFrequency / m_nTimeSpent;
samplesToPlay = sample.m_nLoopCount * SampleManager.GetSampleLength(sample.m_nSampleIndex);
if (samplesPerFrame == 0)
@ -1191,8 +1211,10 @@ cAudioManager::ClearActiveSamples()
m_asActiveSamples[i].m_nVolumeChange = -1;
m_asActiveSamples[i].m_vecPos = CVector(0.0f, 0.0f, 0.0f);
m_asActiveSamples[i].m_bReverbFlag = FALSE;
#ifdef AUDIO_REFLECTIONS
m_asActiveSamples[i].m_nLoopsRemaining = 0;
m_asActiveSamples[i].m_bRequireReflection = FALSE;
#endif
}
}

View file

@ -10,17 +10,17 @@ class tSound
{
public:
int32 m_nEntityIndex;
int32 m_nCounter;
int32 m_nSampleIndex;
uint32 m_nCounter;
uint32 m_nSampleIndex;
uint8 m_nBankIndex;
bool8 m_bIs2D;
int32 m_nReleasingVolumeModificator;
uint32 m_nReleasingVolumeModificator;
uint32 m_nFrequency;
uint8 m_nVolume;
float m_fDistance;
int32 m_nLoopCount;
uint32 m_nLoopCount;
#ifndef GTA_PS2
int32 m_nLoopStart;
uint32 m_nLoopStart;
int32 m_nLoopEnd;
#endif
#ifdef EXTERNAL_3D_SOUND
@ -33,14 +33,16 @@ public:
#ifndef GTA_PS2
bool8 m_bReverbFlag; // TODO: ifdef all the occurrences
#endif
#ifdef AUDIO_REFLECTIONS
uint8 m_nLoopsRemaining;
bool8 m_bRequireReflection; // Used for oneshots
#endif
uint8 m_nOffset;
uint8 field_4C;
int32 m_nReleasingVolumeDivider;
uint8 m_nFrontRearOffset;
uint32 m_nReleasingVolumeDivider;
bool8 m_bIsProcessed;
bool8 m_bLoopEnded;
int32 m_nCalculatedVolume;
uint32 m_nCalculatedVolume;
int8 m_nVolumeChange;
};
@ -120,7 +122,7 @@ class cMissionAudio
public:
CVector m_vecPos[MISSION_AUDIO_SLOTS];
bool8 m_bPredefinedProperties[MISSION_AUDIO_SLOTS];
int32 m_nSampleIndex[MISSION_AUDIO_SLOTS];
uint32 m_nSampleIndex[MISSION_AUDIO_SLOTS];
uint8 m_nLoadingStatus[MISSION_AUDIO_SLOTS];
uint8 m_nPlayStatus[MISSION_AUDIO_SLOTS];
bool8 m_bIsPlaying[MISSION_AUDIO_SLOTS];
@ -170,7 +172,7 @@ public:
float m_fDistance;
CVehicle *m_pVehicle;
cTransmission *m_pTransmission;
int32 m_nIndex;
uint32 m_nIndex;
float m_fVelocityChange;
cVehicleParams()
@ -225,10 +227,10 @@ class cAudioManager
{
public:
bool8 m_bIsInitialised;
uint8 m_bReverb; // unused
bool8 m_bReverb; // unused
bool8 m_bFifthFrameFlag;
uint8 m_nActiveSamples;
uint8 m_bDoubleVolume; // unused
bool8 m_bDoubleVolume; // unused
bool8 m_bDynamicAcousticModelingStatus;
int8 field_6;
float m_fSpeedOfSound;
@ -243,8 +245,10 @@ public:
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES];
int32 m_nAudioEntitiesTotal;
#ifdef AUDIO_REFLECTIONS
CVector m_avecReflectionsPos[MAX_REFLECTIONS];
float m_afReflectionsDistances[MAX_REFLECTIONS];
#endif
cAudioScriptObjectManager m_sAudioScriptObjectManager;
// miami
@ -272,8 +276,8 @@ public:
uint8 field_5538; // something related to phone dialogues
int32 m_anRandomTable[5];
uint8 m_nTimeSpent;
uint8 m_nUserPause;
uint8 m_nPreviousUserPause;
bool8 m_nUserPause;
bool8 m_nPreviousUserPause;
uint32 m_FrameCounter;
cAudioManager();
@ -307,7 +311,9 @@ public:
bool8 IsMP3RadioChannelAvailable();
void ReleaseDigitalHandle();
void ReacquireDigitalHandle();
#ifdef AUDIO_REFLECTIONS
void SetDynamicAcousticModelingStatus(bool8 status);
#endif
bool8 CheckForAnAudioFileOnCD();
char GetCDAudioDriveLetter();
bool8 IsAudioInitialised();
@ -323,8 +329,10 @@ public:
void InterrogateAudioEntities(); // inlined
void AddSampleToRequestedQueue();
void AddDetailsToRequestedOrderList(uint8 sample); // inlined in vc
#ifdef AUDIO_REFLECTIONS
void AddReflectionsToRequestedQueue();
void UpdateReflections();
#endif
void AddReleasingSounds();
void ProcessActiveQueues();
void ClearRequestedQueue(); // inlined in vc
@ -603,6 +611,11 @@ public:
#else
#define SET_EMITTING_VOLUME(vol)
#endif
#ifdef AUDIO_REFLECTIONS
#define SET_SOUND_REFLECTION(b) m_sQueueSample.m_bRequireReflection = b
#else
#define SET_SOUND_REFLECTION(b)
#endif
#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS)
static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");

View file

@ -169,7 +169,9 @@ cDMAudio::ReacquireDigitalHandle(void)
void
cDMAudio::SetDynamicAcousticModelingStatus(bool8 status)
{
#ifdef AUDIO_REFLECTIONS
AudioManager.SetDynamicAcousticModelingStatus(status);
#endif
}
bool8

View file

@ -263,7 +263,7 @@ cMusicManager::GetRadioInCar(void)
CVehicle* veh = AudioManager.FindVehicleOfPlayer();
if (veh != nil) {
if (UsesPoliceRadio(veh) || UsesTaxiRadio(veh)) {
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
return STREAMED_SOUND_RADIO_POLICE;
return m_nRadioInCar;
}
@ -271,7 +271,7 @@ cMusicManager::GetRadioInCar(void)
}
}
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
return RADIO_OFF;
return m_nRadioInCar;
}
@ -461,7 +461,7 @@ cMusicManager::ServiceFrontEndMode()
} else {
if (m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER)
SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0);
else if (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED && AudioManager.m_nUserPause == 0)
else if (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED && !AudioManager.m_nUserPause)
ChangeMusicMode(MUSICMODE_GAME);
}
} else {

View file

@ -24,8 +24,8 @@ struct tPoliceRadioZone {
tPoliceRadioZone ZoneSfx[NUMAUDIOZONES];
uint32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
int8 g_nMissionAudioPlayingStatus = 2;
uint8 gSpecialSuspectLastSeenReport;
int8 g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
bool8 gSpecialSuspectLastSeenReport;
uint32 gMinTimeToNextReport[NUM_CRIME_TYPES];
void
@ -83,8 +83,8 @@ void
cAudioManager::SetMissionScriptPoliceAudio(uint32 sfx)
{
if (!m_bIsInitialised) return;
if (g_nMissionAudioPlayingStatus != 1) {
g_nMissionAudioPlayingStatus = 0;
if (g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) {
g_nMissionAudioPlayingStatus = PLAY_STATUS_STOPPED;
g_nMissionAudioSfx = sfx;
}
}
@ -113,7 +113,7 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_bReverbFlag = FALSE;
m_sQueueSample.m_nOffset = 63;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bRequireReflection = FALSE;
SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
@ -125,7 +125,7 @@ cAudioManager::ServicePoliceRadio()
if(!m_bIsInitialised) return;
if(m_nUserPause == 0) {
if(!m_nUserPause) {
bool8 crimeReport = SetupCrimeReport();
#ifdef FIX_BUGS // Crash at 0x5fe6ef
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
@ -162,20 +162,20 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
static int cWait = 0;
static bool8 bChannelOpen = FALSE;
static uint8 bMissionAudioPhysicalPlayingStatus = 0;
static uint8 bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
static int32 PoliceChannelFreq = 22050;
if (!m_bIsInitialised) return;
if (m_nUserPause != 0) {
if (m_nUserPause) {
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == 1 &&
if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING &&
SampleManager.IsStreamPlaying(1)) {
SampleManager.PauseStream(TRUE, 1);
}
} else {
if (m_nPreviousUserPause && g_nMissionAudioSfx != NO_SAMPLE &&
bMissionAudioPhysicalPlayingStatus == 1) {
bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
SampleManager.PauseStream(FALSE, 1);
}
if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = FALSE;
@ -188,17 +188,17 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
return;
}
if (g_nMissionAudioSfx != NO_SAMPLE && !bChannelOpen) {
if (g_nMissionAudioPlayingStatus) {
if (g_nMissionAudioPlayingStatus == 1 && !bMissionAudioPhysicalPlayingStatus &&
if (g_nMissionAudioPlayingStatus != PLAY_STATUS_STOPPED) {
if (g_nMissionAudioPlayingStatus == PLAY_STATUS_PLAYING && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_STOPPED &&
SampleManager.IsStreamPlaying(1)) {
bMissionAudioPhysicalPlayingStatus = 1;
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_PLAYING;
}
if (bMissionAudioPhysicalPlayingStatus == 1) {
if (bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
if (SampleManager.IsStreamPlaying(1)) {
DoPoliceRadioCrackle();
} else {
bMissionAudioPhysicalPlayingStatus = 2;
g_nMissionAudioPlayingStatus = 2;
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_FINISHED;
g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
g_nMissionAudioSfx = NO_SAMPLE;
cWait = 30;
}
@ -208,13 +208,13 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1);
SampleManager.StartPreloadedStreamedFile(1);
g_nMissionAudioPlayingStatus = 1;
bMissionAudioPhysicalPlayingStatus = 0;
g_nMissionAudioPlayingStatus = PLAY_STATUS_PLAYING;
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
return;
}
}
if (bChannelOpen) DoPoliceRadioCrackle();
if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != 1) &&
if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) &&
!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.policeChannelTimer) {
if (m_sPoliceRadioQueue.policeChannelTimer) {
sample = m_sPoliceRadioQueue.crimesSamples[m_sPoliceRadioQueue.policeChannelCounterSeconds];
@ -225,7 +225,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
}
if (wantedLevel == 0) {
if (gSpecialSuspectLastSeenReport) {
gSpecialSuspectLastSeenReport = 0;
gSpecialSuspectLastSeenReport = FALSE;
} else if (sample == SFX_POLICE_RADIO_MESSAGE_NOISE_1) {
bChannelOpen = FALSE;
processed = TRUE;

View file

@ -1706,6 +1706,7 @@ cSampleManager::UpdateReverb(void)
float fRatio = 0.0f;
#ifdef AUDIO_REFLECTIONS
#define MIN_DIST 0.5f
#define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0)
@ -1719,6 +1720,7 @@ cSampleManager::UpdateReverb(void)
#undef CALCULATE_RATIO
#undef MIN_DIST
#endif
fRatio = Clamp(fRatio, 0.0f, 0.6f);

View file

@ -1390,6 +1390,7 @@ bool8 cSampleManager::UpdateReverb(void)
float fRatio = 0.0f;
#ifdef AUDIO_REFLECTIONS
#define MIN_DIST 0.5f
#define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0)
@ -1403,6 +1404,7 @@ bool8 cSampleManager::UpdateReverb(void)
#undef CALCULATE_RATIO
#undef MIN_DIST
#endif
fRatio = Clamp(fRatio, 0.0f, 0.6f);

View file

@ -227,6 +227,7 @@ enum Config {
#define DONT_FIX_REPLAY_BUGS
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
//#define USE_TEXTURE_POOL // not possible because R* used custom RW33
#define AUDIO_REFLECTIONS
#else
// This enables things from the PS2 version on PC
#define GTA_PS2_STUFF
@ -438,6 +439,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
// Audio
#define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space
// originally and making it work in 2d only requires more resource). Will not work on PS2
#define AUDIO_REFLECTIONS // Enable audio reflections. This is enabled in all vanilla versions
#define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 43 (PC has 28 originally)