General: Amend clamp parameter order

Batch replace on switching to standardized variants assumed common
ordering, which evidently wasn't the case
This commit is contained in:
Lioncash
2019-09-07 06:21:07 -04:00
parent 5da58eb1da
commit 50c4b5cdab
16 changed files with 144 additions and 123 deletions

View File

@@ -38,21 +38,21 @@ public:
using ImpType = EffectChorusImp<T>;
void setBaseDelay(uint32_t baseDelay) {
baseDelay = std::clamp(5u, baseDelay, 15u);
baseDelay = std::clamp(baseDelay, 5u, 15u);
x90_baseDelay = baseDelay;
m_dirty = true;
}
uint32_t getBaseDelay() const { return x90_baseDelay; }
void setVariation(uint32_t variation) {
variation = std::clamp(0u, variation, 5u);
variation = std::clamp(variation, 0u, 5u);
x94_variation = variation;
m_dirty = true;
}
uint32_t getVariation() const { return x94_variation; }
void setPeriod(uint32_t period) {
period = std::clamp(500u, period, 10000u);
period = std::clamp(period, 500u, 10000u);
x98_period = period;
m_dirty = true;
}

View File

@@ -51,41 +51,41 @@ public:
using ImpType = EffectDelayImp<T>;
void setDelay(uint32_t delay) {
delay = std::clamp(10u, delay, 5000u);
delay = std::clamp(delay, 10u, 5000u);
for (int i = 0; i < 8; ++i)
x3c_delay[i] = delay;
m_dirty = true;
}
void setChanDelay(int chanIdx, uint32_t delay) {
delay = std::clamp(10u, delay, 5000u);
delay = std::clamp(delay, 10u, 5000u);
x3c_delay[chanIdx] = delay;
m_dirty = true;
}
uint32_t getChanDelay(int chanIdx) const { return x3c_delay[chanIdx]; }
void setFeedback(uint32_t feedback) {
feedback = std::clamp(0u, feedback, 100u);
feedback = std::clamp(feedback, 0u, 100u);
for (int i = 0; i < 8; ++i)
x48_feedback[i] = feedback;
m_dirty = true;
}
void setChanFeedback(int chanIdx, uint32_t feedback) {
feedback = std::clamp(0u, feedback, 100u);
feedback = std::clamp(feedback, 0u, 100u);
x48_feedback[chanIdx] = feedback;
m_dirty = true;
}
uint32_t getChanFeedback(int chanIdx) const { return x48_feedback[chanIdx]; }
void setOutput(uint32_t output) {
output = std::clamp(0u, output, 100u);
output = std::clamp(output, 0u, 100u);
for (int i = 0; i < 8; ++i)
x54_output[i] = output;
m_dirty = true;
}
void setChanOutput(int chanIdx, uint32_t output) {
output = std::clamp(0u, output, 100u);
output = std::clamp(output, 0u, 100u);
x54_output[chanIdx] = output;
m_dirty = true;
}
@@ -93,9 +93,9 @@ public:
void setParams(const EffectDelayInfo& info) {
for (int i = 0; i < 8; ++i) {
x3c_delay[i] = std::clamp(10u, info.delay[i], 5000u);
x48_feedback[i] = std::clamp(0u, info.feedback[i], 100u);
x54_output[i] = std::clamp(0u, info.output[i], 100u);
x3c_delay[i] = std::clamp(info.delay[i], 10u, 5000u);
x48_feedback[i] = std::clamp(info.feedback[i], 0u, 100u);
x54_output[i] = std::clamp(info.output[i], 0u, 100u);
}
m_dirty = true;
}

View File

@@ -75,31 +75,31 @@ public:
using ImpType = EffectReverbStdImp<T>;
void setColoration(float coloration) {
x140_x1c8_coloration = std::clamp(0.f, coloration, 1.f);
x140_x1c8_coloration = std::clamp(coloration, 0.f, 1.f);
m_dirty = true;
}
float getColoration() const { return x140_x1c8_coloration; }
void setMix(float mix) {
x144_x1cc_mix = std::clamp(0.f, mix, 1.f);
x144_x1cc_mix = std::clamp(mix, 0.f, 1.f);
m_dirty = true;
}
float getMix() const { return x144_x1cc_mix; }
void setTime(float time) {
x148_x1d0_time = std::clamp(0.01f, time, 10.f);
x148_x1d0_time = std::clamp(time, 0.01f, 10.f);
m_dirty = true;
}
float getTime() const { return x148_x1d0_time; }
void setDamping(float damping) {
x14c_x1d4_damping = std::clamp(0.f, damping, 1.f);
x14c_x1d4_damping = std::clamp(damping, 0.f, 1.f);
m_dirty = true;
}
float getDamping() const { return x14c_x1d4_damping; }
void setPreDelay(float preDelay) {
x150_x1d8_preDelay = std::clamp(0.f, preDelay, 0.1f);
x150_x1d8_preDelay = std::clamp(preDelay, 0.f, 0.1f);
m_dirty = true;
}
float getPreDelay() const { return x150_x1d8_preDelay; }
@@ -126,7 +126,7 @@ public:
using ImpType = EffectReverbHiImp<T>;
void setCrosstalk(float crosstalk) {
x1dc_crosstalk = std::clamp(0.f, crosstalk, 1.f);
x1dc_crosstalk = std::clamp(crosstalk, 0.f, 1.f);
m_dirty = true;
}
float getCrosstalk() const { return x1dc_crosstalk; }

View File

@@ -56,7 +56,7 @@ public:
void setVectors(const float* pos, const float* dir);
void setMaxVol(float maxVol) {
m_maxVol = std::clamp(0.f, maxVol, 1.f);
m_maxVol = std::clamp(maxVol, 0.f, 1.f);
m_dirty = true;
}

View File

@@ -19,10 +19,10 @@ class Listener {
public:
Listener(float volume, float frontDiff, float backDiff, float soundSpeed)
: m_volume(std::clamp(0.f, volume, 1.f)), m_frontDiff(frontDiff), m_backDiff(backDiff), m_soundSpeed(soundSpeed) {}
: m_volume(std::clamp(volume, 0.f, 1.f)), m_frontDiff(frontDiff), m_backDiff(backDiff), m_soundSpeed(soundSpeed) {}
void setVectors(const float* pos, const float* dir, const float* heading, const float* up);
void setVolume(float vol) {
m_volume = std::clamp(0.f, vol, 1.f);
m_volume = std::clamp(vol, 0.f, 1.f);
m_dirty = true;
}
};