mirror of
https://github.com/AndroidAudioMods/ViPERFX_RE.git
synced 2024-12-22 22:47:25 +08:00
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:
parent
bf580b11ad
commit
3361fbfb7e
@ -37,27 +37,27 @@ void ViperContext::handleSetConfig(effect_config_t *newConfig) {
|
|||||||
if (newConfig->inputCfg.buffer.frameCount != newConfig->outputCfg.buffer.frameCount) {
|
if (newConfig->inputCfg.buffer.frameCount != newConfig->outputCfg.buffer.frameCount) {
|
||||||
VIPER_LOGE("ViPER4Android disabled, reason [in.FC = %ld, out.FC = %ld]",
|
VIPER_LOGE("ViPER4Android disabled, reason [in.FC = %ld, out.FC = %ld]",
|
||||||
newConfig->inputCfg.buffer.frameCount, newConfig->outputCfg.buffer.frameCount);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newConfig->inputCfg.samplingRate != newConfig->outputCfg.samplingRate) {
|
if (newConfig->inputCfg.samplingRate != newConfig->outputCfg.samplingRate) {
|
||||||
VIPER_LOGE("ViPER4Android disabled, reason [in.SR = %d, out.SR = %d]",
|
VIPER_LOGE("ViPER4Android disabled, reason [in.SR = %d, out.SR = %d]",
|
||||||
newConfig->inputCfg.samplingRate, newConfig->outputCfg.samplingRate);
|
newConfig->inputCfg.samplingRate, newConfig->outputCfg.samplingRate);
|
||||||
setDisableReason(DisableReason::INVALID_SAMPLING_RATE);
|
setDisableReason(DisableReason::INVALID_SAMPLING_RATE, "Input and output sampling rate mismatch");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newConfig->inputCfg.samplingRate > 48000) {
|
// if (newConfig->inputCfg.samplingRate > 48000) {
|
||||||
VIPER_LOGE("ViPER4Android disabled, reason [SR out of range]");
|
// 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));
|
// setDisableReason(DisableReason::INVALID_SAMPLING_RATE, "Sampling rate out of range: " + std::to_string(newConfig->inputCfg.samplingRate));
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (newConfig->inputCfg.channels != newConfig->outputCfg.channels) {
|
if (newConfig->inputCfg.channels != newConfig->outputCfg.channels) {
|
||||||
VIPER_LOGE("ViPER4Android disabled, reason [in.CH = %d, out.CH = %d]",
|
VIPER_LOGE("ViPER4Android disabled, reason [in.CH = %d, out.CH = %d]",
|
||||||
newConfig->inputCfg.channels, newConfig->outputCfg.channels);
|
newConfig->inputCfg.channels, newConfig->outputCfg.channels);
|
||||||
setDisableReason(DisableReason::INVALID_CHANNEL_COUNT);
|
setDisableReason(DisableReason::INVALID_CHANNEL_COUNT, "Input and output channel count mismatch");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
// Basically Bauer-to-Stereophonic Binaural filter
|
// Basically Bauer-to-Stereophonic Binaural filter
|
||||||
// See: http://bs2b.sourceforge.net/
|
// See: http://bs2b.sourceforge.net/
|
||||||
|
|
||||||
Crossfeed::Crossfeed() {
|
Crossfeed::Crossfeed() {
|
||||||
this->a0_lo = 0.f;
|
this->a0_lo = 0.f;
|
||||||
this->b1_lo = 0.f;
|
this->b1_lo = 0.f;
|
||||||
|
@ -99,7 +99,6 @@ static const float MIN_PHASE_IIR_COEFFS_FREQ_31BANDS[] = {
|
|||||||
|
|
||||||
MinPhaseIIRCoeffs::MinPhaseIIRCoeffs() {
|
MinPhaseIIRCoeffs::MinPhaseIIRCoeffs() {
|
||||||
this->coeffs = nullptr;
|
this->coeffs = nullptr;
|
||||||
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;
|
|
||||||
this->bands = 0;
|
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) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->bands = bands;
|
this->bands = bands;
|
||||||
this->samplingRate = samplingRate;
|
|
||||||
|
|
||||||
delete[] this->coeffs;
|
delete[] this->coeffs;
|
||||||
this->coeffs = new double[bands * 4](); // TODO: Check this array size, original type: float
|
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);
|
Find_F1_F2(bandFreqs[i], tmp, &ret2, &ret1);
|
||||||
|
|
||||||
double x = (2.0 * M_PI * (double) bandFreqs[i]) / (double) this->samplingRate;
|
double x = (2.0 * M_PI * (double) bandFreqs[i]) / (double) samplingRate;
|
||||||
double y = (2.0 * M_PI * ret2) / (double) this->samplingRate;
|
double y = (2.0 * M_PI * ret2) / (double) samplingRate;
|
||||||
|
|
||||||
double cosX = cos(x);
|
double cosX = cos(x);
|
||||||
double cosY = cos(y);
|
double cosY = cos(y);
|
||||||
|
@ -18,6 +18,5 @@ private:
|
|||||||
int SolveRoot(double param_2, double param_3, double param_4, double *param_5);
|
int SolveRoot(double param_2, double param_3, double param_4, double *param_5);
|
||||||
|
|
||||||
double *coeffs;
|
double *coeffs;
|
||||||
uint32_t samplingRate;
|
|
||||||
uint32_t bands;
|
uint32_t bands;
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user