Disable sampling rate cap

Only some of the effects rely on the sampling rate being at most 48kHz, it's better to handle this inside the effects themselves.
This commit is contained in:
Iscle 2023-05-16 03:12:51 +02:00
parent bf580b11ad
commit 3361fbfb7e
4 changed files with 12 additions and 14 deletions

View File

@ -37,27 +37,27 @@ void ViperContext::handleSetConfig(effect_config_t *newConfig) {
if (newConfig->inputCfg.buffer.frameCount != newConfig->outputCfg.buffer.frameCount) {
VIPER_LOGE("ViPER4Android disabled, reason [in.FC = %ld, out.FC = %ld]",
newConfig->inputCfg.buffer.frameCount, newConfig->outputCfg.buffer.frameCount);
setDisableReason(DisableReason::INVALID_FRAME_COUNT);
setDisableReason(DisableReason::INVALID_FRAME_COUNT, "Input and output frame count mismatch");
return;
}
if (newConfig->inputCfg.samplingRate != newConfig->outputCfg.samplingRate) {
VIPER_LOGE("ViPER4Android disabled, reason [in.SR = %d, out.SR = %d]",
newConfig->inputCfg.samplingRate, newConfig->outputCfg.samplingRate);
setDisableReason(DisableReason::INVALID_SAMPLING_RATE);
setDisableReason(DisableReason::INVALID_SAMPLING_RATE, "Input and output sampling rate mismatch");
return;
}
if (newConfig->inputCfg.samplingRate > 48000) {
VIPER_LOGE("ViPER4Android disabled, reason [SR out of range]");
setDisableReason(DisableReason::INVALID_SAMPLING_RATE, "Sampling rate out of range: " + std::to_string(newConfig->inputCfg.samplingRate));
return;
}
// if (newConfig->inputCfg.samplingRate > 48000) {
// VIPER_LOGE("ViPER4Android disabled, reason [SR out of range]");
// setDisableReason(DisableReason::INVALID_SAMPLING_RATE, "Sampling rate out of range: " + std::to_string(newConfig->inputCfg.samplingRate));
// return;
// }
if (newConfig->inputCfg.channels != newConfig->outputCfg.channels) {
VIPER_LOGE("ViPER4Android disabled, reason [in.CH = %d, out.CH = %d]",
newConfig->inputCfg.channels, newConfig->outputCfg.channels);
setDisableReason(DisableReason::INVALID_CHANNEL_COUNT);
setDisableReason(DisableReason::INVALID_CHANNEL_COUNT, "Input and output channel count mismatch");
return;
}

View File

@ -5,6 +5,7 @@
// Basically Bauer-to-Stereophonic Binaural filter
// See: http://bs2b.sourceforge.net/
Crossfeed::Crossfeed() {
this->a0_lo = 0.f;
this->b1_lo = 0.f;

View File

@ -99,7 +99,6 @@ static const float MIN_PHASE_IIR_COEFFS_FREQ_31BANDS[] = {
MinPhaseIIRCoeffs::MinPhaseIIRCoeffs() {
this->coeffs = nullptr;
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;
this->bands = 0;
}
@ -153,12 +152,11 @@ int MinPhaseIIRCoeffs::SolveRoot(double param_2, double param_3, double param_4,
}
int MinPhaseIIRCoeffs::UpdateCoeffs(uint32_t bands, uint32_t samplingRate) {
if ((bands != 10 && bands != 15 && bands != 25 && bands != 31) || samplingRate < 44100) {
if (bands != 10 && bands != 15 && bands != 25 && bands != 31) {
return 0;
}
this->bands = bands;
this->samplingRate = samplingRate;
delete[] this->coeffs;
this->coeffs = new double[bands * 4](); // TODO: Check this array size, original type: float
@ -191,8 +189,8 @@ int MinPhaseIIRCoeffs::UpdateCoeffs(uint32_t bands, uint32_t samplingRate) {
Find_F1_F2(bandFreqs[i], tmp, &ret2, &ret1);
double x = (2.0 * M_PI * (double) bandFreqs[i]) / (double) this->samplingRate;
double y = (2.0 * M_PI * ret2) / (double) this->samplingRate;
double x = (2.0 * M_PI * (double) bandFreqs[i]) / (double) samplingRate;
double y = (2.0 * M_PI * ret2) / (double) samplingRate;
double cosX = cos(x);
double cosY = cos(y);

View File

@ -18,6 +18,5 @@ private:
int SolveRoot(double param_2, double param_3, double param_4, double *param_5);
double *coeffs;
uint32_t samplingRate;
uint32_t bands;
};