mirror of
https://github.com/AndroidAudioMods/ViPERFX_RE.git
synced 2025-06-08 02:29:40 +08:00
ViPERDDC: Do not spam log when sampling rate is invalid
This commit is contained in:
parent
0c86463646
commit
11e5cb6918
@ -12,6 +12,7 @@ ViPERDDC::ViPERDDC() :
|
|||||||
void ViPERDDC::Process(float *samples, uint32_t size) {
|
void ViPERDDC::Process(float *samples, uint32_t size) {
|
||||||
if (!this->setCoeffsOk || this->arrSize == 0) return;
|
if (!this->setCoeffsOk || this->arrSize == 0) return;
|
||||||
if (!this->enable) return;
|
if (!this->enable) return;
|
||||||
|
if (!isSamplingRateValid()) return;
|
||||||
|
|
||||||
std::vector<std::array<float, 5>> *coeffsArr;
|
std::vector<std::array<float, 5>> *coeffsArr;
|
||||||
|
|
||||||
@ -24,10 +25,6 @@ void ViPERDDC::Process(float *samples, uint32_t size) {
|
|||||||
coeffsArr = &this->coeffsArr48000;
|
coeffsArr = &this->coeffsArr48000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
|
||||||
VIPER_LOGD("ViPERDDC::Process() -> Invalid sampling rate: %d", this->samplingRate);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < size * 2; i += 2) {
|
for (uint32_t i = 0; i < size * 2; i += 2) {
|
||||||
@ -101,7 +98,7 @@ void ViPERDDC::Reset() {
|
|||||||
memset(this->x1R.data(), 0, this->arrSize * sizeof(float));
|
memset(this->x1R.data(), 0, this->arrSize * sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViPERDDC::SetCoeffs(uint32_t newCoeffsSize, float *newCoeffs44100, float *newCoeffs48000) {
|
void ViPERDDC::SetCoeffs(uint32_t newCoeffsSize, const float *newCoeffs44100, const float *newCoeffs48000) {
|
||||||
ReleaseResources();
|
ReleaseResources();
|
||||||
|
|
||||||
if (newCoeffsSize == 0) return;
|
if (newCoeffsSize == 0) return;
|
||||||
@ -148,6 +145,13 @@ void ViPERDDC::SetEnable(bool enable) {
|
|||||||
void ViPERDDC::SetSamplingRate(uint32_t samplingRate) {
|
void ViPERDDC::SetSamplingRate(uint32_t samplingRate) {
|
||||||
if (this->samplingRate != samplingRate) {
|
if (this->samplingRate != samplingRate) {
|
||||||
this->samplingRate = samplingRate;
|
this->samplingRate = samplingRate;
|
||||||
|
if (!isSamplingRateValid()) {
|
||||||
|
VIPER_LOGE("ViPERDDC::SetSamplingRate() -> Invalid sampling rate: %d", this->samplingRate);
|
||||||
|
}
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ViPERDDC::isSamplingRateValid() const {
|
||||||
|
return this->samplingRate == 44100 || this->samplingRate == 48000;
|
||||||
|
}
|
||||||
|
@ -10,7 +10,7 @@ public:
|
|||||||
|
|
||||||
void Process(float *samples, uint32_t size);
|
void Process(float *samples, uint32_t size);
|
||||||
void Reset();
|
void Reset();
|
||||||
void SetCoeffs(uint32_t newCoeffsSize, float *newCoeffs44100, float *newCoeffs48000);
|
void SetCoeffs(uint32_t newCoeffsSize, const float *newCoeffs44100, const float *newCoeffs48000);
|
||||||
void SetEnable(bool enable);
|
void SetEnable(bool enable);
|
||||||
void SetSamplingRate(uint32_t samplingRate);
|
void SetSamplingRate(uint32_t samplingRate);
|
||||||
|
|
||||||
@ -31,6 +31,7 @@ private:
|
|||||||
std::vector<float> y2R;
|
std::vector<float> y2R;
|
||||||
|
|
||||||
void ReleaseResources();
|
void ReleaseResources();
|
||||||
|
bool isSamplingRateValid() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user