2022-08-30 00:39:15 +02:00
|
|
|
#include "PlaybackGain.h"
|
2022-09-25 01:46:10 +02:00
|
|
|
#include "../constants.h"
|
2022-09-06 17:57:23 +02:00
|
|
|
|
|
|
|
PlaybackGain::PlaybackGain() {
|
2022-09-25 01:46:10 +02:00
|
|
|
this->enable = false;
|
2022-10-13 03:01:20 +02:00
|
|
|
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;
|
2022-09-25 01:46:10 +02:00
|
|
|
this->unknown1 = 0.4342945;
|
|
|
|
this->counterTo100 = 0;
|
|
|
|
this->ratio1 = 2.0;
|
|
|
|
this->ratio2 = 0.5;
|
|
|
|
this->volume = 1.0;
|
|
|
|
this->maxGainFactor = 1.0;
|
|
|
|
this->unknown2 = 1.0;
|
|
|
|
this->unknown3 = 1.0;
|
|
|
|
this->biquad1.SetBandPassParameter(2200.0,this->samplingRate,0.33);
|
|
|
|
this->biquad2.SetBandPassParameter(2200.0,this->samplingRate,0.33);
|
2022-09-06 17:57:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
PlaybackGain::~PlaybackGain() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void PlaybackGain::AnalyseWave() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-09-25 01:46:10 +02:00
|
|
|
void PlaybackGain::Process(float *samples, uint32_t size) {
|
2022-09-06 17:57:23 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-09-25 01:46:10 +02:00
|
|
|
void PlaybackGain::Reset() {
|
|
|
|
this->biquad1.SetBandPassParameter(2200.0,this->samplingRate,0.33);
|
|
|
|
this->biquad2.SetBandPassParameter(2200.0,this->samplingRate,0.33);
|
|
|
|
this->unknown2 = 1.0;
|
|
|
|
this->counterTo100 = 0;
|
|
|
|
this->unknown3 = 1.0;
|
2022-09-06 17:57:23 +02:00
|
|
|
}
|
|
|
|
|
2022-09-25 01:46:10 +02:00
|
|
|
void PlaybackGain::SetEnable(bool enable) {
|
|
|
|
this->enable = enable;
|
|
|
|
if (enable) {
|
|
|
|
Reset();
|
|
|
|
}
|
2022-09-06 17:57:23 +02:00
|
|
|
}
|
|
|
|
|
2022-09-25 01:46:10 +02:00
|
|
|
void PlaybackGain::SetMaxGainFactor(float maxGainFactor) {
|
|
|
|
this->maxGainFactor = maxGainFactor;
|
2022-09-06 17:57:23 +02:00
|
|
|
}
|
|
|
|
|
2022-09-25 01:46:10 +02:00
|
|
|
void PlaybackGain::SetRatio(float ratio) {
|
|
|
|
this->ratio1 = ratio + 1.0f;
|
|
|
|
this->ratio2 = 1.0f / (ratio + 1.0f);
|
2022-09-06 17:57:23 +02:00
|
|
|
}
|
|
|
|
|
2022-09-25 01:46:10 +02:00
|
|
|
void PlaybackGain::SetSamplingRate(uint32_t samplingRate) {
|
|
|
|
this->samplingRate = samplingRate;
|
|
|
|
Reset();
|
2022-09-06 17:57:23 +02:00
|
|
|
}
|
|
|
|
|
2022-09-25 01:46:10 +02:00
|
|
|
void PlaybackGain::SetVolume(float volume) {
|
|
|
|
this->volume = volume;
|
2022-09-06 17:57:23 +02:00
|
|
|
}
|