summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authorwithmorten <morten.with@gmail.com>2021-06-28 13:57:05 +0200
committerwithmorten <morten.with@gmail.com>2021-06-28 13:57:05 +0200
commitd17d437de319ca4c388dc724cffea91702d3a699 (patch)
tree806104fa5fe0e994cd7f55f1b7b48dc64a998c44 /src/audio
parentRedo ReadSaveBuf + common.h cleanup (diff)
downloadre3-d17d437de319ca4c388dc724cffea91702d3a699.tar
re3-d17d437de319ca4c388dc724cffea91702d3a699.tar.gz
re3-d17d437de319ca4c388dc724cffea91702d3a699.tar.bz2
re3-d17d437de319ca4c388dc724cffea91702d3a699.tar.lz
re3-d17d437de319ca4c388dc724cffea91702d3a699.tar.xz
re3-d17d437de319ca4c388dc724cffea91702d3a699.tar.zst
re3-d17d437de319ca4c388dc724cffea91702d3a699.zip
Diffstat (limited to '')
-rw-r--r--src/audio/AudioLogic.cpp22
-rw-r--r--src/audio/AudioManager.cpp8
-rw-r--r--src/audio/oal/stream.cpp10
-rw-r--r--src/audio/sampman_miles.cpp2
-rw-r--r--src/audio/sampman_oal.cpp4
5 files changed, 23 insertions, 23 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index e4340bdc..3ec40437 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -989,8 +989,8 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params)
freq = 25000;
}
if (isPlayerVeh) {
- volume = clamp2(volume, prevVolume, 7);
- freq = clamp2(freq, prevFreq, 800);
+ volume = Clamp2(volume, prevVolume, 7);
+ freq = Clamp2(freq, prevFreq, 800);
}
if (volume > 0) {
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
@@ -1038,8 +1038,8 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params)
freq = Min(22000, (8000 * acceletateState / 255 + 14000) * 3.0f * Abs(params.m_fVelocityChange));
}
if (isPlayerVeh && !vehSlowdown) {
- volume = clamp2(volume, prevVolume, 7);
- freq = clamp2(freq, prevFreq, 800);
+ volume = Clamp2(volume, prevVolume, 7);
+ freq = Clamp2(freq, prevFreq, 800);
}
if (!vehSlowdown)
#ifdef THIS_IS_STUPID
@@ -1118,7 +1118,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params)
}
if (acceletateState < brakeState)
acceletateState = brakeState;
- freq = clamp2(5 * acceletateState + 22050, prevFreq, 30);
+ freq = Clamp2(5 * acceletateState + 22050, prevFreq, 30);
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(70, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
@@ -1658,8 +1658,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
bHandbrakeOnLastFrame = FALSE;
}
if (CReplay::IsPlayingBack()) {
- accelerateState = (255.0f * clamp(params.m_pVehicle->m_fGasPedal, 0.0f, 1.0f));
- brakeState = (255.0f * clamp(params.m_pVehicle->m_fBrakePedal, 0.0f, 1.0f));
+ accelerateState = (255.0f * Clamp(params.m_pVehicle->m_fGasPedal, 0.0f, 1.0f));
+ brakeState = (255.0f * Clamp(params.m_pVehicle->m_fBrakePedal, 0.0f, 1.0f));
} else {
accelerateState = Pads[0].GetAccelerate();
brakeState = Pads[0].GetBrake();
@@ -1810,7 +1810,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
}
}
relativeVelocityChange = 2.0f * params.m_fVelocityChange / params.m_pTransmission->fMaxVelocity;
- accelerationMultipler = clamp(relativeVelocityChange, 0.0f, 1.0f);
+ accelerationMultipler = Clamp(relativeVelocityChange, 0.0f, 1.0f);
gasPedalAudio = accelerationMultipler;
switch (engineSoundType) {
case SFX_BANK_MOPED:
@@ -3585,7 +3585,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_nFrequency = 14287 + Min(1.0f, freqModifier) * 3713;
if (propellerSpeed < 1.0f)
m_sQueueSample.m_nFrequency = (propellerSpeed + 1.0f) * (m_sQueueSample.m_nFrequency / 2.0f);
- m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqFrontPrev, 197);
+ m_sQueueSample.m_nFrequency = Clamp2(m_sQueueSample.m_nFrequency, freqFrontPrev, 197);
freqFrontPrev = m_sQueueSample.m_nFrequency;
m_sQueueSample.m_bIs2D = FALSE;
@@ -3641,7 +3641,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
if (propellerSpeed < 1.0f)
m_sQueueSample.m_nFrequency = (propellerSpeed + 1) * (m_sQueueSample.m_nFrequency / 2);
- m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqPropellerPrev, 98);
+ m_sQueueSample.m_nFrequency = Clamp2(m_sQueueSample.m_nFrequency, freqPropellerPrev, 98);
freqPropellerPrev = m_sQueueSample.m_nFrequency;
} else {
m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_MAI2;
@@ -3710,7 +3710,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_nFrequency = 14287 + Min(1.0f, freqModifier) * 3713;
if (propellerSpeed < 1.0f)
m_sQueueSample.m_nFrequency = (propellerSpeed + 1) * (m_sQueueSample.m_nFrequency / 2.0f);
- m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqSkimmerPrev, 197);
+ m_sQueueSample.m_nFrequency = Clamp2(m_sQueueSample.m_nFrequency, freqSkimmerPrev, 197);
freqSkimmerPrev = m_sQueueSample.m_nFrequency;
m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO4;
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index aa6a0653..360a2275 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -331,7 +331,7 @@ cAudioManager::Get3DProviderName(uint8 id) const
if (!m_bIsInitialised)
return nil;
#ifdef AUDIO_OAL
- id = clamp(id, 0, SampleManager.GetNum3DProvidersAvailable() - 1);
+ id = Clamp(id, 0, SampleManager.GetNum3DProvidersAvailable() - 1);
#else
// We don't want that either since it will crash the game, but skipping for now
if (id >= SampleManager.GetNum3DProvidersAvailable())
@@ -531,7 +531,7 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1,
if (dist != 0.0f) {
float speedOfSource = (dist / m_nTimeSpent) * speedMultiplier;
if (m_fSpeedOfSound > Abs(speedOfSource)) {
- speedOfSource = clamp2(speedOfSource, 0.0f, 1.5f);
+ speedOfSource = Clamp2(speedOfSource, 0.0f, 1.5f);
newFreq = (oldFreq * m_fSpeedOfSound) / (speedOfSource + m_fSpeedOfSound);
}
}
@@ -895,11 +895,11 @@ cAudioManager::ProcessActiveQueues()
sample.m_fSpeedMultiplier);
if (sample.m_nFrequency != m_asActiveSamples[j].m_nFrequency) {
- m_asActiveSamples[j].m_nFrequency = clamp2((int32)sample.m_nFrequency, (int32)m_asActiveSamples[j].m_nFrequency, 6000);
+ m_asActiveSamples[j].m_nFrequency = Clamp2((int32)sample.m_nFrequency, (int32)m_asActiveSamples[j].m_nFrequency, 6000);
SampleManager.SetChannelFrequency(j, m_asActiveSamples[j].m_nFrequency);
}
if (sample.m_nEmittingVolume != m_asActiveSamples[j].m_nEmittingVolume) {
- vol = clamp2((int8)sample.m_nEmittingVolume, (int8)m_asActiveSamples[j].m_nEmittingVolume, 10);
+ vol = Clamp2((int8)sample.m_nEmittingVolume, (int8)m_asActiveSamples[j].m_nEmittingVolume, 10);
if (field_4) {
emittingVol = 2 * Min(63, vol);
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index ab266681..7fc36acd 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -162,7 +162,7 @@ public:
else
StepIndex--;
- StepIndex = clamp(StepIndex, 0, 88);
+ StepIndex = Clamp(StepIndex, 0, 88);
int delta = step >> 3;
if (adpcm & 1) delta += step >> 2;
@@ -171,7 +171,7 @@ public:
if (adpcm & 8) delta = -delta;
int newSample = Sample + delta;
- Sample = clamp(newSample, -32768, 32767);
+ Sample = Clamp(newSample, -32768, 32767);
return Sample;
}
};
@@ -716,7 +716,7 @@ public:
static short quantize(double sample)
{
int a = int(sample + 0.5);
- return short(clamp(a, -32768, 32767));
+ return short(Clamp(a, -32768, 32767));
}
void Decode(void* _inbuf, int16* _outbuf, size_t size)
@@ -1448,10 +1448,10 @@ void CStream::SetVolume(uint32 nVol)
void CStream::SetPan(uint8 nPan)
{
- m_nPan = clamp((int8)nPan - 63, 0, 63);
+ m_nPan = Clamp((int8)nPan - 63, 0, 63);
SetPosition(0, (m_nPan - 63) / 64.0f, 0.0f, Sqrt(1.0f - SQR((m_nPan - 63) / 64.0f)));
- m_nPan = clamp((int8)nPan + 64, 64, 127);
+ m_nPan = Clamp((int8)nPan + 64, 64, 127);
SetPosition(1, (m_nPan - 63) / 64.0f, 0.0f, Sqrt(1.0f - SQR((m_nPan - 63) / 64.0f)));
m_nPan = nPan;
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index 8191cbf7..e8c28dc4 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -1659,7 +1659,7 @@ cSampleManager::UpdateReverb(void)
#undef CALCULATE_RATIO
#undef MIN_DIST
- fRatio = clamp(fRatio, 0.0f, 0.6f);
+ fRatio = Clamp(fRatio, 0.0f, 0.6f);
if ( fRatio == _fPrevEaxRatioDestination )
return FALSE;
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 2c7d4cec..fa262c98 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -356,7 +356,7 @@ int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
{
int savedprovider = curprovider;
- nProvider = clamp(nProvider, 0, m_nNumberOfProviders - 1);
+ nProvider = Clamp(nProvider, 0, m_nNumberOfProviders - 1);
if ( set_new_provider(nProvider) )
return curprovider;
@@ -1449,7 +1449,7 @@ bool8 cSampleManager::UpdateReverb(void)
#undef CALCULATE_RATIO
#undef MIN_DIST
- fRatio = clamp(fRatio, 0.0f, 0.6f);
+ fRatio = Clamp(fRatio, 0.0f, 0.6f);
if ( fRatio == _fPrevEaxRatioDestination )
return FALSE;