mirror of
https://github.com/AndroidAudioMods/ViPERFX_RE.git
synced 2025-06-08 02:29:40 +08:00
Do not use pointers for each effect in the ViPER class
This commit is contained in:
parent
01029501e2
commit
bf580b11ad
@ -23,7 +23,6 @@ static const effect_descriptor_t viperDescriptor = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int32_t viperInterfaceProcess(effect_handle_t self, audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
|
static int32_t viperInterfaceProcess(effect_handle_t self, audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
|
||||||
VIPER_LOGD("viperInterfaceProcess() called");
|
|
||||||
auto viperHandle = reinterpret_cast<ViperHandle *>(self);
|
auto viperHandle = reinterpret_cast<ViperHandle *>(self);
|
||||||
if (viperHandle == nullptr) return -EINVAL;
|
if (viperHandle == nullptr) return -EINVAL;
|
||||||
|
|
||||||
@ -33,7 +32,6 @@ static int32_t viperInterfaceProcess(effect_handle_t self, audio_buffer_t *inBuf
|
|||||||
static int32_t viperInterfaceCommand(effect_handle_t self,
|
static int32_t viperInterfaceCommand(effect_handle_t self,
|
||||||
uint32_t cmdCode, uint32_t cmdSize, void *pCmdData,
|
uint32_t cmdCode, uint32_t cmdSize, void *pCmdData,
|
||||||
uint32_t *replySize, void *pReplyData) {
|
uint32_t *replySize, void *pReplyData) {
|
||||||
VIPER_LOGD("viperInterfaceCommand() called");
|
|
||||||
auto viperHandle = reinterpret_cast<ViperHandle *>(self);
|
auto viperHandle = reinterpret_cast<ViperHandle *>(self);
|
||||||
if (viperHandle == nullptr) return -EINVAL;
|
if (viperHandle == nullptr) return -EINVAL;
|
||||||
|
|
||||||
@ -41,7 +39,6 @@ static int32_t viperInterfaceCommand(effect_handle_t self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t viperInterfaceGetDescriptor(effect_handle_t self, effect_descriptor_t *pDescriptor) {
|
static int32_t viperInterfaceGetDescriptor(effect_handle_t self, effect_descriptor_t *pDescriptor) {
|
||||||
VIPER_LOGD("viperInterfaceGetDescriptor() called");
|
|
||||||
if (pDescriptor == nullptr) return -EINVAL;
|
if (pDescriptor == nullptr) return -EINVAL;
|
||||||
*pDescriptor = viperDescriptor;
|
*pDescriptor = viperDescriptor;
|
||||||
return 0;
|
return 0;
|
||||||
@ -56,7 +53,6 @@ static const effect_interface_s viperInterface = {
|
|||||||
static int32_t
|
static int32_t
|
||||||
viperLibraryCreate(const effect_uuid_t *uuid, int32_t sessionId __unused, int32_t ioId __unused,
|
viperLibraryCreate(const effect_uuid_t *uuid, int32_t sessionId __unused, int32_t ioId __unused,
|
||||||
effect_handle_t *pHandle) {
|
effect_handle_t *pHandle) {
|
||||||
VIPER_LOGD("viperLibraryCreate() called");
|
|
||||||
if (uuid == nullptr || pHandle == nullptr) return -EINVAL;
|
if (uuid == nullptr || pHandle == nullptr) return -EINVAL;
|
||||||
if (memcmp(uuid, &viperDescriptor.uuid, sizeof(effect_uuid_t)) != 0) return -ENOENT;
|
if (memcmp(uuid, &viperDescriptor.uuid, sizeof(effect_uuid_t)) != 0) return -ENOENT;
|
||||||
|
|
||||||
@ -68,7 +64,6 @@ viperLibraryCreate(const effect_uuid_t *uuid, int32_t sessionId __unused, int32_
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t viperLibraryRelease(effect_handle_t handle) {
|
static int32_t viperLibraryRelease(effect_handle_t handle) {
|
||||||
VIPER_LOGD("viperLibraryRelease() called");
|
|
||||||
auto viperHandle = reinterpret_cast<ViperHandle *>(handle);
|
auto viperHandle = reinterpret_cast<ViperHandle *>(handle);
|
||||||
if (viperHandle == nullptr) return -EINVAL;
|
if (viperHandle == nullptr) return -EINVAL;
|
||||||
|
|
||||||
@ -77,7 +72,6 @@ static int32_t viperLibraryRelease(effect_handle_t handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t viperLibraryGetDescriptor(const effect_uuid_t *uuid, effect_descriptor_t *pDescriptor) {
|
static int32_t viperLibraryGetDescriptor(const effect_uuid_t *uuid, effect_descriptor_t *pDescriptor) {
|
||||||
VIPER_LOGD("viperLibraryGetDescriptor() called");
|
|
||||||
if (uuid == nullptr || pDescriptor == nullptr) return -EINVAL;
|
if (uuid == nullptr || pDescriptor == nullptr) return -EINVAL;
|
||||||
if (memcmp(uuid, &viperDescriptor.uuid, sizeof(effect_uuid_t)) != 0) return -ENOENT;
|
if (memcmp(uuid, &viperDescriptor.uuid, sizeof(effect_uuid_t)) != 0) return -ENOENT;
|
||||||
|
|
||||||
|
@ -15,13 +15,17 @@ ViperContext::ViperContext() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViperContext::handleSetConfig(effect_config_t *newConfig) {
|
void ViperContext::handleSetConfig(effect_config_t *newConfig) {
|
||||||
|
// TODO: Check the mask and set the config accordingly
|
||||||
|
|
||||||
VIPER_LOGI("Checking input and output configuration ...");
|
VIPER_LOGI("Checking input and output configuration ...");
|
||||||
|
|
||||||
|
VIPER_LOGI("Input mask: 0x%04X", newConfig->inputCfg.mask);
|
||||||
VIPER_LOGI("Input buffer frame count: %ld", newConfig->inputCfg.buffer.frameCount);
|
VIPER_LOGI("Input buffer frame count: %ld", newConfig->inputCfg.buffer.frameCount);
|
||||||
VIPER_LOGI("Input sampling rate: %d", newConfig->inputCfg.samplingRate);
|
VIPER_LOGI("Input sampling rate: %d", newConfig->inputCfg.samplingRate);
|
||||||
VIPER_LOGI("Input channels: %d", newConfig->inputCfg.channels);
|
VIPER_LOGI("Input channels: %d", newConfig->inputCfg.channels);
|
||||||
VIPER_LOGI("Input format: %d", newConfig->inputCfg.format);
|
VIPER_LOGI("Input format: %d", newConfig->inputCfg.format);
|
||||||
VIPER_LOGI("Input access mode: %d", newConfig->inputCfg.accessMode);
|
VIPER_LOGI("Input access mode: %d", newConfig->inputCfg.accessMode);
|
||||||
|
VIPER_LOGI("Output mask: 0x%04X", newConfig->outputCfg.mask);
|
||||||
VIPER_LOGI("Output buffer frame count: %ld", newConfig->outputCfg.buffer.frameCount);
|
VIPER_LOGI("Output buffer frame count: %ld", newConfig->outputCfg.buffer.frameCount);
|
||||||
VIPER_LOGI("Output sampling rate: %d", newConfig->outputCfg.samplingRate);
|
VIPER_LOGI("Output sampling rate: %d", newConfig->outputCfg.samplingRate);
|
||||||
VIPER_LOGI("Output channels: %d", newConfig->outputCfg.channels);
|
VIPER_LOGI("Output channels: %d", newConfig->outputCfg.channels);
|
||||||
@ -196,7 +200,7 @@ int32_t ViperContext::handleGetParam(effect_param_t *pCmdParam, effect_param_t *
|
|||||||
case PARAM_GET_CONVOLUTION_KERNEL_ID: {
|
case PARAM_GET_CONVOLUTION_KERNEL_ID: {
|
||||||
pReplyParam->status = 0;
|
pReplyParam->status = 0;
|
||||||
pReplyParam->vsize = sizeof(uint32_t);
|
pReplyParam->vsize = sizeof(uint32_t);
|
||||||
*(uint32_t *) (pReplyParam->data + vOffset) = viper.convolver->GetKernelID();
|
*(uint32_t *) (pReplyParam->data + vOffset) = viper.convolver.GetKernelID();
|
||||||
*pReplySize = sizeof(effect_param_t) + pReplyParam->psize + vOffset + pReplyParam->vsize;
|
*pReplySize = sizeof(effect_param_t) + pReplyParam->psize + vOffset + pReplyParam->vsize;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3,102 +3,85 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
|
|
||||||
ViPER::ViPER() {
|
ViPER::ViPER() :
|
||||||
|
updateProcessTime(false),
|
||||||
|
processTimeMs(0),
|
||||||
|
samplingRate(VIPER_DEFAULT_SAMPLING_RATE),
|
||||||
|
adaptiveBuffer(AdaptiveBuffer(2, 4096)),
|
||||||
|
waveBuffer(WaveBuffer(2, 4096)),
|
||||||
|
iirFilter(IIRFilter(10)) {
|
||||||
VIPER_LOGI("Welcome to ViPER FX");
|
VIPER_LOGI("Welcome to ViPER FX");
|
||||||
VIPER_LOGI("Current version is %s (%d)", VERSION_NAME, VERSION_CODE);
|
VIPER_LOGI("Current version is %s (%d)", VERSION_NAME, VERSION_CODE);
|
||||||
|
|
||||||
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;
|
this->convolver.SetEnable(false);
|
||||||
|
this->convolver.SetSamplingRate(this->samplingRate);
|
||||||
|
this->convolver.Reset();
|
||||||
|
|
||||||
this->adaptiveBuffer = new AdaptiveBuffer(2, 4096);
|
this->vhe.SetEnable(false);
|
||||||
this->waveBuffer = new WaveBuffer(2, 4096);
|
this->vhe.SetSamplingRate(this->samplingRate);
|
||||||
|
this->vhe.Reset();
|
||||||
|
|
||||||
this->convolver = new Convolver();
|
this->viperDdc.SetEnable(false);
|
||||||
this->convolver->SetEnable(false);
|
this->viperDdc.SetSamplingRate(this->samplingRate);
|
||||||
this->convolver->SetSamplingRate(this->samplingRate);
|
this->viperDdc.Reset();
|
||||||
this->convolver->Reset();
|
|
||||||
|
|
||||||
this->vhe = new VHE();
|
this->spectrumExtend.SetEnable(false);
|
||||||
this->vhe->SetEnable(false);
|
this->spectrumExtend.SetSamplingRate(this->samplingRate);
|
||||||
this->vhe->SetSamplingRate(this->samplingRate);
|
this->spectrumExtend.SetReferenceFrequency(7600);
|
||||||
this->vhe->Reset();
|
this->spectrumExtend.SetExciter(0);
|
||||||
|
this->spectrumExtend.Reset();
|
||||||
|
|
||||||
this->viperDdc = new ViPERDDC();
|
this->iirFilter.SetEnable(false);
|
||||||
this->viperDdc->SetEnable(false);
|
this->iirFilter.SetSamplingRate(this->samplingRate);
|
||||||
this->viperDdc->SetSamplingRate(this->samplingRate);
|
this->iirFilter.Reset();
|
||||||
this->viperDdc->Reset();
|
|
||||||
|
|
||||||
this->spectrumExtend = new SpectrumExtend();
|
this->colorfulMusic.SetEnable(false);
|
||||||
this->spectrumExtend->SetEnable(false);
|
this->colorfulMusic.SetSamplingRate(this->samplingRate);
|
||||||
this->spectrumExtend->SetSamplingRate(this->samplingRate);
|
this->colorfulMusic.Reset();
|
||||||
this->spectrumExtend->SetReferenceFrequency(7600);
|
|
||||||
this->spectrumExtend->SetExciter(0);
|
|
||||||
this->spectrumExtend->Reset();
|
|
||||||
|
|
||||||
this->iirFilter = new IIRFilter(10);
|
this->reverberation.SetEnable(false);
|
||||||
this->iirFilter->SetEnable(false);
|
this->reverberation.Reset();
|
||||||
this->iirFilter->SetSamplingRate(this->samplingRate);
|
|
||||||
this->iirFilter->Reset();
|
|
||||||
|
|
||||||
this->colorfulMusic = new ColorfulMusic();
|
this->playbackGain.SetEnable(false);
|
||||||
this->colorfulMusic->SetEnable(false);
|
this->playbackGain.SetSamplingRate(this->samplingRate);
|
||||||
this->colorfulMusic->SetSamplingRate(this->samplingRate);
|
this->playbackGain.Reset();
|
||||||
this->colorfulMusic->Reset();
|
|
||||||
|
|
||||||
this->reverberation = new Reverberation();
|
this->fetCompressor.SetParameter(FETCompressor::ENABLE, 0.0);
|
||||||
this->reverberation->SetEnable(false);
|
this->fetCompressor.SetSamplingRate(this->samplingRate);
|
||||||
this->reverberation->Reset();
|
this->fetCompressor.Reset();
|
||||||
|
|
||||||
this->playbackGain = new PlaybackGain();
|
this->dynamicSystem.SetEnable(false);
|
||||||
this->playbackGain->SetEnable(false);
|
this->dynamicSystem.SetSamplingRate(this->samplingRate);
|
||||||
this->playbackGain->SetSamplingRate(this->samplingRate);
|
this->dynamicSystem.Reset();
|
||||||
this->playbackGain->Reset();
|
|
||||||
|
|
||||||
this->fetCompressor = new FETCompressor();
|
this->viperBass.SetSamplingRate(this->samplingRate);
|
||||||
this->fetCompressor->SetParameter(FETCompressor::ENABLE, 0.0);
|
this->viperBass.Reset();
|
||||||
this->fetCompressor->SetSamplingRate(this->samplingRate);
|
|
||||||
this->fetCompressor->Reset();
|
|
||||||
|
|
||||||
this->dynamicSystem = new DynamicSystem();
|
this->viperClarity.SetSamplingRate(this->samplingRate);
|
||||||
this->dynamicSystem->SetEnable(false);
|
this->viperClarity.Reset();
|
||||||
this->dynamicSystem->SetSamplingRate(this->samplingRate);
|
|
||||||
this->dynamicSystem->Reset();
|
|
||||||
|
|
||||||
this->viperBass = new ViPERBass();
|
this->diffSurround.SetEnable(false);
|
||||||
this->viperBass->SetSamplingRate(this->samplingRate);
|
this->diffSurround.SetSamplingRate(this->samplingRate);
|
||||||
this->viperBass->Reset();
|
this->diffSurround.Reset();
|
||||||
|
|
||||||
this->viperClarity = new ViPERClarity();
|
this->cure.SetEnable(false);
|
||||||
this->viperClarity->SetSamplingRate(this->samplingRate);
|
this->cure.SetSamplingRate(this->samplingRate);
|
||||||
this->viperClarity->Reset();
|
this->cure.Reset();
|
||||||
|
|
||||||
this->diffSurround = new DiffSurround();
|
this->tubeSimulator.SetEnable(false);
|
||||||
this->diffSurround->SetEnable(false);
|
this->tubeSimulator.Reset();
|
||||||
this->diffSurround->SetSamplingRate(this->samplingRate);
|
|
||||||
this->diffSurround->Reset();
|
|
||||||
|
|
||||||
this->cure = new Cure();
|
this->analogX.SetEnable(false);
|
||||||
this->cure->SetEnable(false);
|
this->analogX.SetSamplingRate(this->samplingRate);
|
||||||
this->cure->SetSamplingRate(this->samplingRate);
|
this->analogX.SetProcessingModel(0);
|
||||||
this->cure->Reset();
|
this->analogX.Reset();
|
||||||
|
|
||||||
this->tubeSimulator = new TubeSimulator();
|
this->speakerCorrection.SetEnable(false);
|
||||||
this->tubeSimulator->SetEnable(false);
|
this->speakerCorrection.SetSamplingRate(this->samplingRate);
|
||||||
this->tubeSimulator->Reset();
|
this->speakerCorrection.Reset();
|
||||||
|
|
||||||
this->analogX = new AnalogX();
|
|
||||||
this->analogX->SetEnable(false);
|
|
||||||
this->analogX->SetSamplingRate(this->samplingRate);
|
|
||||||
this->analogX->SetProcessingModel(0);
|
|
||||||
this->analogX->Reset();
|
|
||||||
|
|
||||||
this->speakerCorrection = new SpeakerCorrection();
|
|
||||||
this->speakerCorrection->SetEnable(false);
|
|
||||||
this->speakerCorrection->SetSamplingRate(this->samplingRate);
|
|
||||||
this->speakerCorrection->Reset();
|
|
||||||
|
|
||||||
for (auto &softwareLimiter: this->softwareLimiters) {
|
for (auto &softwareLimiter: this->softwareLimiters) {
|
||||||
softwareLimiter = new SoftwareLimiter();
|
softwareLimiter.Reset();
|
||||||
softwareLimiter->Reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->frameScale = 1.0;
|
this->frameScale = 1.0;
|
||||||
@ -108,31 +91,6 @@ ViPER::ViPER() {
|
|||||||
this->processTimeMs = 0;
|
this->processTimeMs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
for (auto &softwareLimiter: this->softwareLimiters) {
|
|
||||||
delete softwareLimiter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViPER::process(std::vector<float>& buffer, uint32_t size) {
|
void ViPER::process(std::vector<float>& buffer, uint32_t size) {
|
||||||
if (this->updateProcessTime) {
|
if (this->updateProcessTime) {
|
||||||
auto now = std::chrono::system_clock::now();
|
auto now = std::chrono::system_clock::now();
|
||||||
@ -144,78 +102,78 @@ void ViPER::process(std::vector<float>& buffer, uint32_t size) {
|
|||||||
float *tmpBuf;
|
float *tmpBuf;
|
||||||
uint32_t tmpBufSize;
|
uint32_t tmpBufSize;
|
||||||
|
|
||||||
if (this->convolver->GetEnabled() || this->vhe->GetEnabled()) {
|
if (this->convolver.GetEnabled() || this->vhe.GetEnabled()) {
|
||||||
// VIPER_LOGD("Convolver or VHE is enable, use wave buffer");
|
// VIPER_LOGD("Convolver or VHE is enable, use wave buffer");
|
||||||
|
|
||||||
if (!this->waveBuffer->PushSamples(buffer.data(), size)) {
|
if (!this->waveBuffer.PushSamples(buffer.data(), size)) {
|
||||||
this->waveBuffer->Reset();
|
this->waveBuffer.Reset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float *ptr = this->waveBuffer->GetBuffer();
|
float *ptr = this->waveBuffer.GetBuffer();
|
||||||
ret = this->convolver->Process(ptr, ptr, size);
|
ret = this->convolver.Process(ptr, ptr, size);
|
||||||
ret = this->vhe->Process(ptr, ptr, ret);
|
ret = this->vhe.Process(ptr, ptr, ret);
|
||||||
this->waveBuffer->SetBufferOffset(ret);
|
this->waveBuffer.SetBufferOffset(ret);
|
||||||
|
|
||||||
if (!this->adaptiveBuffer->PushZero(ret)) {
|
if (!this->adaptiveBuffer.PushZero(ret)) {
|
||||||
this->waveBuffer->Reset();
|
this->waveBuffer.Reset();
|
||||||
this->adaptiveBuffer->FlushBuffer();
|
this->adaptiveBuffer.FlushBuffer();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = this->adaptiveBuffer->GetBuffer();
|
ptr = this->adaptiveBuffer.GetBuffer();
|
||||||
ret = this->waveBuffer->PopSamples(ptr, ret, true);
|
ret = this->waveBuffer.PopSamples(ptr, ret, true);
|
||||||
this->adaptiveBuffer->SetBufferOffset(ret);
|
this->adaptiveBuffer.SetBufferOffset(ret);
|
||||||
|
|
||||||
tmpBuf = ptr;
|
tmpBuf = ptr;
|
||||||
tmpBufSize = ret;
|
tmpBufSize = ret;
|
||||||
} else {
|
} else {
|
||||||
// VIPER_LOGD("Convolver and VHE are disabled, use adaptive buffer");
|
// VIPER_LOGD("Convolver and VHE are disabled, use adaptive buffer");
|
||||||
|
|
||||||
if (this->adaptiveBuffer->PushFrames(buffer.data(), size)) {
|
if (this->adaptiveBuffer.PushFrames(buffer.data(), size)) {
|
||||||
this->adaptiveBuffer->SetBufferOffset(size);
|
this->adaptiveBuffer.SetBufferOffset(size);
|
||||||
|
|
||||||
tmpBuf = this->adaptiveBuffer->GetBuffer();
|
tmpBuf = this->adaptiveBuffer.GetBuffer();
|
||||||
tmpBufSize = size;
|
tmpBufSize = size;
|
||||||
} else {
|
} else {
|
||||||
this->adaptiveBuffer->FlushBuffer();
|
this->adaptiveBuffer.FlushBuffer();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VIPER_LOGD("Process buffer size: %d", tmpBufSize);
|
// VIPER_LOGD("Process buffer size: %d", tmpBufSize);
|
||||||
if (tmpBufSize != 0) {
|
if (tmpBufSize != 0) {
|
||||||
this->viperDdc->Process(tmpBuf, size);
|
this->viperDdc.Process(tmpBuf, size);
|
||||||
this->spectrumExtend->Process(tmpBuf, size);
|
this->spectrumExtend.Process(tmpBuf, size);
|
||||||
this->iirFilter->Process(tmpBuf, tmpBufSize);
|
this->iirFilter.Process(tmpBuf, tmpBufSize);
|
||||||
this->colorfulMusic->Process(tmpBuf, tmpBufSize);
|
this->colorfulMusic.Process(tmpBuf, tmpBufSize);
|
||||||
this->diffSurround->Process(tmpBuf, tmpBufSize);
|
this->diffSurround.Process(tmpBuf, tmpBufSize);
|
||||||
this->reverberation->Process(tmpBuf, tmpBufSize);
|
this->reverberation.Process(tmpBuf, tmpBufSize);
|
||||||
this->speakerCorrection->Process(tmpBuf, tmpBufSize);
|
this->speakerCorrection.Process(tmpBuf, tmpBufSize);
|
||||||
this->playbackGain->Process(tmpBuf, tmpBufSize);
|
this->playbackGain.Process(tmpBuf, tmpBufSize);
|
||||||
this->fetCompressor->Process(tmpBuf, tmpBufSize); // TODO: enable check
|
this->fetCompressor.Process(tmpBuf, tmpBufSize); // TODO: enable check
|
||||||
this->dynamicSystem->Process(tmpBuf, tmpBufSize);
|
this->dynamicSystem.Process(tmpBuf, tmpBufSize);
|
||||||
this->viperBass->Process(tmpBuf, tmpBufSize);
|
this->viperBass.Process(tmpBuf, tmpBufSize);
|
||||||
this->viperClarity->Process(tmpBuf, tmpBufSize);
|
this->viperClarity.Process(tmpBuf, tmpBufSize);
|
||||||
this->cure->Process(tmpBuf, tmpBufSize);
|
this->cure.Process(tmpBuf, tmpBufSize);
|
||||||
this->tubeSimulator->TubeProcess(tmpBuf, size);
|
this->tubeSimulator.TubeProcess(tmpBuf, size);
|
||||||
this->analogX->Process(tmpBuf, tmpBufSize);
|
this->analogX.Process(tmpBuf, tmpBufSize);
|
||||||
|
|
||||||
if (this->frameScale != 1.0) {
|
if (this->frameScale != 1.0) {
|
||||||
this->adaptiveBuffer->ScaleFrames(this->frameScale);
|
this->adaptiveBuffer.ScaleFrames(this->frameScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->leftPan < 1.0 || this->rightPan < 1.0) {
|
if (this->leftPan < 1.0 || this->rightPan < 1.0) {
|
||||||
this->adaptiveBuffer->PanFrames(this->leftPan, this->rightPan);
|
this->adaptiveBuffer.PanFrames(this->leftPan, this->rightPan);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < tmpBufSize * 2; i += 2) {
|
for (uint32_t i = 0; i < tmpBufSize * 2; i += 2) {
|
||||||
tmpBuf[i] = this->softwareLimiters[0]->Process(tmpBuf[i]);
|
tmpBuf[i] = this->softwareLimiters[0].Process(tmpBuf[i]);
|
||||||
tmpBuf[i + 1] = this->softwareLimiters[1]->Process(tmpBuf[i + 1]);
|
tmpBuf[i + 1] = this->softwareLimiters[1].Process(tmpBuf[i + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->adaptiveBuffer->PopFrames(buffer.data(), tmpBufSize)) {
|
if (!this->adaptiveBuffer.PopFrames(buffer.data(), tmpBufSize)) {
|
||||||
this->adaptiveBuffer->FlushBuffer();
|
this->adaptiveBuffer.FlushBuffer();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +199,7 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PARAM_CONVOLUTION_ENABLE: {
|
case PARAM_CONVOLUTION_ENABLE: {
|
||||||
// this->convolver->SetEnabled(val1 != 0);
|
// this->convolver.SetEnabled(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10002
|
} // 0x10002
|
||||||
case PARAM_CONVOLUTION_PREPARE_BUFFER: {
|
case PARAM_CONVOLUTION_PREPARE_BUFFER: {
|
||||||
@ -254,159 +212,159 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
break;
|
break;
|
||||||
} // 0x10006
|
} // 0x10006
|
||||||
case PARAM_CONVOLUTION_CROSS_CHANNEL: {
|
case PARAM_CONVOLUTION_CROSS_CHANNEL: {
|
||||||
this->convolver->SetCrossChannel((float) val1 / 100.0f);
|
this->convolver.SetCrossChannel((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10007
|
} // 0x10007
|
||||||
case PARAM_HEADPHONE_SURROUND_ENABLE: {
|
case PARAM_HEADPHONE_SURROUND_ENABLE: {
|
||||||
this->vhe->SetEnable(val1 != 0);
|
this->vhe.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10008
|
} // 0x10008
|
||||||
case PARAM_HEADPHONE_SURROUND_STRENGTH: {
|
case PARAM_HEADPHONE_SURROUND_STRENGTH: {
|
||||||
this->vhe->SetEffectLevel(val1);
|
this->vhe.SetEffectLevel(val1);
|
||||||
break;
|
break;
|
||||||
} // 0x10009
|
} // 0x10009
|
||||||
case PARAM_DDC_ENABLE: {
|
case PARAM_DDC_ENABLE: {
|
||||||
this->viperDdc->SetEnable(val1 != 0);
|
this->viperDdc.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1000A
|
} // 0x1000A
|
||||||
case PARAM_DDC_COEFFICIENTS: {
|
case PARAM_DDC_COEFFICIENTS: {
|
||||||
this->viperDdc->SetCoeffs(arrSize, (float *) arr, (float *) (arr + arrSize * 4));
|
this->viperDdc.SetCoeffs(arrSize, (float *) arr, (float *) (arr + arrSize * 4));
|
||||||
break;
|
break;
|
||||||
} // 0x1000B
|
} // 0x1000B
|
||||||
case PARAM_SPECTRUM_EXTENSION_ENABLE: {
|
case PARAM_SPECTRUM_EXTENSION_ENABLE: {
|
||||||
this->spectrumExtend->SetEnable(val1 != 0);
|
this->spectrumExtend.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1000C
|
} // 0x1000C
|
||||||
case PARAM_SPECTRUM_EXTENSION_BARK: {
|
case PARAM_SPECTRUM_EXTENSION_BARK: {
|
||||||
this->spectrumExtend->SetReferenceFrequency(val1);
|
this->spectrumExtend.SetReferenceFrequency(val1);
|
||||||
break;
|
break;
|
||||||
} // 0x1000D
|
} // 0x1000D
|
||||||
case PARAM_SPECTRUM_EXTENSION_BARK_RECONSTRUCT: {
|
case PARAM_SPECTRUM_EXTENSION_BARK_RECONSTRUCT: {
|
||||||
this->spectrumExtend->SetExciter((float) val1 / 100.0f);
|
this->spectrumExtend.SetExciter((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x1000E
|
} // 0x1000E
|
||||||
case PARAM_FIR_EQUALIZER_ENABLE: {
|
case PARAM_FIR_EQUALIZER_ENABLE: {
|
||||||
this->iirFilter->SetEnable(val1 != 0);
|
this->iirFilter.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1000F
|
} // 0x1000F
|
||||||
case PARAM_FIR_EQUALIZER_BAND_LEVEL: {
|
case PARAM_FIR_EQUALIZER_BAND_LEVEL: {
|
||||||
this->iirFilter->SetBandLevel((uint32_t) val1, (float) val2 / 100.0f);
|
this->iirFilter.SetBandLevel((uint32_t) val1, (float) val2 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10010
|
} // 0x10010
|
||||||
case PARAM_FIELD_SURROUND_ENABLE: {
|
case PARAM_FIELD_SURROUND_ENABLE: {
|
||||||
this->colorfulMusic->SetEnable(val1 != 0);
|
this->colorfulMusic.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10011
|
} // 0x10011
|
||||||
case PARAM_FIELD_SURROUND_WIDENING: {
|
case PARAM_FIELD_SURROUND_WIDENING: {
|
||||||
this->colorfulMusic->SetWidenValue((float) val1 / 100.0f);
|
this->colorfulMusic.SetWidenValue((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10012
|
} // 0x10012
|
||||||
case PARAM_FIELD_SURROUND_MID_IMAGE: {
|
case PARAM_FIELD_SURROUND_MID_IMAGE: {
|
||||||
this->colorfulMusic->SetMidImageValue((float) val1 / 100.0f);
|
this->colorfulMusic.SetMidImageValue((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10013
|
} // 0x10013
|
||||||
case PARAM_FIELD_SURROUND_DEPTH: {
|
case PARAM_FIELD_SURROUND_DEPTH: {
|
||||||
this->colorfulMusic->SetDepthValue((short) val1);
|
this->colorfulMusic.SetDepthValue((short) val1);
|
||||||
break;
|
break;
|
||||||
} // 0x10014
|
} // 0x10014
|
||||||
case PARAM_DIFFERENTIAL_SURROUND_ENABLE: {
|
case PARAM_DIFFERENTIAL_SURROUND_ENABLE: {
|
||||||
this->diffSurround->SetEnable(val1 != 0);
|
this->diffSurround.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10015
|
} // 0x10015
|
||||||
case PARAM_DIFFERENTIAL_SURROUND_DELAY: {
|
case PARAM_DIFFERENTIAL_SURROUND_DELAY: {
|
||||||
this->diffSurround->SetDelayTime((float) val1 / 100.0f);
|
this->diffSurround.SetDelayTime((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10016
|
} // 0x10016
|
||||||
case PARAM_REVERBERATION_ENABLE: {
|
case PARAM_REVERBERATION_ENABLE: {
|
||||||
this->reverberation->SetEnable(val1 != 0);
|
this->reverberation.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10017
|
} // 0x10017
|
||||||
case PARAM_REVERBERATION_ROOM_SIZE: {
|
case PARAM_REVERBERATION_ROOM_SIZE: {
|
||||||
this->reverberation->SetRoomSize((float) val1 / 100.0f);
|
this->reverberation.SetRoomSize((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10018
|
} // 0x10018
|
||||||
case PARAM_REVERBERATION_ROOM_WIDTH: {
|
case PARAM_REVERBERATION_ROOM_WIDTH: {
|
||||||
this->reverberation->SetWidth((float) val1 / 100.0f);
|
this->reverberation.SetWidth((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10019
|
} // 0x10019
|
||||||
case PARAM_REVERBERATION_ROOM_DAMPENING: {
|
case PARAM_REVERBERATION_ROOM_DAMPENING: {
|
||||||
this->reverberation->SetDamp((float) val1 / 100.0f);
|
this->reverberation.SetDamp((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x1001A
|
} // 0x1001A
|
||||||
case PARAM_REVERBERATION_ROOM_WET_SIGNAL: {
|
case PARAM_REVERBERATION_ROOM_WET_SIGNAL: {
|
||||||
this->reverberation->SetWet((float) val1 / 100.0f);
|
this->reverberation.SetWet((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x1001B
|
} // 0x1001B
|
||||||
case PARAM_REVERBERATION_ROOM_DRY_SIGNAL: {
|
case PARAM_REVERBERATION_ROOM_DRY_SIGNAL: {
|
||||||
this->reverberation->SetDry((float) val1 / 100.0f);
|
this->reverberation.SetDry((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x1001C
|
} // 0x1001C
|
||||||
case PARAM_AUTOMATIC_GAIN_CONTROL_ENABLE: {
|
case PARAM_AUTOMATIC_GAIN_CONTROL_ENABLE: {
|
||||||
this->playbackGain->SetEnable(val1 != 0);
|
this->playbackGain.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1001D
|
} // 0x1001D
|
||||||
case PARAM_AUTOMATIC_GAIN_CONTROL_RATIO: {
|
case PARAM_AUTOMATIC_GAIN_CONTROL_RATIO: {
|
||||||
this->playbackGain->SetRatio((float) val1 / 100.0f);
|
this->playbackGain.SetRatio((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x1001E
|
} // 0x1001E
|
||||||
case PARAM_AUTOMATIC_GAIN_CONTROL_VOLUME: {
|
case PARAM_AUTOMATIC_GAIN_CONTROL_VOLUME: {
|
||||||
this->playbackGain->SetVolume((float) val1 / 100.0f);
|
this->playbackGain.SetVolume((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x1001F
|
} // 0x1001F
|
||||||
case PARAM_AUTOMATIC_GAIN_CONTROL_MAX_SCALER: {
|
case PARAM_AUTOMATIC_GAIN_CONTROL_MAX_SCALER: {
|
||||||
this->playbackGain->SetMaxGainFactor((float) val1 / 100.0f);
|
this->playbackGain.SetMaxGainFactor((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10020
|
} // 0x10020
|
||||||
case PARAM_DYNAMIC_SYSTEM_ENABLE: {
|
case PARAM_DYNAMIC_SYSTEM_ENABLE: {
|
||||||
this->dynamicSystem->SetEnable(val1 != 0);
|
this->dynamicSystem.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10021
|
} // 0x10021
|
||||||
case PARAM_DYNAMIC_SYSTEM_X_COEFFICIENTS: {
|
case PARAM_DYNAMIC_SYSTEM_X_COEFFICIENTS: {
|
||||||
this->dynamicSystem->SetXCoeffs(val1, val2);
|
this->dynamicSystem.SetXCoeffs(val1, val2);
|
||||||
break;
|
break;
|
||||||
} // 0x10022
|
} // 0x10022
|
||||||
case PARAM_DYNAMIC_SYSTEM_Y_COEFFICIENTS: {
|
case PARAM_DYNAMIC_SYSTEM_Y_COEFFICIENTS: {
|
||||||
this->dynamicSystem->SetYCoeffs(val1, val2);
|
this->dynamicSystem.SetYCoeffs(val1, val2);
|
||||||
break;
|
break;
|
||||||
} // 0x10023
|
} // 0x10023
|
||||||
case PARAM_DYNAMIC_SYSTEM_SIDE_GAIN: {
|
case PARAM_DYNAMIC_SYSTEM_SIDE_GAIN: {
|
||||||
this->dynamicSystem->SetSideGain((float) val1 / 100.0f, (float) val2 / 100.0f);
|
this->dynamicSystem.SetSideGain((float) val1 / 100.0f, (float) val2 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10024
|
} // 0x10024
|
||||||
case PARAM_DYNAMIC_SYSTEM_STRENGTH: {
|
case PARAM_DYNAMIC_SYSTEM_STRENGTH: {
|
||||||
this->dynamicSystem->SetBassGain((float) val1 / 100.0f);
|
this->dynamicSystem.SetBassGain((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10025
|
} // 0x10025
|
||||||
case PARAM_FIDELITY_BASS_ENABLE: {
|
case PARAM_FIDELITY_BASS_ENABLE: {
|
||||||
this->viperBass->SetEnable(val1 != 0);
|
this->viperBass.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10026
|
} // 0x10026
|
||||||
case PARAM_FIDELITY_BASS_MODE: {
|
case PARAM_FIDELITY_BASS_MODE: {
|
||||||
this->viperBass->SetProcessMode((ViPERBass::ProcessMode) val1);
|
this->viperBass.SetProcessMode((ViPERBass::ProcessMode) val1);
|
||||||
break;
|
break;
|
||||||
} // 0x10027
|
} // 0x10027
|
||||||
case PARAM_FIDELITY_BASS_FREQUENCY: {
|
case PARAM_FIDELITY_BASS_FREQUENCY: {
|
||||||
this->viperBass->SetSpeaker((uint32_t) val1);
|
this->viperBass.SetSpeaker((uint32_t) val1);
|
||||||
break;
|
break;
|
||||||
} // 0x10028
|
} // 0x10028
|
||||||
case PARAM_FIDELITY_BASS_GAIN: {
|
case PARAM_FIDELITY_BASS_GAIN: {
|
||||||
this->viperBass->SetBassFactor((float) val1 / 100.0f);
|
this->viperBass.SetBassFactor((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10029
|
} // 0x10029
|
||||||
case PARAM_FIDELITY_CLARITY_ENABLE: {
|
case PARAM_FIDELITY_CLARITY_ENABLE: {
|
||||||
this->viperClarity->SetEnable(val1 != 0);
|
this->viperClarity.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1002A
|
} // 0x1002A
|
||||||
case PARAM_FIDELITY_CLARITY_MODE: {
|
case PARAM_FIDELITY_CLARITY_MODE: {
|
||||||
this->viperClarity->SetProcessMode((ViPERClarity::ClarityMode) val1);
|
this->viperClarity.SetProcessMode((ViPERClarity::ClarityMode) val1);
|
||||||
break;
|
break;
|
||||||
} // 0x1002B
|
} // 0x1002B
|
||||||
case PARAM_FIDELITY_CLARITY_GAIN: {
|
case PARAM_FIDELITY_CLARITY_GAIN: {
|
||||||
this->viperClarity->SetClarity((float) val1 / 100.0f);
|
this->viperClarity.SetClarity((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x1002C
|
} // 0x1002C
|
||||||
case PARAM_CURE_CROSS_FEED_ENABLED: {
|
case PARAM_CURE_CROSS_FEED_ENABLED: {
|
||||||
this->cure->SetEnable(val1 != 0);
|
this->cure.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1002D
|
} // 0x1002D
|
||||||
case PARAM_CURE_CROSS_FEED_STRENGTH: {
|
case PARAM_CURE_CROSS_FEED_STRENGTH: {
|
||||||
@ -417,7 +375,7 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
.cutoff = 650,
|
.cutoff = 650,
|
||||||
.feedback = 95,
|
.feedback = 95,
|
||||||
};
|
};
|
||||||
this->cure->SetPreset(preset);
|
this->cure.SetPreset(preset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
@ -426,7 +384,7 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
.cutoff = 700,
|
.cutoff = 700,
|
||||||
.feedback = 60,
|
.feedback = 60,
|
||||||
};
|
};
|
||||||
this->cure->SetPreset(preset);
|
this->cure.SetPreset(preset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
@ -435,22 +393,22 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
.cutoff = 700,
|
.cutoff = 700,
|
||||||
.feedback = 45,
|
.feedback = 45,
|
||||||
};
|
};
|
||||||
this->cure->SetPreset(preset);
|
this->cure.SetPreset(preset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} // 0x1002E
|
} // 0x1002E
|
||||||
case PARAM_TUBE_SIMULATOR_ENABLED: {
|
case PARAM_TUBE_SIMULATOR_ENABLED: {
|
||||||
this->tubeSimulator->SetEnable(val1 != 0);
|
this->tubeSimulator.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1002F
|
} // 0x1002F
|
||||||
case PARAM_ANALOGX_ENABLE: {
|
case PARAM_ANALOGX_ENABLE: {
|
||||||
this->analogX->SetEnable(val1 != 0);
|
this->analogX.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10030
|
} // 0x10030
|
||||||
case PARAM_ANALOGX_MODE: {
|
case PARAM_ANALOGX_MODE: {
|
||||||
this->analogX->SetProcessingModel(val1);
|
this->analogX.SetProcessingModel(val1);
|
||||||
break;
|
break;
|
||||||
} // 0x10031
|
} // 0x10031
|
||||||
case PARAM_GATE_OUTPUT_VOLUME: {
|
case PARAM_GATE_OUTPUT_VOLUME: {
|
||||||
@ -469,12 +427,12 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
break;
|
break;
|
||||||
} // 0x10033
|
} // 0x10033
|
||||||
case PARAM_GATE_LIMIT: {
|
case PARAM_GATE_LIMIT: {
|
||||||
this->softwareLimiters[0]->SetGate((float) val1 / 100.0f);
|
this->softwareLimiters[0].SetGate((float) val1 / 100.0f);
|
||||||
this->softwareLimiters[1]->SetGate((float) val1 / 100.0f);
|
this->softwareLimiters[1].SetGate((float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10034
|
} // 0x10034
|
||||||
case PARAM_SPEAKER_OPTIMIZATION: {
|
case PARAM_SPEAKER_OPTIMIZATION: {
|
||||||
this->speakerCorrection->SetEnable(val1 != 0);
|
this->speakerCorrection.SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10043
|
} // 0x10043
|
||||||
case PARAM_FET_COMPRESSOR_ENABLE: {
|
case PARAM_FET_COMPRESSOR_ENABLE: {
|
||||||
@ -484,7 +442,7 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
break;
|
break;
|
||||||
} // 0x1004A
|
} // 0x1004A
|
||||||
case PARAM_FET_COMPRESSOR_RATIO: {
|
case PARAM_FET_COMPRESSOR_RATIO: {
|
||||||
this->fetCompressor->SetParameter(FETCompressor::THRESHOLD, (float) val1 / 100.0f);
|
this->fetCompressor.SetParameter(FETCompressor::THRESHOLD, (float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x1004B
|
} // 0x1004B
|
||||||
case PARAM_FET_COMPRESSOR_KNEE: {
|
case PARAM_FET_COMPRESSOR_KNEE: {
|
||||||
@ -497,7 +455,7 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
break;
|
break;
|
||||||
} // 0x1004E
|
} // 0x1004E
|
||||||
case PARAM_FET_COMPRESSOR_AUTO_GAIN: {
|
case PARAM_FET_COMPRESSOR_AUTO_GAIN: {
|
||||||
this->fetCompressor->SetParameter(FETCompressor::GAIN, (float) val1 / 100.0f);
|
this->fetCompressor.SetParameter(FETCompressor::GAIN, (float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x1004F
|
} // 0x1004F
|
||||||
case PARAM_FET_COMPRESSOR_ATTACK: {
|
case PARAM_FET_COMPRESSOR_ATTACK: {
|
||||||
@ -519,7 +477,7 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
break;
|
break;
|
||||||
} // 0x10055
|
} // 0x10055
|
||||||
case PARAM_FET_COMPRESSOR_MAX_RELEASE: {
|
case PARAM_FET_COMPRESSOR_MAX_RELEASE: {
|
||||||
this->fetCompressor->SetParameter(FETCompressor::MAX_ATTACK, (float) val1 / 100.0f);
|
this->fetCompressor.SetParameter(FETCompressor::MAX_ATTACK, (float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10056
|
} // 0x10056
|
||||||
case PARAM_FET_COMPRESSOR_CREST: {
|
case PARAM_FET_COMPRESSOR_CREST: {
|
||||||
@ -529,88 +487,67 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
break;
|
break;
|
||||||
} // 0x10058
|
} // 0x10058
|
||||||
case PARAM_FET_COMPRESSOR_NO_CLIP: {
|
case PARAM_FET_COMPRESSOR_NO_CLIP: {
|
||||||
this->fetCompressor->SetParameter(FETCompressor::ADAPT, (float) val1 / 100.0f);
|
this->fetCompressor.SetParameter(FETCompressor::ADAPT, (float) val1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10059
|
} // 0x10059
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViPER::resetAllEffects() {
|
void ViPER::resetAllEffects() {
|
||||||
if (this->adaptiveBuffer != nullptr) {
|
this->adaptiveBuffer.FlushBuffer();
|
||||||
this->adaptiveBuffer->FlushBuffer();
|
|
||||||
}
|
this->waveBuffer.Reset();
|
||||||
if (this->waveBuffer != nullptr) {
|
|
||||||
this->waveBuffer->Reset();
|
this->convolver.SetSamplingRate(this->samplingRate);
|
||||||
}
|
this->convolver.Reset();
|
||||||
if (this->convolver != nullptr) {
|
|
||||||
this->convolver->SetSamplingRate(this->samplingRate);
|
this->vhe.SetSamplingRate(this->samplingRate);
|
||||||
this->convolver->Reset();
|
this->vhe.Reset();
|
||||||
}
|
|
||||||
if (this->vhe != nullptr) {
|
this->viperDdc.SetSamplingRate(this->samplingRate);
|
||||||
this->vhe->SetSamplingRate(this->samplingRate);
|
this->viperDdc.Reset();
|
||||||
this->vhe->Reset();
|
|
||||||
}
|
this->spectrumExtend.SetSamplingRate(this->samplingRate);
|
||||||
if (this->viperDdc != nullptr) {
|
this->spectrumExtend.Reset();
|
||||||
this->viperDdc->SetSamplingRate(this->samplingRate);
|
|
||||||
this->viperDdc->Reset();
|
this->iirFilter.SetSamplingRate(this->samplingRate);
|
||||||
}
|
this->iirFilter.Reset();
|
||||||
if (this->spectrumExtend != nullptr) {
|
|
||||||
this->spectrumExtend->SetSamplingRate(this->samplingRate);
|
this->colorfulMusic.SetSamplingRate(this->samplingRate);
|
||||||
this->spectrumExtend->Reset();
|
this->colorfulMusic.Reset();
|
||||||
}
|
|
||||||
if (this->iirFilter != nullptr) {
|
this->reverberation.Reset();
|
||||||
this->iirFilter->SetSamplingRate(this->samplingRate);
|
|
||||||
this->iirFilter->Reset();
|
this->playbackGain.SetSamplingRate(this->samplingRate);
|
||||||
}
|
this->playbackGain.Reset();
|
||||||
if (this->colorfulMusic != nullptr) {
|
|
||||||
this->colorfulMusic->SetSamplingRate(this->samplingRate);
|
this->fetCompressor.SetSamplingRate(this->samplingRate);
|
||||||
this->colorfulMusic->Reset();
|
this->fetCompressor.Reset();
|
||||||
}
|
|
||||||
if (this->reverberation != nullptr) {
|
this->dynamicSystem.SetSamplingRate(this->samplingRate);
|
||||||
this->reverberation->Reset();
|
this->dynamicSystem.Reset();
|
||||||
}
|
|
||||||
if (this->playbackGain != nullptr) {
|
this->viperBass.SetSamplingRate(this->samplingRate);
|
||||||
this->playbackGain->SetSamplingRate(this->samplingRate);
|
this->viperBass.Reset();
|
||||||
this->playbackGain->Reset();
|
|
||||||
}
|
this->viperClarity.SetSamplingRate(this->samplingRate);
|
||||||
if (this->fetCompressor != nullptr) {
|
this->viperClarity.Reset();
|
||||||
this->fetCompressor->SetSamplingRate(this->samplingRate);
|
|
||||||
this->fetCompressor->Reset();
|
this->diffSurround.SetSamplingRate(this->samplingRate);
|
||||||
}
|
this->diffSurround.Reset();
|
||||||
if (this->dynamicSystem != nullptr) {
|
|
||||||
this->dynamicSystem->SetSamplingRate(this->samplingRate);
|
this->cure.SetSamplingRate(this->samplingRate);
|
||||||
this->dynamicSystem->Reset();
|
this->cure.Reset();
|
||||||
}
|
|
||||||
if (this->viperBass != nullptr) {
|
this->tubeSimulator.Reset();
|
||||||
this->viperBass->SetSamplingRate(this->samplingRate);
|
|
||||||
this->viperBass->Reset();
|
this->analogX.SetSamplingRate(this->samplingRate);
|
||||||
}
|
this->analogX.Reset();
|
||||||
if (this->viperClarity != nullptr) {
|
|
||||||
this->viperClarity->SetSamplingRate(this->samplingRate);
|
this->speakerCorrection.SetSamplingRate(this->samplingRate);
|
||||||
this->viperClarity->Reset();
|
this->speakerCorrection.Reset();
|
||||||
}
|
|
||||||
if (this->diffSurround != nullptr) {
|
|
||||||
this->diffSurround->SetSamplingRate(this->samplingRate);
|
|
||||||
this->diffSurround->Reset();
|
|
||||||
}
|
|
||||||
if (this->cure != nullptr) {
|
|
||||||
this->cure->SetSamplingRate(this->samplingRate);
|
|
||||||
this->cure->Reset();
|
|
||||||
}
|
|
||||||
if (this->tubeSimulator != nullptr) {
|
|
||||||
this->tubeSimulator->Reset();
|
|
||||||
}
|
|
||||||
if (this->analogX != nullptr) {
|
|
||||||
this->analogX->SetSamplingRate(this->samplingRate);
|
|
||||||
this->analogX->Reset();
|
|
||||||
}
|
|
||||||
if (this->speakerCorrection != nullptr) {
|
|
||||||
this->speakerCorrection->SetSamplingRate(this->samplingRate);
|
|
||||||
this->speakerCorrection->Reset();
|
|
||||||
}
|
|
||||||
for (auto &softwareLimiter: softwareLimiters) {
|
for (auto &softwareLimiter: softwareLimiters) {
|
||||||
if (softwareLimiter != nullptr) {
|
softwareLimiter.Reset();
|
||||||
softwareLimiter->Reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
#include "effects/SoftwareLimiter.h"
|
#include "effects/SoftwareLimiter.h"
|
||||||
#include "effects/PlaybackGain.h"
|
#include "effects/PlaybackGain.h"
|
||||||
#include "../ViPER4Android.h"
|
#include "../ViPER4Android.h"
|
||||||
|
#include <array>
|
||||||
|
|
||||||
class ViPER {
|
class ViPER {
|
||||||
public:
|
public:
|
||||||
ViPER();
|
ViPER();
|
||||||
~ViPER();
|
|
||||||
|
|
||||||
void process(std::vector<float>& buffer, uint32_t size);
|
void process(std::vector<float>& buffer, uint32_t size);
|
||||||
// TODO: Parameter types/names
|
// TODO: Parameter types/names
|
||||||
@ -38,26 +38,26 @@ public:
|
|||||||
uint32_t samplingRate;
|
uint32_t samplingRate;
|
||||||
|
|
||||||
// Effects
|
// Effects
|
||||||
AdaptiveBuffer *adaptiveBuffer;
|
AdaptiveBuffer adaptiveBuffer;
|
||||||
WaveBuffer *waveBuffer;
|
WaveBuffer waveBuffer;
|
||||||
Convolver *convolver;
|
Convolver convolver;
|
||||||
VHE *vhe;
|
VHE vhe;
|
||||||
ViPERDDC *viperDdc;
|
ViPERDDC viperDdc;
|
||||||
SpectrumExtend *spectrumExtend;
|
SpectrumExtend spectrumExtend;
|
||||||
IIRFilter *iirFilter;
|
IIRFilter iirFilter;
|
||||||
ColorfulMusic *colorfulMusic;
|
ColorfulMusic colorfulMusic;
|
||||||
Reverberation *reverberation;
|
Reverberation reverberation;
|
||||||
PlaybackGain *playbackGain;
|
PlaybackGain playbackGain;
|
||||||
FETCompressor *fetCompressor;
|
FETCompressor fetCompressor;
|
||||||
DynamicSystem *dynamicSystem;
|
DynamicSystem dynamicSystem;
|
||||||
ViPERBass *viperBass;
|
ViPERBass viperBass;
|
||||||
ViPERClarity *viperClarity;
|
ViPERClarity viperClarity;
|
||||||
DiffSurround *diffSurround;
|
DiffSurround diffSurround;
|
||||||
Cure *cure;
|
Cure cure;
|
||||||
TubeSimulator *tubeSimulator;
|
TubeSimulator tubeSimulator;
|
||||||
AnalogX *analogX;
|
AnalogX analogX;
|
||||||
SpeakerCorrection *speakerCorrection;
|
SpeakerCorrection speakerCorrection;
|
||||||
SoftwareLimiter *softwareLimiters[2];
|
std::array<SoftwareLimiter, 2> softwareLimiters;
|
||||||
|
|
||||||
float frameScale;
|
float frameScale;
|
||||||
float leftPan;
|
float leftPan;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user