summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/AudioLogic.cpp402
-rw-r--r--src/audio/AudioManager.h46
2 files changed, 229 insertions, 219 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 6bfe3cde..fc828042 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -599,78 +599,78 @@ cAudioManager::ProcessVehicle(CVehicle *veh)
case VEHICLE_TYPE_CAR:
UpdateGasPedalAudio((CAutomobile *)veh);
if (params.m_nIndex == RCBANDIT) {
- ProcessModelCarEngine(&params);
- ProcessVehicleOneShots(&params);
+ ProcessModelCarEngine(params);
+ ProcessVehicleOneShots(params);
((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
break;
}
if (params.m_nIndex == DODO) {
- if (!ProcessVehicleRoadNoise(&params)) {
- ProcessVehicleOneShots(&params);
+ if (!ProcessVehicleRoadNoise(params)) {
+ ProcessVehicleOneShots(params);
((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
break;
}
if (CWeather::WetRoads > 0.f)
- ProcessWetRoadNoise(&params);
- ProcessVehicleSkidding(&params);
+ ProcessWetRoadNoise(params);
+ ProcessVehicleSkidding(params);
} else {
- if (!ProcessVehicleRoadNoise(&params)) {
- ProcessVehicleOneShots(&params);
+ if (!ProcessVehicleRoadNoise(params)) {
+ ProcessVehicleOneShots(params);
((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
break;
}
- ProcessReverseGear(&params);
+ ProcessReverseGear(params);
if (CWeather::WetRoads > 0.f)
- ProcessWetRoadNoise(&params);
- ProcessVehicleSkidding(&params);
- ProcessVehicleHorn(&params);
- ProcessVehicleSirenOrAlarm(&params);
+ ProcessWetRoadNoise(params);
+ ProcessVehicleSkidding(params);
+ ProcessVehicleHorn(params);
+ ProcessVehicleSirenOrAlarm(params);
if (UsesReverseWarning(params.m_nIndex))
- ProcessVehicleReverseWarning(&params);
+ ProcessVehicleReverseWarning(params);
if (HasAirBrakes(params.m_nIndex))
- ProcessAirBrakes(&params);
+ ProcessAirBrakes(params);
}
- ProcessCarBombTick(&params);
- ProcessVehicleEngine(&params);
- ProcessEngineDamage(&params);
- ProcessVehicleDoors(&params);
+ ProcessCarBombTick(params);
+ ProcessVehicleEngine(params);
+ ProcessEngineDamage(params);
+ ProcessVehicleDoors(params);
- ProcessVehicleOneShots(&params);
+ ProcessVehicleOneShots(params);
((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
break;
case VEHICLE_TYPE_BOAT:
- ProcessBoatEngine(&params);
- ProcessBoatMovingOverWater(&params);
- ProcessVehicleOneShots(&params);
+ ProcessBoatEngine(params);
+ ProcessBoatMovingOverWater(params);
+ ProcessVehicleOneShots(params);
break;
case VEHICLE_TYPE_TRAIN:
- ProcessTrainNoise(&params);
- ProcessVehicleOneShots(&params);
+ ProcessTrainNoise(params);
+ ProcessVehicleOneShots(params);
break;
case VEHICLE_TYPE_HELI:
- ProcessHelicopter(&params);
- ProcessVehicleOneShots(&params);
+ ProcessHelicopter(params);
+ ProcessVehicleOneShots(params);
break;
case VEHICLE_TYPE_PLANE:
- ProcessPlane(&params);
- ProcessVehicleOneShots(&params);
+ ProcessPlane(params);
+ ProcessVehicleOneShots(params);
break;
default:
break;
}
- ProcessRainOnVehicle(&params);
+ ProcessRainOnVehicle(params);
}
void
-cAudioManager::ProcessRainOnVehicle(cVehicleParams *params)
+cAudioManager::ProcessRainOnVehicle(cVehicleParams& params)
{
const int rainOnVehicleIntensity = 22;
- if (params->m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
- CVehicle *veh = params->m_pVehicle;
+ if (params.m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
+ CVehicle *veh = params.m_pVehicle;
++veh->m_bRainAudioCounter;
if (veh->m_bRainAudioCounter >= 2) {
veh->m_bRainAudioCounter = 0;
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
float emittingVol = 30.f * CWeather::Rain;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
@@ -698,7 +698,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams *params)
}
bool
-cAudioManager::ProcessReverseGear(cVehicleParams *params)
+cAudioManager::ProcessReverseGear(cVehicleParams& params)
{
const int reverseGearIntensity = 30;
@@ -707,14 +707,14 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
int32 emittingVol;
float modificator;
- if (params->m_fDistance >= SQR(reverseGearIntensity))
+ if (params.m_fDistance >= SQR(reverseGearIntensity))
return false;
- veh = params->m_pVehicle;
+ veh = params.m_pVehicle;
if (veh->bEngineOn && (veh->m_fGasPedal < 0.0f || veh->m_nCurrentGear == 0)) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- automobile = (CAutomobile *)params->m_pVehicle;
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
+ automobile = (CAutomobile *)params.m_pVehicle;
if (automobile->m_nWheelsOnGround != 0) {
- modificator = params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity;
+ modificator = params.m_fVelocityChange / params.m_pTransmission->fMaxReverseVelocity;
} else {
if (automobile->m_nDriveWheelsOnGround != 0)
automobile->m_fGasPedalAudio *= 0.4f;
@@ -724,7 +724,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
emittingVol = (24.f * modificator);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
- if (params->m_pVehicle->m_fGasPedal >= 0.0f) {
+ if (params.m_pVehicle->m_fGasPedal >= 0.0f) {
m_sQueueSample.m_nCounter = 62;
m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2;
} else {
@@ -752,7 +752,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
}
void
-cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
+cAudioManager::ProcessModelCarEngine(cVehicleParams& params)
{
const float SOUND_INTENSITY = 30.0f;
CAutomobile *automobile;
@@ -760,24 +760,24 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
int32 emittingVol;
float velocityChange;
- if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
- automobile = (CAutomobile *)params->m_pVehicle;
+ if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
+ automobile = (CAutomobile *)params.m_pVehicle;
if (automobile->bEngineOn) {
if (automobile->m_nWheelsOnGround == 0) {
if (automobile->m_nDriveWheelsOnGround != 0)
automobile->m_fGasPedalAudio *= 0.4f;
- velocityChange = automobile->m_fGasPedalAudio * params->m_pTransmission->fMaxVelocity;
+ velocityChange = automobile->m_fGasPedalAudio * params.m_pTransmission->fMaxVelocity;
} else {
- velocityChange = Abs(params->m_fVelocityChange);
+ velocityChange = Abs(params.m_fVelocityChange);
}
if (velocityChange > 0.001f) {
- allowedVelocity = 0.5f * params->m_pTransmission->fMaxVelocity;
+ allowedVelocity = 0.5f * params.m_pTransmission->fMaxVelocity;
if (velocityChange < allowedVelocity)
emittingVol = (90.f * velocityChange / allowedVelocity);
else
emittingVol = 90;
if (emittingVol) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 2;
@@ -785,7 +785,7 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nFrequency = (11025.f * velocityChange / params->m_pTransmission->fMaxVelocity + 11025.f);
+ m_sQueueSample.m_nFrequency = (11025.f * velocityChange / params.m_pTransmission->fMaxVelocity + 11025.f);
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
@@ -807,7 +807,7 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
bool
-cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
+cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params)
{
const float SOUND_INTENSITY = 95.0f;
@@ -817,21 +817,21 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
int sampleFreq;
float velocity;
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false;
- if (params->m_pTransmission != nil) {
- if (((CAutomobile*)params->m_pVehicle)->m_nDriveWheelsOnGround != 0) {
- velocity = Abs(params->m_fVelocityChange);
+ if (params.m_pTransmission != nil) {
+ if (((CAutomobile*)params.m_pVehicle)->m_nDriveWheelsOnGround != 0) {
+ velocity = Abs(params.m_fVelocityChange);
if (velocity > 0.0f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- emittingVol = 30.f * Min(1.f, velocity / (0.5f * params->m_pTransmission->fMaxVelocity));
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
+ emittingVol = 30.f * Min(1.f, velocity / (0.5f * params.m_pTransmission->fMaxVelocity));
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
- if (params->m_pVehicle->m_nSurfaceTouched == SURFACE_WATER) {
+ if (params.m_pVehicle->m_nSurfaceTouched == SURFACE_WATER) {
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
freq = 6050 * emittingVol / 30 + 16000;
} else {
@@ -860,7 +860,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
}
bool
-cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
+cAudioManager::ProcessWetRoadNoise(cVehicleParams& params)
{
const float SOUND_INTENSITY = 30.0f;
@@ -870,14 +870,14 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
int freq;
float velChange;
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false;
- if (params->m_pTransmission != nil) {
- if (((CAutomobile *)params->m_pVehicle)->m_nDriveWheelsOnGround != 0) {
- velChange = Abs(params->m_fVelocityChange);
+ if (params.m_pTransmission != nil) {
+ if (((CAutomobile *)params.m_pVehicle)->m_nDriveWheelsOnGround != 0) {
+ velChange = Abs(params.m_fVelocityChange);
if (velChange > 0.f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- relativeVelocity = Min(1.0f, velChange / (0.5f * params->m_pTransmission->fMaxVelocity));
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
+ relativeVelocity = Min(1.0f, velChange / (0.5f * params.m_pTransmission->fMaxVelocity));
emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
@@ -912,7 +912,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
}
void
-cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
+cAudioManager::ProcessVehicleEngine(cVehicleParams& params)
{
const float SOUND_INTENSITY = 50.0f;
@@ -929,17 +929,17 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
float modificator;
float traction = 0.f;
- if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
+ if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
playerVeh = FindPlayerVehicle();
- veh = params->m_pVehicle;
+ veh = params.m_pVehicle;
if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) {
SampleManager.StopChannel(m_nActiveSamples);
return;
}
if (veh->bEngineOn) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- automobile = (CAutomobile *)params->m_pVehicle;
- if (params->m_nIndex == DODO) {
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
+ automobile = (CAutomobile *)params.m_pVehicle;
+ if (params.m_nIndex == DODO) {
ProcessCesna(params);
return;
}
@@ -947,14 +947,14 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
ProcessPlayersVehicleEngine(params, automobile);
return;
}
- transmission = params->m_pTransmission;
+ transmission = params.m_pTransmission;
if (transmission != nil) {
- currentGear = params->m_pVehicle->m_nCurrentGear;
+ currentGear = params.m_pVehicle->m_nCurrentGear;
if (automobile->m_nWheelsOnGround != 0) {
if (automobile->bIsHandbrakeOn) {
- if (params->m_fVelocityChange == 0.0f)
+ if (params.m_fVelocityChange == 0.0f)
traction = 0.9f;
- } else if (params->m_pVehicle->GetStatus() == STATUS_SIMPLE) {
+ } else if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE) {
traction = 0.0f;
} else {
switch (transmission->nDriveType) {
@@ -982,15 +982,15 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
relativeChange = 0.f;
} else if (currentGear != 0) {
relativeGearChange =
- Min(1.0f, (params->m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f);
+ Min(1.0f, (params.m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f);
if (traction == 0.0f && automobile->GetStatus() != STATUS_SIMPLE &&
- params->m_fVelocityChange < transmission->Gears[1].fShiftUpVelocity) {
+ params.m_fVelocityChange < transmission->Gears[1].fShiftUpVelocity) {
traction = 0.7f;
}
relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange;
} else
relativeChange =
- Min(1.0f, 1.0f - Abs((params->m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity));
+ Min(1.0f, 1.0f - Abs((params.m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity));
} else {
if (automobile->m_nDriveWheelsOnGround != 0)
automobile->m_fGasPedalAudio *= 0.4f;
@@ -1017,20 +1017,20 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
if (m_sQueueSample.m_nVolume != 0) {
if (automobile->GetStatus() == STATUS_SIMPLE) {
if (modificator < 0.02f) {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1;
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1;
freq = modificator * 10000 + 22050;
m_sQueueSample.m_nCounter = 52;
} else {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex;
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nAccelerationSampleIndex;
m_sQueueSample.m_nCounter = 2;
}
} else {
if (automobile->m_fGasPedal < 0.05f) {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1;
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1;
freq = modificator * 10000 + 22050;
m_sQueueSample.m_nCounter = 52;
} else {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex;
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nAccelerationSampleIndex;
m_sQueueSample.m_nCounter = 2;
}
}
@@ -1115,14 +1115,14 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl
}
void
-cAudioManager::ProcessCesna(cVehicleParams *params)
+cAudioManager::ProcessCesna(cVehicleParams& params)
{
static uint8 nAccel = 0;
- //((CAutomobile *)params->m_pVehicle)->Damage.GetEngineStatus();
+ //((CAutomobile *)params.m_pVehicle)->Damage.GetEngineStatus();
- if (FindPlayerVehicle() == params->m_pVehicle) {
- if (params->m_nIndex == DODO) {
+ if (FindPlayerVehicle() == params.m_pVehicle) {
+ if (params.m_nIndex == DODO) {
if (Pads[0].GetAccelerate() <= 0) {
if (nAccel != 0)
--nAccel;
@@ -1132,10 +1132,10 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, SFX_BANK_0, 52, true);
AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, SFX_BANK_0, 2, true);
}
- } else if (params->m_nIndex == DODO) {
+ } else if (params.m_nIndex == DODO) {
AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, SFX_BANK_0, 52, true);
- } else if (params->m_fDistance < SQR(200)) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ } else if (params.m_fDistance < SQR(200)) {
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 52;
@@ -1156,7 +1156,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
- if (params->m_fDistance < SQR(90)) {
+ if (params.m_fDistance < SQR(90)) {
m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 2;
@@ -1182,7 +1182,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
}
void
-cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile)
+cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *automobile)
{
static int32 GearFreqAdj[] = {6000, 6000, 3400, 1200, 0, -1000};
@@ -1234,13 +1234,13 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
accelerateState = Pads[0].GetAccelerate();
channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples);
- transmission = params->m_pTransmission;
- velocityChange = params->m_fVelocityChange;
+ transmission = params.m_pTransmission;
+ velocityChange = params.m_fVelocityChange;
relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity;
accelerationMultipler = clamp(relativeVelocityChange, 0.0f, 1.0f);
gasPedalAudio = accelerationMultipler;
- currentGear = params->m_pVehicle->m_nCurrentGear;
+ currentGear = params.m_pVehicle->m_nCurrentGear;
switch (transmission->nDriveType)
{
@@ -1265,20 +1265,20 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
}
if (velocityChange != 0.0f) {
- time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange;
+ time = params.m_pVehicle->m_vecMoveSpeed.z / velocityChange;
if (time > 0.0f)
freqModifier = -(Min(0.2f, time) * 3000.0f * 5.0f);
else
freqModifier = -(Max(-0.2f, time) * 3000.0f * 5.0f);
- if (params->m_fVelocityChange < -0.001f)
+ if (params.m_fVelocityChange < -0.001f)
freqModifier = -freqModifier;
} else
freqModifier = 0;
- engineSoundType = aVehicleSettings[params->m_nIndex].m_nBank;
+ engineSoundType = aVehicleSettings[params.m_nIndex].m_nBank;
soundOffset = 3 * (engineSoundType - CAR_SFX_BANKS_OFFSET);
if (accelerateState <= 0) {
- if (params->m_fVelocityChange < -0.001f) {
+ if (params.m_fVelocityChange < -0.001f) {
if (channelUsed) {
SampleManager.StopChannel(m_nActiveSamples);
bAccelSampleStopped = true;
@@ -1286,7 +1286,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction)
gasPedalAudio = automobile->m_fGasPedalAudio;
else
- gasPedalAudio = Min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity);
+ gasPedalAudio = Min(1.0f, params.m_fVelocityChange / params.m_pTransmission->fMaxReverseVelocity);
gasPedalAudio = Max(0.0f, gasPedalAudio);
automobile->m_fGasPedalAudio = gasPedalAudio;
@@ -1297,7 +1297,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
}
nCruising = 0;
if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction ||
- params->m_fVelocityChange < 0.01f && automobile->m_fGasPedalAudio > 0.2f) {
+ params.m_fVelocityChange < 0.01f && automobile->m_fGasPedalAudio > 0.2f) {
automobile->m_fGasPedalAudio *= 0.6f;
gasPedalAudio = automobile->m_fGasPedalAudio;
}
@@ -1355,7 +1355,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
if (!channelUsed) {
if (!processedAccelSampleStopped) {
- if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1)
+ if (CurrentPretendGear < params.m_pTransmission->nNumberOfGears - 1)
++CurrentPretendGear;
else {
nCruising = 1;
@@ -1386,10 +1386,10 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
if (nCruising != 0) {
bAccelSampleStopped = true;
if (accelerateState < 150 || automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction ||
- currentGear < params->m_pTransmission->nNumberOfGears - 1) {
+ currentGear < params.m_pTransmission->nNumberOfGears - 1) {
nCruising = 0;
} else {
- if (accelerateState >= 220 && params->m_fVelocityChange + 0.001f < automobile->m_fVelocityChangeForAudio) {
+ if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f < automobile->m_fVelocityChangeForAudio) {
if (nCruising < 800)
++nCruising;
} else if (nCruising > 3) {
@@ -1409,7 +1409,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
}
bool
-cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
+cAudioManager::ProcessVehicleSkidding(cVehicleParams& params)
{
const float SOUND_INTENSITY = 40.0f;
@@ -1419,31 +1419,31 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
float newSkidVal = 0.0f;
float skidVal = 0.0f;
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false;
- automobile = (CAutomobile *)params->m_pVehicle;
+ automobile = (CAutomobile *)params.m_pVehicle;
if (automobile->m_nWheelsOnGround == 0)
return true;
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
if (automobile->m_aWheelState[i] == WHEEL_STATE_NORMAL || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING)
continue;
- transmission = params->m_pTransmission;
+ transmission = params.m_pTransmission;
switch (transmission->nDriveType) {
case '4':
- newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params.m_fVelocityChange);
break;
case 'F':
if (i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT)
- newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params.m_fVelocityChange);
else
- newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params.m_fVelocityChange);
break;
case 'R':
if (i == CARWHEEL_REAR_LEFT || i == CARWHEEL_REAR_RIGHT)
- newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params.m_fVelocityChange);
else
- newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params.m_fVelocityChange);
break;
default:
break;
@@ -1456,7 +1456,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 3;
- switch (params->m_pVehicle->m_nSurfaceTouched) {
+ switch (params.m_pVehicle->m_nSurfaceTouched) {
case SURFACE_GRASS:
case SURFACE_HEDGE:
m_sQueueSample.m_nSampleIndex = SFX_RAIN;
@@ -1547,17 +1547,17 @@ cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automo
}
void
-cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
+cAudioManager::ProcessVehicleHorn(cVehicleParams& params)
{
const float SOUND_INTENSITY = 40.0f;
CAutomobile *automobile;
- if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
- automobile = (CAutomobile *)params->m_pVehicle;
- if ((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && automobile->GetModelIndex() != MI_MRWHOOP) {
+ if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
+ automobile = (CAutomobile *)params.m_pVehicle;
+ if ((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params.m_nIndex)) && automobile->GetModelIndex() != MI_MRWHOOP) {
if (automobile->m_nCarHornTimer) {
- if (params->m_pVehicle->GetStatus() != STATUS_PLAYER) {
+ if (params.m_pVehicle->GetStatus() != STATUS_PLAYER) {
automobile->m_nCarHornTimer = Min(44, automobile->m_nCarHornTimer);
if (automobile->m_nCarHornTimer == 44)
automobile->m_nCarHornPattern = (m_FrameCounter + m_sQueueSample.m_nEntityIndex) & 7;
@@ -1565,15 +1565,15 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
return;
}
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 4;
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nHornSample;
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nHornSample;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nHornFrequency;
+ m_sQueueSample.m_nFrequency = aVehicleSettings[params.m_nIndex].m_nHornFrequency;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = 80;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
@@ -1622,36 +1622,36 @@ cAudioManager::UsesSirenSwitching(int32 model) const
}
bool
-cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
+cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params)
{
const float SOUND_INTENSITY = 110.0f;
- if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
- CVehicle *veh = params->m_pVehicle;
+ if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
+ CVehicle *veh = params.m_pVehicle;
if (veh->m_bSirenOrAlarm == false && !veh->IsAlarmOn())
return true;
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 5;
- if (UsesSiren(params->m_nIndex)) {
- if (params->m_pVehicle->GetStatus() == STATUS_ABANDONED)
+ if (UsesSiren(params.m_nIndex)) {
+ if (params.m_pVehicle->GetStatus() == STATUS_ABANDONED)
return true;
- if (veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) {
+ if (veh->m_nCarHornTimer && params.m_nIndex != FIRETRUK) {
m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST;
- if (params->m_nIndex == FBICAR)
+ if (params.m_nIndex == FBICAR)
m_sQueueSample.m_nFrequency = 16113;
else
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SIREN_FAST);
m_sQueueSample.m_nCounter = 60;
} else {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample;
- m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency;
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nSirenOrAlarmSample;
+ m_sQueueSample.m_nFrequency = aVehicleSettings[params.m_nIndex].m_nSirenOrAlarmFrequency;
}
} else {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample;
- m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency;
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nSirenOrAlarmSample;
+ m_sQueueSample.m_nFrequency = aVehicleSettings[params.m_nIndex].m_nSirenOrAlarmFrequency;
}
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
@@ -1681,17 +1681,17 @@ cAudioManager::UsesReverseWarning(int32 model) const
}
bool
-cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params)
+cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params)
{
const float SOUND_INTENSITY = 50.0f;
- CVehicle *veh = params->m_pVehicle;
+ CVehicle *veh = params.m_pVehicle;
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false;
if (veh->bEngineOn && veh->m_fGasPedal < 0.0f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 12;
@@ -1717,7 +1717,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params)
}
bool
-cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
+cAudioManager::ProcessVehicleDoors(cVehicleParams& params)
{
const float SOUND_INTENSITY = 40.0f;
@@ -1726,11 +1726,11 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
int32 emittingVol;
float velocity;
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false;
- automobile = (CAutomobile *)params->m_pVehicle;
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ automobile = (CAutomobile *)params.m_pVehicle;
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
for (int32 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) {
if (automobile->Damage.GetDoorStatus(i) == DOOR_STATUS_SWINGING) {
doorState = automobile->Doors[i].m_nDoorState;
@@ -1765,22 +1765,22 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
}
bool
-cAudioManager::ProcessAirBrakes(cVehicleParams *params)
+cAudioManager::ProcessAirBrakes(cVehicleParams& params)
{
CAutomobile *automobile;
uint8 rand;
- if (params->m_fDistance > SQR(30))
+ if (params.m_fDistance > SQR(30))
return false;
- automobile = (CAutomobile *)params->m_pVehicle;
+ automobile = (CAutomobile *)params.m_pVehicle;
if (!automobile->bEngineOn)
return true;
- if ((automobile->m_fVelocityChangeForAudio < 0.025f || params->m_fVelocityChange >= 0.025f) &&
- (automobile->m_fVelocityChangeForAudio > -0.025f || params->m_fVelocityChange <= 0.025f))
+ if ((automobile->m_fVelocityChangeForAudio < 0.025f || params.m_fVelocityChange >= 0.025f) &&
+ (automobile->m_fVelocityChangeForAudio > -0.025f || params.m_fVelocityChange <= 0.025f))
return true;
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
rand = m_anRandomTable[0] % 10 + 70;
m_sQueueSample.m_nVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
@@ -1813,7 +1813,7 @@ cAudioManager::HasAirBrakes(int32 model) const
}
bool
-cAudioManager::ProcessEngineDamage(cVehicleParams *params)
+cAudioManager::ProcessEngineDamage(cVehicleParams& params)
{
const int engineDamageIntensity = 40;
@@ -1821,9 +1821,9 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
uint8 engineStatus;
uint8 emittingVolume;
- if (params->m_fDistance >= SQR(engineDamageIntensity))
+ if (params.m_fDistance >= SQR(engineDamageIntensity))
return false;
- veh = (CAutomobile *)params->m_pVehicle;
+ veh = (CAutomobile *)params.m_pVehicle;
if (veh->bEngineOn) {
engineStatus = veh->Damage.GetEngineStatus();
if (engineStatus > 250 || engineStatus < 100)
@@ -1839,7 +1839,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
}
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 28;
@@ -1862,15 +1862,15 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
}
bool
-cAudioManager::ProcessCarBombTick(cVehicleParams *params)
+cAudioManager::ProcessCarBombTick(cVehicleParams& params)
{
CAutomobile *automobile;
- if (params->m_fDistance >= SQR(40.f))
+ if (params.m_fDistance >= SQR(40.f))
return false;
- automobile = (CAutomobile *)params->m_pVehicle;
+ automobile = (CAutomobile *)params.m_pVehicle;
if (automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 35;
@@ -1896,7 +1896,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params)
}
void
-cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
+cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
{
int16 event;
uint8 emittingVol;
@@ -1925,12 +1925,11 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
const float SOUND_INTENSITY = 50.0f;
maxDist = SQR(SOUND_INTENSITY);
emittingVol = m_anRandomTable[2] % 5 + 122;
- switch (aVehicleSettings[params->m_nIndex].m_bDoorType) {
+ switch (aVehicleSettings[params.m_nIndex].m_bDoorType) {
case OLD_DOOR:
m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_CLOSE;
break;
case NEW_DOOR:
- default:
m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_CLOSE;
break;
case TRUCK_DOOR:
@@ -1939,9 +1938,16 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
case BUS_DOOR:
m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
break;
+ default:
+ m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_CLOSE;
+ break;
}
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
+#ifdef THIS_IS_STUPID
m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 22;
+#else
+ m_sQueueSample.m_nCounter = event + 22;
+#endif
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
m_sQueueSample.m_nReleasingVolumeModificator = 3;
@@ -1959,7 +1965,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
const float SOUND_INTENSITY = 50.0f;
maxDist = SQR(SOUND_INTENSITY);
emittingVol = m_anRandomTable[1] % 10 + 117;
- switch (aVehicleSettings[params->m_nIndex].m_bDoorType) {
+ switch (aVehicleSettings[params.m_nIndex].m_bDoorType) {
case OLD_DOOR:
m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_OPEN;
break;
@@ -1975,7 +1981,11 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
break;
}
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
+#ifdef THIS_IS_STUPID
m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 10;
+#else
+ m_sQueueSample.m_nCounter = event + 10;
+#endif
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
m_sQueueSample.m_nReleasingVolumeModificator = 3;
@@ -2007,7 +2017,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
iWheelIndex = 82;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TYRE_BUMP);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- if (params->m_nIndex == RCBANDIT) {
+ if (params.m_nIndex == RCBANDIT) {
m_sQueueSample.m_nFrequency *= 2;
emittingVol /= 2;
}
@@ -2236,16 +2246,16 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
pedParams.m_pPed = nil;
pedParams.m_bDistanceCalculated = false;
pedParams.m_fDistance = 0.0f;
- pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated;
- pedParams.m_fDistance = params->m_fDistance;
+ pedParams.m_bDistanceCalculated = params.m_bDistanceCalculated;
+ pedParams.m_fDistance = params.m_fDistance;
SetupPedComments(&pedParams, SOUND_PED_HELI_PLAYER_FOUND);
continue;
case SOUND_PED_BODYCAST_HIT:
pedParams.m_pPed = nil;
pedParams.m_bDistanceCalculated = false;
pedParams.m_fDistance = 0.0f;
- pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated;
- pedParams.m_fDistance = params->m_fDistance;
+ pedParams.m_bDistanceCalculated = params.m_bDistanceCalculated;
+ pedParams.m_fDistance = params.m_fDistance;
SetupPedComments(&pedParams, SOUND_PED_BODYCAST_HIT);
continue;
case SOUND_WATER_FALL: {
@@ -2298,8 +2308,8 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
default:
continue;
}
- if (params->m_fDistance < maxDist) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ if (params.m_fDistance < maxDist) {
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
if (noReflections) {
@@ -2321,7 +2331,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
}
bool
-cAudioManager::ProcessTrainNoise(cVehicleParams *params)
+cAudioManager::ProcessTrainNoise(cVehicleParams& params)
{
const float SOUND_INTENSITY = 300.0f;
@@ -2329,12 +2339,12 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
uint8 emittingVol;
float speedMultipler;
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false;
- if (params->m_fVelocityChange > 0.0f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- train = (CTrain *)params->m_pVehicle;
+ if (params.m_fVelocityChange > 0.0f) {
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
+ train = (CTrain *)params.m_pVehicle;
speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f);
emittingVol = (75.f * speedMultipler);
if (train->m_fWagonPosition == 0.0f) {
@@ -2360,7 +2370,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
}
}
const float SOUND_INTENSITY = 70.0f;
- if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
+ if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 33;
@@ -2387,7 +2397,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
}
bool
-cAudioManager::ProcessBoatEngine(cVehicleParams *params)
+cAudioManager::ProcessBoatEngine(cVehicleParams& params)
{
CBoat *boat;
float padRelativeAccerate;
@@ -2401,10 +2411,10 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
static const int intensity = 50;
- if (params->m_fDistance < SQR(intensity)) {
- boat = (CBoat *)params->m_pVehicle;
- if (params->m_nIndex == REEFER) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ if (params.m_fDistance < SQR(intensity)) {
+ boat = (CBoat *)params.m_pVehicle;
+ if (params.m_nIndex == REEFER) {
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 39;
@@ -2426,7 +2436,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
- if (FindPlayerVehicle() == params->m_pVehicle) {
+ if (FindPlayerVehicle() == params.m_pVehicle) {
padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake());
padRelativeAccerate = padAccelerate / 255;
emittingVol = (100.f * padRelativeAccerate) + 15;
@@ -2465,7 +2475,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
} else {
- if (FindPlayerVehicle() == params->m_pVehicle) {
+ if (FindPlayerVehicle() == params.m_pVehicle) {
padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake());
if (padAccelerate <= 20) {
emittingVol = 45 - 45 * padAccelerate / 40;
@@ -2502,7 +2512,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
}
}
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
if (!m_sQueueSample.m_nVolume)
return true;
@@ -2528,22 +2538,22 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
}
bool
-cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
+cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params)
{
float velocityChange;
int32 vol;
float multiplier;
- if (params->m_fDistance > SQR(50))
+ if (params.m_fDistance > SQR(50))
return false;
- velocityChange = Abs(params->m_fVelocityChange);
- if (velocityChange <= 0.0005f && ((CBoat*)params->m_pVehicle)->bBoatInWater)
+ velocityChange = Abs(params.m_fVelocityChange);
+ if (velocityChange <= 0.0005f && ((CBoat*)params.m_pVehicle)->bBoatInWater)
return true;
velocityChange = Min(0.75f, velocityChange);
multiplier = (velocityChange - 0.0005f) / (1499.0f / 2000.0f);
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
vol = (30.f * multiplier);
m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
@@ -2576,7 +2586,7 @@ struct tHelicopterSampleData {
};
bool
-cAudioManager::ProcessHelicopter(cVehicleParams *params)
+cAudioManager::ProcessHelicopter(cVehicleParams& params)
{
CHeli *heli;
float MaxDist;
@@ -2585,11 +2595,11 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params)
int32 emittingVol;
static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, MAX_VOLUME}, {60.f, 30.f, MAX_VOLUME}};
- if (SQR(gHeliSfxRanges[0].m_fMaxDistance) <= params->m_fDistance)
+ if (SQR(gHeliSfxRanges[0].m_fMaxDistance) <= params.m_fDistance)
return false;
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- heli = (CHeli *)params->m_pVehicle;
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
+ heli = (CHeli *)params.m_pVehicle;
for (uint32 i = 0; i < ARRAY_SIZE(gHeliSfxRanges); i++) {
MaxDist = gHeliSfxRanges[i].m_fMaxDistance;
dist = m_sQueueSample.m_fDistance;
@@ -2626,9 +2636,9 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params)
}
void
-cAudioManager::ProcessPlane(cVehicleParams *params)
+cAudioManager::ProcessPlane(cVehicleParams& params)
{
- switch (params->m_nIndex) {
+ switch (params.m_nIndex) {
case AIRTRAIN:
ProcessJumbo(params);
break;
@@ -2636,7 +2646,7 @@ cAudioManager::ProcessPlane(cVehicleParams *params)
ProcessCesna(params);
break;
default:
- debug("Plane Model Id is %d\n, ", params->m_pVehicle->GetModelIndex());
+ debug("Plane Model Id is %d\n, ", params.m_pVehicle->GetModelIndex());
break;
}
}
@@ -2652,14 +2662,14 @@ DoJumboVolOffset()
}
void
-cAudioManager::ProcessJumbo(cVehicleParams *params)
+cAudioManager::ProcessJumbo(cVehicleParams& params)
{
CPlane *plane;
float position;
- if (params->m_fDistance < SQR(440)) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- plane = (CPlane *)params->m_pVehicle;
+ if (params.m_fDistance < SQR(440)) {
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
+ plane = (CPlane *)params.m_pVehicle;
DoJumboVolOffset();
position = PlanePathPosition[plane->m_nPlaneId];
if (position <= TakeOffPoint) {
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index cf6363bc..2d971ac9 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -362,29 +362,29 @@ public:
void PreTerminateGameSpecificShutdown();
/// processX - main logic of adding new sounds
void ProcessActiveQueues();
- bool ProcessAirBrakes(cVehicleParams *params);
+ bool ProcessAirBrakes(cVehicleParams& params);
void ProcessAirportScriptObject(uint8 sound);
- bool ProcessBoatEngine(cVehicleParams *params);
- bool ProcessBoatMovingOverWater(cVehicleParams *params);
+ bool ProcessBoatEngine(cVehicleParams& params);
+ bool ProcessBoatMovingOverWater(cVehicleParams& params);
void ProcessBridge();
void ProcessBridgeMotor();
void ProcessBridgeOneShots();
void ProcessBridgeWarning();
- bool ProcessCarBombTick(cVehicleParams *params);
- void ProcessCesna(cVehicleParams *params);
+ bool ProcessCarBombTick(cVehicleParams& params);
+ void ProcessCesna(cVehicleParams& params);
void ProcessCinemaScriptObject(uint8 sound);
void ProcessCrane();
void ProcessDocksScriptObject(uint8 sound);
- bool ProcessEngineDamage(cVehicleParams *params);
+ bool ProcessEngineDamage(cVehicleParams& params);
void ProcessEntity(int32 sound);
void ProcessExplosions(int32 explosion);
void ProcessFireHydrant();
void ProcessFires(int32 entity);
void ProcessFrontEnd();
void ProcessGarages();
- bool ProcessHelicopter(cVehicleParams *params);
+ bool ProcessHelicopter(cVehicleParams& params);
void ProcessHomeScriptObject(uint8 sound);
- void ProcessJumbo(cVehicleParams *);
+ void ProcessJumbo(cVehicleParams& params);
void ProcessJumboAccel(CPlane *plane);
void ProcessJumboDecel(CPlane *plane);
void ProcessJumboFlying();
@@ -394,37 +394,37 @@ public:
void ProcessLaunderetteScriptObject(uint8 sound);
void ProcessLoopingScriptObject(uint8 sound);
void ProcessMissionAudio();
- void ProcessModelCarEngine(cVehicleParams *params);
+ void ProcessModelCarEngine(cVehicleParams& params);
void ProcessOneShotScriptObject(uint8 sound);
void ProcessPed(CPhysical *ped);
void ProcessPedHeadphones(cPedParams *params);
void ProcessPedOneShots(cPedParams *params);
void ProcessPhysical(int32 id);
- void ProcessPlane(cVehicleParams *params);
- void ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile);
+ void ProcessPlane(cVehicleParams& params);
+ void ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *automobile);
void ProcessPoliceCellBeatingScriptObject(uint8 sound);
void ProcessPornCinema(uint8 sound);
void ProcessProjectiles();
- void ProcessRainOnVehicle(cVehicleParams *params);
+ void ProcessRainOnVehicle(cVehicleParams& params);
void ProcessReverb() const;
- bool ProcessReverseGear(cVehicleParams *params);
+ bool ProcessReverseGear(cVehicleParams& params);
void ProcessSawMillScriptObject(uint8 sound);
void ProcessScriptObject(int32 id);
void ProcessShopScriptObject(uint8 sound);
void ProcessSpecial();
- bool ProcessTrainNoise(cVehicleParams *params);
+ bool ProcessTrainNoise(cVehicleParams& params);
void ProcessVehicle(CVehicle *vehicle);
- bool ProcessVehicleDoors(cVehicleParams *params);
- void ProcessVehicleEngine(cVehicleParams *params);
- void ProcessVehicleHorn(cVehicleParams *params);
- void ProcessVehicleOneShots(cVehicleParams *params);
- bool ProcessVehicleReverseWarning(cVehicleParams *params);
- bool ProcessVehicleRoadNoise(cVehicleParams *params);
- bool ProcessVehicleSirenOrAlarm(cVehicleParams *params);
- bool ProcessVehicleSkidding(cVehicleParams *params);
+ bool ProcessVehicleDoors(cVehicleParams& params);
+ void ProcessVehicleEngine(cVehicleParams& params);
+ void ProcessVehicleHorn(cVehicleParams& params);
+ void ProcessVehicleOneShots(cVehicleParams& params);
+ bool ProcessVehicleReverseWarning(cVehicleParams& params);
+ bool ProcessVehicleRoadNoise(cVehicleParams& params);
+ bool ProcessVehicleSirenOrAlarm(cVehicleParams& params);
+ bool ProcessVehicleSkidding(cVehicleParams& params);
void ProcessWaterCannon(int32);
void ProcessWeather(int32 id);
- bool ProcessWetRoadNoise(cVehicleParams *params);
+ bool ProcessWetRoadNoise(cVehicleParams& params);
void ProcessWorkShopScriptObject(uint8 sound);
int32 RandomDisplacement(uint32 seed) const;