mirror of
https://github.com/AndroidAudioMods/ViPERFX_RE.git
synced 2025-01-03 16:13:35 +08:00
ViPERBass: Clean up
This commit is contained in:
parent
849cc612c9
commit
9e628a2fd7
@ -5,7 +5,7 @@ ViPERBass::ViPERBass() {
|
||||
this->samplingRate = DEFAULT_SAMPLERATE;
|
||||
this->speaker = 60;
|
||||
this->invertedSamplingRate = 1.0f / DEFAULT_SAMPLERATE;
|
||||
this->unknown1 = 0.0;
|
||||
this->antiPop = 0.0;
|
||||
this->processMode = NATURAL_BASS;
|
||||
this->bassFactor = 0.0f;
|
||||
this->polyphase = new Polyphase(2);
|
||||
@ -38,17 +38,16 @@ void ViPERBass::Process(float *samples, uint32_t size) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Anti-pop mechanism? this->unknown1 is zeroed in Reset()
|
||||
if (this->unknown1 < 1.0) {
|
||||
if (this->antiPop < 1.0) {
|
||||
for (uint32_t i = 0; i < size * 2; i += 2) {
|
||||
samples[i] *= this->unknown1;
|
||||
samples[i + 1] *= this->unknown1;
|
||||
samples[i] *= this->antiPop;
|
||||
samples[i + 1] *= this->antiPop;
|
||||
|
||||
float x = this->unknown1 + this->invertedSamplingRate;
|
||||
float x = this->antiPop + this->invertedSamplingRate;
|
||||
if (x > 1.0) {
|
||||
x = 1.0;
|
||||
}
|
||||
this->unknown1 = x;
|
||||
this->antiPop = x;
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +96,7 @@ void ViPERBass::Reset() {
|
||||
this->waveBuffer->PushZeros(this->polyphase->GetLatency());
|
||||
this->subwoofer->SetBassGain(this->samplingRate, this->bassFactor * 2.5f);
|
||||
this->biquad->SetLowPassParameter(this->speaker, this->samplingRate, 0.53);
|
||||
this->unknown1 = 0.0f;
|
||||
this->antiPop = 0.0f;
|
||||
this->invertedSamplingRate = 1.0f / (float) this->samplingRate;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ private:
|
||||
ProcessMode processMode;
|
||||
uint32_t samplingRate;
|
||||
float invertedSamplingRate;
|
||||
float unknown1;
|
||||
float antiPop;
|
||||
uint32_t speaker;
|
||||
float bassFactor;
|
||||
};
|
||||
|
@ -10,25 +10,17 @@ public:
|
||||
~WaveBuffer();
|
||||
|
||||
void Reset();
|
||||
|
||||
uint32_t GetBufferOffset();
|
||||
|
||||
uint32_t GetBufferSize();
|
||||
|
||||
float *GetBuffer();
|
||||
|
||||
uint32_t PopSamples(uint32_t size, bool resetIndex);
|
||||
|
||||
uint32_t PopSamples(float *dest, uint32_t size, bool resetIndex);
|
||||
|
||||
int PushSamples(float *source, uint32_t size);
|
||||
|
||||
int PushZeros(uint32_t size);
|
||||
|
||||
float *PushZerosGetBuffer(uint32_t size);
|
||||
|
||||
void SetBufferOffset(uint32_t offset);
|
||||
|
||||
private:
|
||||
float *buffer;
|
||||
uint32_t size;
|
||||
uint32_t index;
|
||||
|
Loading…
x
Reference in New Issue
Block a user