This commit is contained in:
Iscle 2022-09-25 01:28:56 +02:00
parent b20e30759a
commit 3e6be85fe6
6 changed files with 66 additions and 26 deletions

View File

@ -1,11 +1,14 @@
#include <cstring>
#include "SoftwareLimiter.h"
SoftwareLimiter::SoftwareLimiter() {
}
SoftwareLimiter::~SoftwareLimiter() {
this->ready = false;
this->unknown4 = 0;
this->unknown2 = 1.0;
this->gate = 0.999999;
this->unknown3 = 1.0;
this->unknown1 = 1.0;
this->ResetLimiter();
}
void SoftwareLimiter::Process(float *samples, uint32_t size) {
@ -13,9 +16,14 @@ void SoftwareLimiter::Process(float *samples, uint32_t size) {
}
void SoftwareLimiter::ResetLimiter() {
memset(this->arr256, 0, 256);
memset(this->arr512, 0, 512);
this->ready = false;
this->unknown4 = 0;
this->unknown2 = 1.0;
this->unknown3 = 1.0;
}
void SoftwareLimiter::SetGate() {
void SoftwareLimiter::SetGate(float gate) {
this->gate = gate;
}

View File

@ -9,7 +9,17 @@ public:
void Process(float *samples, uint32_t size);
void ResetLimiter();
void SetGate();
void SetGate(float gate);
private:
float gate;
float unknown1;
float unknown2;
float unknown3;
float arr256[256];
float arr512[512];
uint32_t unknown4;
bool ready;
};

View File

@ -3,7 +3,7 @@
NoiseSharpening::NoiseSharpening() {
this->samplingRate = DEFAULT_SAMPLERATE;
this->gain = 0.f;
this->gain = 0.0;
Reset();
}
@ -36,9 +36,9 @@ void NoiseSharpening::Process(float *buffer, uint32_t size) {
void NoiseSharpening::Reset() {
for (int i = 0; i < 2; i++) {
this->filters[i].setLPF_BW(this->samplingRate / 2.f - 1000.f, this->samplingRate);
this->filters[i].setLPF_BW((float) ((double) this->samplingRate / 2.0 - 1000.0), this->samplingRate);
this->filters[i].Mute();
this->in[i] = 0.f;
this->in[i] = 0.0;
}
}

View File

@ -18,13 +18,13 @@ void PolesFilter::UpdateCoeff() {
memset(&this->channels[0], 0, sizeof(channel));
memset(&this->channels[1], 0, sizeof(channel));
this->channels[0].lower_angle = ((float) this->lower_freq * M_PI / (float) this->samplingRate);
this->channels[1].lower_angle = ((float) this->lower_freq * M_PI / (float) this->samplingRate);
this->channels[0].upper_angle = ((float) this->upper_freq * M_PI / (float) this->samplingRate);
this->channels[1].upper_angle = ((float) this->upper_freq * M_PI / (float) this->samplingRate);
this->channels[0].lower_angle = (float) this->lower_freq * (float) M_PI / (float) this->samplingRate;
this->channels[1].lower_angle = (float) this->lower_freq * (float) M_PI / (float) this->samplingRate;
this->channels[0].upper_angle = (float) this->upper_freq * (float) M_PI / (float) this->samplingRate;
this->channels[1].upper_angle = (float) this->upper_freq * (float) M_PI / (float) this->samplingRate;
}
inline void DoFilterSide(channel *side, float sample, float *out1, float *out2, float *out3) {
static inline void DoFilterSide(channel *side, float sample, float *out1, float *out2, float *out3) {
float oldestSampleIn = side->in[2];
side->in[2] = side->in[1];
side->in[1] = side->in[0];

View File

@ -1,22 +1,42 @@
#include "Stereo3DSurround.h"
Stereo3DSurround::Stereo3DSurround() {
this->midImage = 1.0f;
this->stereoWiden = 0.0f;
this->unknown1 = 1.0f;
this->unknown2 = 0.5f;
this->coeffLeft = 0.5f;
this->coeffRight = 0.5f;
this->middleImage = 1.0;
this->stereoWiden = 0.0;
this->unknown1 = 1.0;
this->unknown2 = 0.5;
this->coeffLeft = 0.5;
this->coeffRight = 0.5;
}
void Stereo3DSurround::Process(float *samples, uint32_t size) {
if (size >= 2) {
}
}
inline void Stereo3DSurround::ConfigureVariables() {
this->unknown1 = this->stereoWiden + 1.0f;
float x = this->unknown1 + 1.0f;
float y;
if (x < 2.0) {
y = 0.5;
} else {
y = 1.0f / x;
}
this->unknown2 = y;
this->coeffLeft = this->middleImage * y;
this->coeffRight = this->unknown1 * y;
}
void Stereo3DSurround::SetMiddleImage(float middleImage) {
this->middleImage = middleImage;
this->ConfigureVariables();
}
void Stereo3DSurround::SetStereoWiden(float stereoWiden) {
this->stereoWiden = stereoWiden;
this->ConfigureVariables();
}

View File

@ -11,8 +11,10 @@ public:
void SetStereoWiden(float stereoWiden);
private:
void ConfigureVariables();
float stereoWiden;
float midImage;
float middleImage;
float unknown1;
float unknown2;
float coeffLeft;