ViPERFX_RE/src/viper/ViPER.cpp

611 lines
20 KiB
C++
Raw Normal View History

#include "ViPER.h"
#include <ctime>
2022-10-06 03:37:22 +02:00
#include <cstring>
2021-07-27 19:00:39 +02:00
#include "constants.h"
2021-07-27 09:47:15 +02:00
ViPER::ViPER() {
VIPER_LOGI("Welcome to ViPER FX");
VIPER_LOGI("Current version is %s %s", VERSION_STRING, VERSION_CODENAME);
2022-10-13 03:01:20 +02:00
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;
2022-10-11 00:36:38 +02:00
2022-09-18 03:39:40 +02:00
this->adaptiveBuffer = new AdaptiveBuffer(2, 4096);
2022-09-18 03:38:22 +02:00
this->waveBuffer = new WaveBuffer(2, 4096);
this->convolver = new Convolver();
this->convolver->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->convolver->SetSamplingRate(this->samplingRate);
this->convolver->Reset();
this->vhe = new VHE();
this->vhe->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->vhe->SetSamplingRate(this->samplingRate);
this->vhe->Reset();
this->viperDdc = new ViPERDDC();
this->viperDdc->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->viperDdc->SetSamplingRate(this->samplingRate);
this->viperDdc->Reset();
this->spectrumExtend = new SpectrumExtend();
this->spectrumExtend->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->spectrumExtend->SetSamplingRate(this->samplingRate);
this->spectrumExtend->SetReferenceFrequency(7600);
this->spectrumExtend->SetExciter(0);
this->spectrumExtend->Reset();
2022-09-27 03:48:49 +02:00
this->iirFilter = new IIRFilter(10);
this->iirFilter->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->iirFilter->SetSamplingRate(this->samplingRate);
this->iirFilter->Reset();
this->colorfulMusic = new ColorfulMusic();
this->colorfulMusic->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->colorfulMusic->SetSamplingRate(this->samplingRate);
this->colorfulMusic->Reset();
this->reverberation = new Reverberation();
this->reverberation->SetEnable(false);
this->reverberation->Reset();
this->playbackGain = new PlaybackGain();
this->playbackGain->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->playbackGain->SetSamplingRate(this->samplingRate);
this->playbackGain->Reset();
this->fetCompressor = new FETCompressor();
2022-10-17 00:48:32 +02:00
this->fetCompressor->SetParameter(FETCompressor::ENABLE, 0.0);
2022-09-27 03:48:49 +02:00
this->fetCompressor->SetSamplingRate(this->samplingRate);
this->fetCompressor->Reset();
this->dynamicSystem = new DynamicSystem();
this->dynamicSystem->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->dynamicSystem->SetSamplingRate(this->samplingRate);
this->dynamicSystem->Reset();
this->viperBass = new ViPERBass();
2022-09-27 03:48:49 +02:00
this->viperBass->SetSamplingRate(this->samplingRate);
this->viperBass->Reset();
this->viperClarity = new ViPERClarity();
2022-09-27 03:48:49 +02:00
this->viperClarity->SetSamplingRate(this->samplingRate);
this->viperClarity->Reset();
this->diffSurround = new DiffSurround();
this->diffSurround->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->diffSurround->SetSamplingRate(this->samplingRate);
this->diffSurround->Reset();
this->cure = new Cure();
this->cure->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->cure->SetSamplingRate(this->samplingRate);
this->cure->Reset();
this->tubeSimulator = new TubeSimulator();
2022-10-11 00:36:38 +02:00
this->tubeSimulator->SetEnable(false);
this->tubeSimulator->Reset();
this->analogX = new AnalogX();
2022-10-11 00:36:38 +02:00
this->analogX->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->analogX->SetSamplingRate(this->samplingRate);
this->analogX->SetProcessingModel(0);
this->analogX->Reset();
this->speakerCorrection = new SpeakerCorrection();
this->speakerCorrection->SetEnable(false);
2022-09-27 03:48:49 +02:00
this->speakerCorrection->SetSamplingRate(this->samplingRate);
this->speakerCorrection->Reset();
2022-08-24 09:44:23 +02:00
for (auto &softwareLimiter: this->softwareLimiters) {
softwareLimiter = new SoftwareLimiter();
softwareLimiter->ResetLimiter();
}
2022-10-11 00:36:38 +02:00
this->frameScale = 1.0;
this->leftPan = 1.0;
this->rightPan = 1.0;
this->updateProcessTime = false;
this->processTimeMs = 0;
this->enabled = false;
2021-07-27 09:47:15 +02:00
}
ViPER::~ViPER() {
delete this->adaptiveBuffer;
delete this->waveBuffer;
delete this->convolver;
delete this->vhe;
delete this->viperDdc;
delete this->spectrumExtend;
delete this->iirFilter;
delete this->colorfulMusic;
delete this->reverberation;
delete this->playbackGain;
delete this->fetCompressor;
delete this->dynamicSystem;
delete this->viperBass;
delete this->viperClarity;
delete this->diffSurround;
delete this->cure;
delete this->tubeSimulator;
delete this->analogX;
delete this->speakerCorrection;
2022-09-16 03:16:58 +02:00
for (auto &softwareLimiter: this->softwareLimiters) {
delete softwareLimiter;
}
2021-07-27 09:47:15 +02:00
}
2022-09-27 03:48:49 +02:00
// TODO: Return int
void ViPER::processBuffer(float *buffer, uint32_t size) {
2022-10-06 03:37:22 +02:00
if (!this->enabled) {
VIPER_LOGD("ViPER is disabled, skip processing");
return;
}
if (size == 0) {
VIPER_LOGD("Buffer size is 0, skip processing");
return;
}
2022-10-11 00:36:38 +02:00
if (this->updateProcessTime) {
struct timeval time{};
gettimeofday(&time, nullptr);
2022-10-11 00:36:38 +02:00
this->processTimeMs = time.tv_sec * 1000 + time.tv_usec / 1000;
}
2022-09-16 03:16:58 +02:00
uint32_t ret;
2022-10-06 03:37:22 +02:00
float *tmpBuf;
uint32_t tmpBufSize;
if (this->convolver->GetEnabled() || this->vhe->GetEnabled()) {
2022-10-25 03:24:27 +02:00
// VIPER_LOGD("Convolver or VHE is enable, use wave buffer");
2022-10-11 00:36:38 +02:00
2022-10-06 03:37:22 +02:00
if (!this->waveBuffer->PushSamples(buffer, size)) {
this->waveBuffer->Reset();
return;
}
float *ptr = this->waveBuffer->GetBuffer();
ret = this->convolver->Process(ptr, ptr, size);
ret = this->vhe->Process(ptr, ptr, ret);
this->waveBuffer->SetBufferOffset(ret);
if (!this->adaptiveBuffer->PushZero(ret)) {
this->waveBuffer->Reset();
this->adaptiveBuffer->FlushBuffer();
return;
}
ptr = this->adaptiveBuffer->GetBuffer();
ret = this->waveBuffer->PopSamples(ptr, ret, true);
this->adaptiveBuffer->SetBufferOffset(ret);
tmpBuf = ptr;
tmpBufSize = ret;
} else {
2022-10-25 03:24:27 +02:00
// VIPER_LOGD("Convolver and VHE are disabled, use adaptive buffer");
2022-10-11 00:36:38 +02:00
2022-10-06 03:37:22 +02:00
if (this->adaptiveBuffer->PushFrames(buffer, size)) {
this->adaptiveBuffer->SetBufferOffset(size);
tmpBuf = this->adaptiveBuffer->GetBuffer();
tmpBufSize = size;
} else {
this->adaptiveBuffer->FlushBuffer();
return;
}
}
2022-10-11 00:36:38 +02:00
// VIPER_LOGD("Process buffer size: %d", tmpBufSize);
2022-10-06 03:37:22 +02:00
if (tmpBufSize != 0) {
this->viperDdc->Process(tmpBuf, size);
this->spectrumExtend->Process(tmpBuf, size);
this->iirFilter->Process(tmpBuf, tmpBufSize);
this->colorfulMusic->Process(tmpBuf, tmpBufSize);
this->diffSurround->Process(tmpBuf, tmpBufSize);
this->reverberation->Process(tmpBuf, tmpBufSize);
this->speakerCorrection->Process(tmpBuf, tmpBufSize);
this->playbackGain->Process(tmpBuf, tmpBufSize);
this->fetCompressor->Process(tmpBuf, tmpBufSize); // TODO: enable check
this->dynamicSystem->Process(tmpBuf, tmpBufSize);
this->viperBass->Process(tmpBuf, tmpBufSize);
this->viperClarity->Process(tmpBuf, tmpBufSize);
this->cure->Process(tmpBuf, tmpBufSize);
this->tubeSimulator->TubeProcess(tmpBuf, size);
this->analogX->Process(tmpBuf, tmpBufSize);
2022-10-11 00:36:38 +02:00
if (this->frameScale != 1.0) {
this->adaptiveBuffer->ScaleFrames(this->frameScale);
2022-10-06 03:37:22 +02:00
}
2022-10-11 00:36:38 +02:00
if (this->leftPan < 1.0 || this->rightPan < 1.0) {
this->adaptiveBuffer->PanFrames(this->leftPan, this->rightPan);
2022-10-06 03:37:22 +02:00
}
for (uint32_t i = 0; i < tmpBufSize * 2; i += 2) {
tmpBuf[i] = this->softwareLimiters[0]->Process(tmpBuf[i]);
tmpBuf[i + 1] = this->softwareLimiters[1]->Process(tmpBuf[i + 1]);
}
if (!this->adaptiveBuffer->PopFrames(buffer, tmpBufSize)) {
this->adaptiveBuffer->FlushBuffer();
return;
}
if (size <= tmpBufSize) {
return;
}
}
2022-10-06 03:37:22 +02:00
memmove(buffer + (size - tmpBufSize) * 2, buffer, tmpBufSize * sizeof(float));
memset(buffer, 0, (size - tmpBufSize) * sizeof(float));
2021-07-27 09:47:15 +02:00
}
2022-09-28 03:38:57 +02:00
void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, uint32_t arrSize,
signed char *arr) {
2022-10-11 00:36:38 +02:00
VIPER_LOGD("Dispatch command: %d, %d, %d, %d, %d, %d, %p", param, val1, val2, val3, val4, arrSize, arr);
2022-10-04 03:16:38 +02:00
switch (param) {
case PARAM_SET_UPDATE_STATUS: {
2022-10-11 00:36:38 +02:00
this->updateProcessTime = val1 != 0;
2022-10-04 03:16:38 +02:00
break;
}
case PARAM_SET_RESET_STATUS: {
2022-10-11 00:36:38 +02:00
this->ResetAllEffects();
2022-10-04 03:16:38 +02:00
break;
}
2022-10-25 03:24:27 +02:00
case PARAM_CONVOLUTION_ENABLE: {
2022-10-11 00:36:38 +02:00
// this->convolver->SetEnabled(val1 != 0);
2022-10-04 03:16:38 +02:00
break;
} // 0x10002
2022-10-25 03:24:27 +02:00
case PARAM_CONVOLUTION_PREPARE_BUFFER: {
2022-10-04 03:16:38 +02:00
break;
2022-10-25 03:24:27 +02:00
} // 0x10004
case PARAM_CONVOLUTION_SET_BUFFER: {
break;
} // 0x10005
case PARAM_CONVOLUTION_COMMIT_BUFFER: {
break;
} // 0x10006
case PARAM_CONVOLUTION_CROSS_CHANNEL: {
2022-10-11 00:36:38 +02:00
this->convolver->SetCrossChannel((float) val1 / 100.0f);
2022-10-04 03:16:38 +02:00
break;
} // 0x10007
2022-10-25 03:24:27 +02:00
case PARAM_HEADPHONE_SURROUND_ENABLE: {
2022-10-04 03:16:38 +02:00
this->vhe->SetEnable(val1 != 0);
break;
} // 0x10008
2022-10-25 03:24:27 +02:00
case PARAM_HEADPHONE_SURROUND_STRENGTH: {
2022-10-04 03:16:38 +02:00
this->vhe->SetEffectLevel(val1);
break;
} // 0x10009
2022-10-25 03:24:27 +02:00
case PARAM_DDC_ENABLE: {
2022-10-04 03:16:38 +02:00
this->viperDdc->SetEnable(val1 != 0);
break;
} // 0x1000A
2022-10-25 03:24:27 +02:00
case PARAM_DDC_COEFFICIENTS: {
2022-10-04 03:16:38 +02:00
// TODO: Finish
//this->viperDdc->SetCoeffs();
break;
} // 0x1000B
2022-10-25 03:24:27 +02:00
case PARAM_SPECTRUM_EXTENSION_ENABLE: {
2022-10-04 03:16:38 +02:00
this->spectrumExtend->SetEnable(val1 != 0);
break;
} // 0x1000C
2022-10-25 03:24:27 +02:00
case PARAM_SPECTRUM_EXTENSION_BARK: {
2022-10-04 03:16:38 +02:00
this->spectrumExtend->SetReferenceFrequency(val1);
break;
} // 0x1000D
2022-10-25 03:24:27 +02:00
case PARAM_SPECTRUM_EXTENSION_BARK_RECONSTRUCT: {
2022-10-04 03:16:38 +02:00
this->spectrumExtend->SetExciter((float) val1 / 100.0f);
break;
} // 0x1000E
2022-10-25 03:24:27 +02:00
case PARAM_FIR_EQUALIZER_ENABLE: {
2022-10-04 03:16:38 +02:00
this->iirFilter->SetEnable(val1 != 0);
break;
} // 0x1000F
2022-10-25 03:24:27 +02:00
case PARAM_FIR_EQUALIZER_BAND_LEVEL: {
2022-10-04 03:16:38 +02:00
this->iirFilter->SetBandLevel(val1, (float) val2 / 100.0f);
break;
} // 0x10010
2022-10-25 03:24:27 +02:00
case PARAM_FIELD_SURROUND_ENABLE: {
2022-10-04 03:16:38 +02:00
this->colorfulMusic->SetEnable(val1 != 0);
break;
} // 0x10011
2022-10-25 03:24:27 +02:00
case PARAM_FIELD_SURROUND_WIDENING: {
2022-10-04 03:16:38 +02:00
this->colorfulMusic->SetWidenValue((float) val1 / 100.0f);
break;
} // 0x10012
2022-10-25 03:24:27 +02:00
case PARAM_FIELD_SURROUND_MID_IMAGE: {
2022-10-04 03:16:38 +02:00
this->colorfulMusic->SetMidImageValue((float) val1 / 100.0f);
break;
} // 0x10013
2022-10-25 03:24:27 +02:00
case PARAM_FIELD_SURROUND_DEPTH: {
2022-10-04 03:16:38 +02:00
this->colorfulMusic->SetDepthValue((short) val1);
break;
} // 0x10014
2022-10-25 03:24:27 +02:00
case PARAM_DIFFERENTIAL_SURROUND_ENABLE: {
2022-10-11 00:36:38 +02:00
this->diffSurround->SetEnable(val1 != 0);
2022-10-04 03:16:38 +02:00
break;
} // 0x10015
2022-10-25 03:24:27 +02:00
case PARAM_DIFFERENTIAL_SURROUND_DELAY: {
2022-10-04 03:16:38 +02:00
this->diffSurround->SetDelayTime((float) val1 / 100.0f);
break;
} // 0x10016
2022-10-25 03:24:27 +02:00
case PARAM_REVERBERATION_ENABLE: {
2022-10-11 00:36:38 +02:00
this->reverberation->SetEnable(val1 != 0);
2022-10-04 03:16:38 +02:00
break;
} // 0x10017
2022-10-25 03:24:27 +02:00
case PARAM_REVERBERATION_ROOM_SIZE: {
2022-10-11 00:36:38 +02:00
this->reverberation->SetRoomSize((float) val1 / 100.0f);
2022-10-04 03:16:38 +02:00
break;
} // 0x10018
2022-10-25 03:24:27 +02:00
case PARAM_REVERBERATION_ROOM_WIDTH: {
2022-10-04 03:16:38 +02:00
this->reverberation->SetWidth((float) val1 / 100.0f);
break;
} // 0x10019
2022-10-25 03:24:27 +02:00
case PARAM_REVERBERATION_ROOM_DAMPENING: {
2022-10-11 00:36:38 +02:00
this->reverberation->SetDamp((float) val1 / 100.0f);
2022-10-04 03:16:38 +02:00
break;
} // 0x1001A
2022-10-25 03:24:27 +02:00
case PARAM_REVERBERATION_ROOM_WET_SIGNAL: {
2022-10-11 00:36:38 +02:00
this->reverberation->SetWet((float) val1 / 100.0f);
2022-10-04 03:16:38 +02:00
break;
} // 0x1001B
2022-10-25 03:24:27 +02:00
case PARAM_REVERBERATION_ROOM_DRY_SIGNAL: {
2022-10-11 00:36:38 +02:00
this->reverberation->SetDry((float) val1 / 100.0f);
2022-10-04 03:16:38 +02:00
break;
} // 0x1001C
2022-10-25 03:24:27 +02:00
case PARAM_AUTOMATIC_GAIN_CONTROL_ENABLE: {
2022-10-04 03:16:38 +02:00
this->playbackGain->SetEnable(val1 != 0);
break;
} // 0x1001D
2022-10-25 03:24:27 +02:00
case PARAM_AUTOMATIC_GAIN_CONTROL_RATIO: {
2022-10-04 03:16:38 +02:00
this->playbackGain->SetRatio((float) val1 / 100.0f);
break;
} // 0x1001E
2022-10-25 03:24:27 +02:00
case PARAM_AUTOMATIC_GAIN_CONTROL_VOLUME: {
2022-10-04 03:16:38 +02:00
this->playbackGain->SetVolume((float) val1 / 100.0f);
break;
} // 0x1001F
2022-10-25 03:24:27 +02:00
case PARAM_AUTOMATIC_GAIN_CONTROL_MAX_SCALER: {
2022-10-04 03:16:38 +02:00
this->playbackGain->SetMaxGainFactor((float) val1 / 100.0f);
break;
} // 0x10020
2022-10-25 03:24:27 +02:00
case PARAM_DYNAMIC_SYSTEM_ENABLE: {
2022-10-04 03:16:38 +02:00
this->dynamicSystem->SetEnable(val1 != 0);
break;
} // 0x10021
2022-10-25 03:24:27 +02:00
case PARAM_DYNAMIC_SYSTEM_X_COEFFICIENTS: {
2022-10-04 03:16:38 +02:00
this->dynamicSystem->SetXCoeffs(val1, val2);
break;
} // 0x10022
2022-10-25 03:24:27 +02:00
case PARAM_DYNAMIC_SYSTEM_Y_COEFFICIENTS: {
2022-10-04 03:16:38 +02:00
this->dynamicSystem->SetYCoeffs(val1, val2);
break;
} // 0x10023
2022-10-25 03:24:27 +02:00
case PARAM_DYNAMIC_SYSTEM_SIDE_GAIN: {
2022-10-04 03:16:38 +02:00
this->dynamicSystem->SetSideGain((float) val1 / 100.0f, (float) val2 / 100.0f);
break;
} // 0x10024
2022-10-25 03:24:27 +02:00
case PARAM_DYNAMIC_SYSTEM_STRENGTH: {
2022-10-04 03:16:38 +02:00
this->dynamicSystem->SetBassGain((float) val1 / 100.0f);
break;
} // 0x10025
2022-10-25 03:24:27 +02:00
case PARAM_FIDELITY_BASS_ENABLE: {
2022-10-11 00:36:38 +02:00
this->viperBass->SetEnable(val1 != 0);
2022-10-04 03:16:38 +02:00
break;
} // 0x10026
2022-10-25 03:24:27 +02:00
case PARAM_FIDELITY_BASS_MODE: {
2022-10-11 00:36:38 +02:00
this->viperBass->SetProcessMode((ViPERBass::ProcessMode) val1);
2022-10-04 03:16:38 +02:00
break;
} // 0x10027
2022-10-25 03:24:27 +02:00
case PARAM_FIDELITY_BASS_FREQUENCY: {
2022-10-04 03:16:38 +02:00
this->viperBass->SetSpeaker(val1);
break;
} // 0x10028
2022-10-25 03:24:27 +02:00
case PARAM_FIDELITY_BASS_GAIN: {
2022-10-04 03:16:38 +02:00
this->viperBass->SetBassFactor((float) val1 / 100.0f);
break;
} // 0x10029
2022-10-25 03:24:27 +02:00
case PARAM_FIDELITY_CLARITY_ENABLE: {
2022-10-11 00:36:38 +02:00
this->viperClarity->SetEnable(val1 != 0);
2022-10-04 03:16:38 +02:00
break;
} // 0x1002A
2022-10-25 03:24:27 +02:00
case PARAM_FIDELITY_CLARITY_MODE: {
2022-10-11 00:36:38 +02:00
this->viperClarity->SetProcessMode((ViPERClarity::ClarityMode) val1);
2022-10-04 03:16:38 +02:00
break;
} // 0x1002B
2022-10-25 03:24:27 +02:00
case PARAM_FIDELITY_CLARITY_GAIN: {
2022-10-04 03:16:38 +02:00
this->viperClarity->SetClarity((float) val1 / 100.0f);
break;
} // 0x1002C
2022-10-25 03:24:27 +02:00
case PARAM_CURE_CROSS_FEED_ENABLED: {
2022-10-04 03:16:38 +02:00
this->cure->SetEnable(val1 != 0);
break;
} // 0x1002D
2022-10-25 03:24:27 +02:00
case PARAM_CURE_CROSS_FEED_STRENGTH: {
2022-10-04 03:16:38 +02:00
switch (val1) {
case 0:
// Cure_R::SetPreset(pCVar17,0x5f028a);
break;
case 1:
// Cure_R::SetPreset(pCVar17,0x3c02bc);
break;
case 2:
// Cure_R::SetPreset(pCVar17,0x2d02bc);
break;
}
break;
} // 0x1002E
2022-10-25 03:24:27 +02:00
case PARAM_TUBE_SIMULATOR_ENABLED: {
2022-10-11 00:36:38 +02:00
this->tubeSimulator->SetEnable(val1 != 0);
2022-10-04 03:16:38 +02:00
break;
} // 0x1002F
2022-10-25 03:24:27 +02:00
case PARAM_ANALOGX_ENABLE: {
2022-10-11 00:36:38 +02:00
this->analogX->SetEnable(val1 != 0);
2022-10-04 03:16:38 +02:00
break;
} // 0x10030
2022-10-13 03:01:20 +02:00
case PARAM_ANALOGX_MODE: {
2022-10-04 03:16:38 +02:00
this->analogX->SetProcessingModel(val1);
break;
} // 0x10031
2022-10-25 03:24:27 +02:00
case PARAM_GATE_OUTPUT_VOLUME: {
2022-10-11 00:36:38 +02:00
this->frameScale = (float) val1 / 100.0f;
2022-10-04 03:16:38 +02:00
break;
} // 0x10032
2022-10-25 03:24:27 +02:00
case PARAM_GATE_CHANNEL_PAN: {
2022-10-04 03:16:38 +02:00
float tmp = (float) val1 / 100.0f;
if (tmp < 0.0f) {
2022-10-11 00:36:38 +02:00
this->leftPan = 1.0f;
this->rightPan = 1.0f + tmp;
2022-10-04 03:16:38 +02:00
} else {
2022-10-11 00:36:38 +02:00
this->leftPan = 1.0f - tmp;
this->rightPan = 1.0f;
2022-10-04 03:16:38 +02:00
}
break;
} // 0x10033
2022-10-25 03:24:27 +02:00
case PARAM_GATE_LIMIT: {
2022-10-04 03:16:38 +02:00
this->softwareLimiters[0]->SetGate((float) val1 / 100.0f);
this->softwareLimiters[1]->SetGate((float) val1 / 100.0f);
break;
} // 0x10034
2022-10-25 03:24:27 +02:00
case PARAM_SPEAKER_OPTIMIZATION: {
2022-10-04 03:16:38 +02:00
this->speakerCorrection->SetEnable(val1 != 0);
break;
} // 0x10043
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_ENABLE: {
2022-10-04 03:16:38 +02:00
break;
} // 0x10049
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_THRESHOLD: {
2022-10-04 03:16:38 +02:00
break;
} // 0x1004A
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_RATIO: {
2022-10-17 00:48:32 +02:00
this->fetCompressor->SetParameter(FETCompressor::THRESHOLD, (float) val1 / 100.0f);
2022-10-04 03:16:38 +02:00
break;
} // 0x1004B
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_KNEE: {
2022-10-04 03:16:38 +02:00
break;
} // 0x1004C
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_AUTO_KNEE: {
2022-10-04 03:16:38 +02:00
break;
} // 0x1004D
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_GAIN: {
2022-10-04 03:16:38 +02:00
break;
} // 0x1004E
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_AUTO_GAIN: {
2022-10-17 00:48:32 +02:00
this->fetCompressor->SetParameter(FETCompressor::GAIN, (float) val1 / 100.0f);
2022-10-04 03:16:38 +02:00
break;
} // 0x1004F
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_ATTACK: {
2022-10-04 03:16:38 +02:00
break;
} // 0x10050
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_AUTO_ATTACK: {
2022-10-04 03:16:38 +02:00
break;
} // 0x10051
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_RELEASE: {
2022-10-04 03:16:38 +02:00
break;
} // 0x10052
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_AUTO_RELEASE: {
2022-10-04 03:16:38 +02:00
break;
} // 0x10053
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_KNEE_MULTI: {
2022-10-04 03:16:38 +02:00
break;
} // 0x10054
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_MAX_ATTACK: {
2022-10-04 03:16:38 +02:00
break;
} // 0x10055
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_MAX_RELEASE: {
2022-10-17 00:48:32 +02:00
this->fetCompressor->SetParameter(FETCompressor::MAX_ATTACK, (float) val1 / 100.0f);
2022-10-04 03:16:38 +02:00
break;
} // 0x10056
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_CREST: {
2022-10-04 03:16:38 +02:00
break;
} // 0x10057
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_ADAPT: {
2022-10-04 03:16:38 +02:00
break;
} // 0x10058
2022-10-25 03:24:27 +02:00
case PARAM_FET_COMPRESSOR_NO_CLIP: {
2022-10-17 00:48:32 +02:00
this->fetCompressor->SetParameter(FETCompressor::ADAPT, (float) val1 / 100.0f);
2022-10-04 03:16:38 +02:00
break;
} // 0x10059
}
2021-07-27 09:47:15 +02:00
}
void ViPER::ResetAllEffects() {
if (this->adaptiveBuffer != nullptr) {
this->adaptiveBuffer->FlushBuffer();
}
if (this->waveBuffer != nullptr) {
this->waveBuffer->Reset();
}
if (this->convolver != nullptr) {
2022-09-27 03:48:49 +02:00
this->convolver->SetSamplingRate(this->samplingRate);
this->convolver->Reset();
}
if (this->vhe != nullptr) {
2022-09-27 03:48:49 +02:00
this->vhe->SetSamplingRate(this->samplingRate);
this->vhe->Reset();
}
if (this->viperDdc != nullptr) {
2022-09-27 03:48:49 +02:00
this->viperDdc->SetSamplingRate(this->samplingRate);
this->viperDdc->Reset();
}
if (this->spectrumExtend != nullptr) {
2022-09-27 03:48:49 +02:00
this->spectrumExtend->SetSamplingRate(this->samplingRate);
this->spectrumExtend->Reset();
}
if (this->iirFilter != nullptr) {
2022-09-27 03:48:49 +02:00
this->iirFilter->SetSamplingRate(this->samplingRate);
this->iirFilter->Reset();
}
if (this->colorfulMusic != nullptr) {
2022-09-27 03:48:49 +02:00
this->colorfulMusic->SetSamplingRate(this->samplingRate);
this->colorfulMusic->Reset();
}
if (this->reverberation != nullptr) {
this->reverberation->Reset();
}
if (this->playbackGain != nullptr) {
2022-09-27 03:48:49 +02:00
this->playbackGain->SetSamplingRate(this->samplingRate);
this->playbackGain->Reset();
}
if (this->fetCompressor != nullptr) {
2022-09-27 03:48:49 +02:00
this->fetCompressor->SetSamplingRate(this->samplingRate);
this->fetCompressor->Reset();
}
if (this->dynamicSystem != nullptr) {
2022-09-27 03:48:49 +02:00
this->dynamicSystem->SetSamplingRate(this->samplingRate);
this->dynamicSystem->Reset();
}
if (this->viperBass != nullptr) {
2022-09-27 03:48:49 +02:00
this->viperBass->SetSamplingRate(this->samplingRate);
this->viperBass->Reset();
}
if (this->viperClarity != nullptr) {
2022-09-27 03:48:49 +02:00
this->viperClarity->SetSamplingRate(this->samplingRate);
this->viperClarity->Reset();
}
if (this->diffSurround != nullptr) {
2022-09-27 03:48:49 +02:00
this->diffSurround->SetSamplingRate(this->samplingRate);
this->diffSurround->Reset();
}
if (this->cure != nullptr) {
2022-09-27 03:48:49 +02:00
this->cure->SetSamplingRate(this->samplingRate);
this->cure->Reset();
}
if (this->tubeSimulator != nullptr) {
this->tubeSimulator->Reset();
}
if (this->analogX != nullptr) {
2022-09-27 03:48:49 +02:00
this->analogX->SetSamplingRate(this->samplingRate);
this->analogX->Reset();
}
if (this->speakerCorrection != nullptr) {
2022-09-27 03:48:49 +02:00
this->speakerCorrection->SetSamplingRate(this->samplingRate);
this->speakerCorrection->Reset();
}
2022-08-24 09:48:11 +02:00
for (auto &softwareLimiter: softwareLimiters) {
if (softwareLimiter != nullptr) {
softwareLimiter->ResetLimiter();
}
}
2021-07-27 09:47:15 +02:00
}