diff --git a/CMakeLists.txt b/CMakeLists.txt index 21cd3ec..b11924f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,15 +24,23 @@ set(FILES # Effects src/cpp/viper/effects/AnalogX.cpp + src/cpp/viper/effects/ColorfulMusic.cpp + src/cpp/viper/effects/Convolver.cpp src/cpp/viper/effects/Cure.cpp src/cpp/viper/effects/DiffSurround.cpp src/cpp/viper/effects/DynamicSystem.cpp + src/cpp/viper/effects/FETCompressor.cpp + src/cpp/viper/effects/IIRFilter.cpp + src/cpp/viper/effects/PlaybackGain.cpp src/cpp/viper/effects/Reverberation.cpp + src/cpp/viper/effects/SoftwareLimiter.cpp src/cpp/viper/effects/SpeakerCorrection.cpp src/cpp/viper/effects/SpectrumExtend.cpp src/cpp/viper/effects/TubeSimulator.cpp src/cpp/viper/effects/VHE.cpp + src/cpp/viper/effects/ViPERBass.cpp src/cpp/viper/effects/ViPERClarity.cpp + src/cpp/viper/effects/ViPERDDC.cpp # Utils src/cpp/viper/utils/AdaptiveBuffer_F32.cpp diff --git a/src/cpp/ViPER4Android.h b/src/cpp/ViPER4Android.h index b1a46d5..a34a0be 100644 --- a/src/cpp/ViPER4Android.h +++ b/src/cpp/ViPER4Android.h @@ -155,13 +155,4 @@ enum ParamsConfigure { PARAM_PROCESSUNIT_FX_END }; -enum FxMode { - ViPER_FX_TYPE_NONE = 0, - - ViPER_FX_TYPE_HEADPHONE = 1, - ViPER_FX_TYPE_SPEAKER = 2, - - ViPER_FX_TYPE_COUNT -}; - } diff --git a/src/cpp/viper/Effect.cpp b/src/cpp/viper/Effect.cpp index 3594c4c..79fcc0c 100644 --- a/src/cpp/viper/Effect.cpp +++ b/src/cpp/viper/Effect.cpp @@ -61,9 +61,6 @@ int32_t Effect::command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint return 0; } -#define DO_ERROR() this->configureOk = false;\ -return -EINVAL - int32_t Effect::configure(effect_config_t *newConfig) { VIPER_LOGI("Begin audio configure ..."); VIPER_LOGI("Checking input and output configuration ..."); @@ -71,23 +68,23 @@ int32_t Effect::configure(effect_config_t *newConfig) { if (newConfig->inputCfg.samplingRate != newConfig->outputCfg.samplingRate) { VIPER_LOGE("ViPER4Android disabled, reason [in.SR = %d, out.SR = %d]", newConfig->inputCfg.samplingRate, newConfig->outputCfg.samplingRate); - DO_ERROR(); + goto exit_error; } if (newConfig->inputCfg.samplingRate > 48000) { VIPER_LOGE("ViPER4Android disabled, reason [SR out of range]"); - DO_ERROR(); + goto exit_error; } if (newConfig->inputCfg.channels != newConfig->outputCfg.channels) { VIPER_LOGE("ViPER4Android disabled, reason [in.CH = %d, out.CH = %d]", newConfig->inputCfg.channels, newConfig->outputCfg.channels); - DO_ERROR(); + goto exit_error; } if (newConfig->inputCfg.channels != AUDIO_CHANNEL_OUT_STEREO) { VIPER_LOGE("ViPER4Android disabled, reason [CH != 2]"); - DO_ERROR(); + goto exit_error; } // TODO: Allow multiple formats by converting before/after processing @@ -95,13 +92,13 @@ int32_t Effect::configure(effect_config_t *newConfig) { if (newConfig->inputCfg.format != AUDIO_FORMAT_PCM_FLOAT) { VIPER_LOGE("ViPER4Android disabled, reason [in.FMT = %d]", newConfig->inputCfg.format); VIPER_LOGE("We only accept f32 format"); - DO_ERROR(); + goto exit_error; } if (newConfig->outputCfg.format != AUDIO_FORMAT_PCM_FLOAT) { VIPER_LOGE("ViPER4Android disabled, reason [out.FMT = %d]", newConfig->outputCfg.format); VIPER_LOGE("We only accept f32 format"); - DO_ERROR(); + goto exit_error; } VIPER_LOGI("Input and output configuration checked."); @@ -112,5 +109,9 @@ int32_t Effect::configure(effect_config_t *newConfig) { VIPER_LOGI("Audio configure finished"); return 0; + +exit_error: + this->configureOk = false; + return -EINVAL; } diff --git a/src/cpp/viper/ViPER.cpp b/src/cpp/viper/ViPER.cpp index 0de5cf6..35acf9e 100644 --- a/src/cpp/viper/ViPER.cpp +++ b/src/cpp/viper/ViPER.cpp @@ -1,9 +1,5 @@ -// -// Created by mart on 7/25/21. -// - -#include #include "ViPER.h" +#include #include "Effect.h" #include "constants.h" @@ -15,9 +11,9 @@ ViPER::ViPER() { this->waveBuffer = new WaveBuffer_I32(2, 4096); this->convolver = new Convolver(); -// this->convolver->SetEnable(false); -// this->convolver->SetSamplingRate(this->sampleRate); -// this->convolver->Reset(); + this->convolver->SetEnable(false); + this->convolver->SetSamplingRate(this->sampleRate); + this->convolver->Reset(); this->vhe = new VHE(); this->vhe->SetEnable(false); @@ -25,9 +21,9 @@ ViPER::ViPER() { this->vhe->Reset(); this->viperDdc = new ViPERDDC(); -// this->viperDdc->SetEnable(false); -// this->viperDdc->SetSamplingRate(this->sampleRate); -// this->viperDdc->Reset(); + this->viperDdc->SetEnable(false); + this->viperDdc->SetSamplingRate(this->sampleRate); + this->viperDdc->Reset(); this->spectrumExtend = new SpectrumExtend(); this->spectrumExtend->SetEnable(false); @@ -37,14 +33,14 @@ ViPER::ViPER() { this->spectrumExtend->Reset(); this->iirFilter = new IIRFilter(); -// this->iirFilter->SetEnable(false); -// this->iirFilter->SetSamplingRate(this->sampleRate); -// this->iirFilter->Reset(); + this->iirFilter->SetEnable(false); + this->iirFilter->SetSamplingRate(this->sampleRate); + this->iirFilter->Reset(); this->colorfulMusic = new ColorfulMusic(); -// this->colorfulMusic->SetEnable(false); -// this->colorfulMusic->SetSamplingRate(this->sampleRate); -// this->colorfulMusic->Reset(); + this->colorfulMusic->SetEnable(false); + this->colorfulMusic->SetSamplingRate(this->sampleRate); + this->colorfulMusic->Reset(); this->reverberation = new Reverberation(); this->reverberation->SetEnable(false); @@ -52,14 +48,14 @@ ViPER::ViPER() { this->reverberation->Reset(); this->playbackGain = new PlaybackGain(); -// this->playbackGain->SetEnable(false); -// this->playbackGain->SetSamplingRate(this->sampleRate); -// this->playbackGain->Reset(); + this->playbackGain->SetEnable(false); + this->playbackGain->SetSamplingRate(this->sampleRate); + this->playbackGain->Reset(); this->fetCompressor = new FETCompressor(); -// this->fetCompressor->SetEnable(false); -// this->fetCompressor->SetSamplingRate(this->sampleRate); -// this->fetCompressor->Reset(); + this->fetCompressor->SetParameter(0, 0.0); + this->fetCompressor->SetSamplingRate(this->sampleRate); + this->fetCompressor->Reset(); this->dynamicSystem = new DynamicSystem(); this->dynamicSystem->SetEnable(false); @@ -67,9 +63,9 @@ ViPER::ViPER() { this->dynamicSystem->Reset(); this->viperBass = new ViPERBass(); -// this->viperBass->SetEnable(false); -// this->viperBass->SetSamplingRate(this->sampleRate); -// this->viperBass->Reset(); + this->viperBass->SetEnable(false); + this->viperBass->SetSamplingRate(this->sampleRate); + this->viperBass->Reset(); this->viperClarity = new ViPERClarity(); this->viperClarity->SetEnable(false); @@ -87,12 +83,11 @@ ViPER::ViPER() { this->cure->Reset(); this->tubeSimulator = new TubeSimulator(); -// this->tubeSimulator->SetEnable(false); -// this->tubeSimulator->SetSamplingRate(this->sampleRate); + this->tubeSimulator->enabled = false; //SetEnable(false); this->tubeSimulator->Reset(); this->analogX = new AnalogX(); -// this->analogX->SetEnable(false); + this->analogX->enabled = false; //SetEnable(false); this->analogX->SetSamplingRate(this->sampleRate); this->analogX->SetProcessingModel(0); this->analogX->Reset(); @@ -104,14 +99,18 @@ ViPER::ViPER() { for (auto &softwareLimiter: this->softwareLimiters) { softwareLimiter = new SoftwareLimiter(); -// softwareLimiter->ResetLimiter(); + softwareLimiter->ResetLimiter(); } + this->fetcomp_enabled = false; this->init_ok = true; - + this->scale_frames_if_not_1point0 = 1.0; + this->pan_frames_if_less_than_1point0 = 1.0; + this->process_time_ms = 0; + this->pan_frames_if_less_than_1point0_2 = 1.0; this->enabled = false; this->force_enabled = false; - this->mode = ViPER_FX_TYPE_NONE; // 0 + this->update_status = false; } ViPER::~ViPER() { @@ -277,7 +276,7 @@ ViPER::command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *rep pReplyParam->status = 0; //pReplyParam->psize = sizeof(int32_t); // TODO pReplyParam->vsize = sizeof(int32_t); - *(int32_t *) pReplyParam->data = this->mode; + *(int32_t *) pReplyParam->data = 1; //this->mode; TODO: This driver is not using any effect type, it's completely controlled by the frontend *replySize = 0x14; // As original, TODO: calculate correctly return 0; } @@ -301,7 +300,7 @@ ViPER::command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *rep pReplyParam->status = 0; //pReplyParam->psize = sizeof(int32_t); // TODO pReplyParam->vsize = sizeof(int32_t); -// *(int32_t *) pReplyParam->data = this->convolver->GetKernelID(); // TODO: Uncomment when function is implemented + *(uint32_t *) pReplyParam->data = this->convolver->GetKernelID(); *replySize = 0x14; // As original, TODO: calculate correctly return 0; } @@ -313,7 +312,71 @@ ViPER::command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *rep } void ViPER::processBuffer(float *buffer, int frameSize) { - // TODO + if (!this->enabled) return; + if (frameSize < 1) return; + if (!this->init_ok) return; + + if (this->update_status) { + struct timeval time{}; + gettimeofday(&time, nullptr); + this->process_time_ms = time.tv_sec * 1000 + time.tv_usec / 1000; + } + + int ret; + + // if convolver is enabled + ret = this->waveBuffer->PushSamples(buffer, frameSize); + if (ret == 0) { + this->waveBuffer->Reset(); + return; + } + + auto pWaveBuffer = this->waveBuffer->GetCurrentBufferI32Ptr(); + this->convolver->Process(pWaveBuffer, pWaveBuffer, frameSize); + this->vhe->Process(pWaveBuffer, pWaveBuffer, frameSize); + this->waveBuffer->SetBufferOffset(frameSize); + + ret = this->adaptiveBuffer->PushZero(frameSize); + if (ret == 0) { + this->waveBuffer->Reset(); + this->adaptiveBuffer->FlushBuffer(); + return; + } + + auto pAdaptiveBuffer = this->adaptiveBuffer->GetBufferPointer(); + ret = this->waveBuffer->PopSamples((float *) pAdaptiveBuffer, frameSize, true); + this->adaptiveBuffer->SetBufferOffset(ret); + + pAdaptiveBuffer = this->adaptiveBuffer->GetBufferPointer(); + if (ret != 0) { + this->viperDdc->Process(pAdaptiveBuffer, frameSize); + this->spectrumExtend->Process(pAdaptiveBuffer, frameSize); + this->iirFilter->Process(pAdaptiveBuffer, ret); + this->colorfulMusic->Process(pAdaptiveBuffer, ret); + this->diffSurround->Process(pAdaptiveBuffer, ret); + this->reverberation->Process(pAdaptiveBuffer, ret); + this->speakerCorrection->Process(pAdaptiveBuffer, ret); + this->playbackGain->Process(pAdaptiveBuffer, ret); + this->fetCompressor->Process(pAdaptiveBuffer, ret); + this->dynamicSystem->Process(pAdaptiveBuffer, ret); + this->viperBass->Process(pAdaptiveBuffer, ret); + this->viperClarity->Process(pAdaptiveBuffer, ret); + this->cure->Process(pAdaptiveBuffer, ret); + this->tubeSimulator->TubeProcess(pAdaptiveBuffer, frameSize); + this->analogX->Process(pAdaptiveBuffer, ret); + } + + if (this->scale_frames_if_not_1point0 != 1.0) { + this->adaptiveBuffer->ScaleFrames(this->scale_frames_if_not_1point0); + } + if (this->pan_frames_if_less_than_1point0 < 1.0 || this->pan_frames_if_less_than_1point0_2 < 1.0) { + this->adaptiveBuffer->PanFrames(this->pan_frames_if_less_than_1point0, this->pan_frames_if_less_than_1point0_2); + } + + if (ret << 1 != 0) { + + } + } void ViPER::DispatchCommand(int param_1, int param_2, int param_3, int param_4, int param_5, int param_6, @@ -323,54 +386,54 @@ void ViPER::DispatchCommand(int param_1, int param_2, int param_3, int param_4, void ViPER::ResetAllEffects() { if (this->adaptiveBuffer != nullptr) { -// this->adaptiveBuffer->FlushBuffer(); + this->adaptiveBuffer->FlushBuffer(); } if (this->waveBuffer != nullptr) { this->waveBuffer->Reset(); } if (this->convolver != nullptr) { -// this->convolver->SetSamplingRate(this->sampleRate); -// this->convolver->Reset(); + this->convolver->SetSamplingRate(this->sampleRate); + this->convolver->Reset(); } if (this->vhe != nullptr) { this->vhe->SetSamplingRate(this->sampleRate); this->vhe->Reset(); } if (this->viperDdc != nullptr) { -// this->viperDdc->SetSamplingRate(this->sampleRate); -// this->viperDdc->Reset(); + this->viperDdc->SetSamplingRate(this->sampleRate); + this->viperDdc->Reset(); } if (this->spectrumExtend != nullptr) { this->spectrumExtend->SetSamplingRate(this->sampleRate); this->spectrumExtend->Reset(); } if (this->iirFilter != nullptr) { -// this->iirFilter->SetSamplingRate(this->sampleRate); -// this->iirFilter->Reset(); + this->iirFilter->SetSamplingRate(this->sampleRate); + this->iirFilter->Reset(); } if (this->colorfulMusic != nullptr) { -// this->colorfulMusic->SetSamplingRate(this->sampleRate); -// this->colorfulMusic->Reset(); + this->colorfulMusic->SetSamplingRate(this->sampleRate); + this->colorfulMusic->Reset(); } if (this->reverberation != nullptr) { this->reverberation->SetSamplingRate(this->sampleRate); this->reverberation->Reset(); } if (this->playbackGain != nullptr) { -// this->playbackGain->SetSamplingRate(this->sampleRate); -// this->playbackGain->Reset(); + this->playbackGain->SetSamplingRate(this->sampleRate); + this->playbackGain->Reset(); } if (this->fetCompressor != nullptr) { -// this->fetCompressor->SetSamplingRate(this->sampleRate); -// this->fetCompressor->Reset(); + this->fetCompressor->SetSamplingRate(this->sampleRate); + this->fetCompressor->Reset(); } if (this->dynamicSystem != nullptr) { this->dynamicSystem->SetSamplingRate(this->sampleRate); this->dynamicSystem->Reset(); } if (this->viperBass != nullptr) { -// this->viperBass->SetSamplingRate(this->sampleRate); -// this->viperBass->Reset(); + this->viperBass->SetSamplingRate(this->sampleRate); + this->viperBass->Reset(); } if (this->viperClarity != nullptr) { this->viperClarity->SetSamplingRate(this->sampleRate); @@ -385,7 +448,7 @@ void ViPER::ResetAllEffects() { this->cure->Reset(); } if (this->tubeSimulator != nullptr) { -// this->tubeSimulator->Reset(); + this->tubeSimulator->Reset(); } if (this->analogX != nullptr) { this->analogX->SetSamplingRate(this->sampleRate); @@ -397,7 +460,7 @@ void ViPER::ResetAllEffects() { } for (auto &softwareLimiter: softwareLimiters) { if (softwareLimiter != nullptr) { -// softwareLimiter->Reset(); + softwareLimiter->ResetLimiter(); } } } diff --git a/src/cpp/viper/ViPER.h b/src/cpp/viper/ViPER.h index b7f78a8..6e1d061 100644 --- a/src/cpp/viper/ViPER.h +++ b/src/cpp/viper/ViPER.h @@ -41,12 +41,19 @@ public: void ResetAllEffects(); - bool init_ok, enabled, force_enabled, fetcomp_enabled; - FxMode mode; + bool update_status; + // Something or padding of 3 bytes + uint64_t process_time_ms; + bool init_ok; + bool enabled; + bool force_enabled; + // Something or padding of 1 byte + // FxMode mode; // Effects AdaptiveBuffer_F32 *adaptiveBuffer; WaveBuffer_I32 *waveBuffer; + bool fetcomp_enabled; Convolver *convolver; VHE *vhe; ViPERDDC *viperDdc; @@ -66,5 +73,7 @@ public: SpeakerCorrection *speakerCorrection; SoftwareLimiter *softwareLimiters[2]; - int unk[3]; + float scale_frames_if_not_1point0; + float pan_frames_if_less_than_1point0; + float pan_frames_if_less_than_1point0_2; }; diff --git a/src/cpp/viper/effects/AnalogX.cpp b/src/cpp/viper/effects/AnalogX.cpp index dda9888..ed7a488 100644 --- a/src/cpp/viper/effects/AnalogX.cpp +++ b/src/cpp/viper/effects/AnalogX.cpp @@ -1,9 +1,5 @@ -// -// Created by mart on 7/30/21. -// - -#include #include "AnalogX.h" +#include #include "../constants.h" static float ANALOGX_HARMONICS[10] = { @@ -26,6 +22,10 @@ AnalogX::AnalogX() { Reset(); } +AnalogX::~AnalogX() { + +} + void AnalogX::Process(float *samples, uint32_t size) { for (int i = 0; i < 2 * size; i++) { float sample = samples[i]; diff --git a/src/cpp/viper/effects/AnalogX.h b/src/cpp/viper/effects/AnalogX.h index f460595..1abd88a 100644 --- a/src/cpp/viper/effects/AnalogX.h +++ b/src/cpp/viper/effects/AnalogX.h @@ -1,23 +1,17 @@ -// -// Created by mart on 7/30/21. -// - #pragma once - +#include #include "../utils/Harmonic.h" #include "../utils/MultiBiquad.h" class AnalogX { public: AnalogX(); + ~AnalogX(); void Process(float *samples, uint32_t size); - void Reset(); - void SetProcessingModel(int model); - void SetSamplingRate(uint32_t samplerate); MultiBiquad highpass[2]; diff --git a/src/cpp/viper/effects/ColorfulMusic.cpp b/src/cpp/viper/effects/ColorfulMusic.cpp new file mode 100644 index 0000000..e7d122c --- /dev/null +++ b/src/cpp/viper/effects/ColorfulMusic.cpp @@ -0,0 +1 @@ +#include "ColorfulMusic.h" diff --git a/src/cpp/viper/effects/ColorfulMusic.h b/src/cpp/viper/effects/ColorfulMusic.h index c631545..156be50 100644 --- a/src/cpp/viper/effects/ColorfulMusic.h +++ b/src/cpp/viper/effects/ColorfulMusic.h @@ -1,7 +1,19 @@ #pragma once +#include + class ColorfulMusic { - // TODO +public: + ColorfulMusic(); + ~ColorfulMusic(); + + void Process(float *samples, uint32_t size); + void Reset(); + void SetDepthValue(); + void SetEnable(bool enable); + void SetMidImageValue(); + void SetSamplingRate(uint32_t samplingRate); + void SetWidenValue(); }; diff --git a/src/cpp/viper/effects/Convolver.cpp b/src/cpp/viper/effects/Convolver.cpp new file mode 100644 index 0000000..2180af0 --- /dev/null +++ b/src/cpp/viper/effects/Convolver.cpp @@ -0,0 +1,63 @@ +#include "Convolver.h" + +Convolver::Convolver() { + +} + +Convolver::~Convolver() { + +} + +void Convolver::CommitKernelBuffer(uint32_t param_1, uint32_t param_2, uint32_t kernelId) { + +} + +bool Convolver::GetEnabled() { + return false; +} + +uint32_t Convolver::GetKernelID() { + return 0; +} + +void Convolver::PrepareKernelBuffer(uint32_t param_1, uint32_t param_2, int32_t kernelId) { + +} + +void Convolver::Process(float *source, float *dest, int32_t frameSize) { + +} + +void Convolver::Reset() { + +} + +void Convolver::SetCrossChannel(float param_1) { + +} + +void Convolver::SetEnable(bool enabled) { + +} + +void Convolver::SetKernel(float *param_1, uint32_t param_2) { + +} + +void Convolver::SetKernel(const char *param_1) { + +} + +void Convolver::SetKernelBuffer(uint32_t param_1, float *param_2, uint32_t param_3) { + +} + +void Convolver::SetKernelStereo(float *param_1, float *param_2, uint32_t param_3) { + +} + +void Convolver::SetSamplingRate(uint32_t param_1) { + +} + + diff --git a/src/cpp/viper/effects/Convolver.h b/src/cpp/viper/effects/Convolver.h index 52f6e00..81ca763 100644 --- a/src/cpp/viper/effects/Convolver.h +++ b/src/cpp/viper/effects/Convolver.h @@ -1,7 +1,25 @@ #pragma once +#include + class Convolver { - // TODO +public: + Convolver(); + ~Convolver(); + + void CommitKernelBuffer(uint32_t param_1, uint32_t param_2, uint32_t kernelId); + bool GetEnabled(); + uint32_t GetKernelID(); + void PrepareKernelBuffer(uint32_t param_1, uint32_t param_2, int32_t kernelId); + void Process(float *source, float *dest, int32_t frameSize); + void Reset(); + void SetCrossChannel(float param_1); + void SetEnable(bool enabled); + void SetKernel(float *param_1, uint32_t param_2); + void SetKernel(const char *param_1); + void SetKernelBuffer(uint32_t param_1, float *param_2, uint32_t param_3); + void SetKernelStereo(float *param_1, float *param_2, uint32_t param_3); + void SetSamplingRate(uint32_t param_1); }; diff --git a/src/cpp/viper/effects/Cure.h b/src/cpp/viper/effects/Cure.h index 101cacf..77846a2 100644 --- a/src/cpp/viper/effects/Cure.h +++ b/src/cpp/viper/effects/Cure.h @@ -1,37 +1,24 @@ -// -// Created by mart on 7/26/21. -// - #pragma once - +#include #include "../utils/Crossfeed.h" #include "../utils/PassFilter.h" class Cure { public: Cure(); + ~Cure(); void Process(float *buffer, uint32_t size); - void Reset(); - void SetEnable(bool enabled); - uint16_t GetCutoff(); - float GetFeedback(); - float GetLevelDelay(); - preset_t GetPreset(); - void SetCutoff(uint16_t cutoff); - void SetFeedback(float feedback); - void SetPreset(preset_t preset); - void SetSamplingRate(uint32_t samplerate); Crossfeed crossfeed; diff --git a/src/cpp/viper/effects/DiffSurround.h b/src/cpp/viper/effects/DiffSurround.h index 03956e8..1a4c888 100644 --- a/src/cpp/viper/effects/DiffSurround.h +++ b/src/cpp/viper/effects/DiffSurround.h @@ -1,27 +1,17 @@ -// -// Created by mart on 7/31/21. -// - #pragma once - #include #include "../utils/WaveBuffer_I32.h" class DiffSurround { public: DiffSurround(); - ~DiffSurround(); void Process(float *samples, uint32_t size); - void Reset(); - void SetDelayTime(float value); - void SetEnable(bool enabled); - void SetSamplingRate(uint32_t samplerate); uint32_t samplerate; diff --git a/src/cpp/viper/effects/DynamicSystem.h b/src/cpp/viper/effects/DynamicSystem.h index 2bedf5c..1887eb3 100644 --- a/src/cpp/viper/effects/DynamicSystem.h +++ b/src/cpp/viper/effects/DynamicSystem.h @@ -1,7 +1,3 @@ -// -// Created by mart on 7/28/21. -// - #pragma once #include @@ -10,21 +6,15 @@ class DynamicSystem { public: DynamicSystem(); + ~DynamicSystem(); void Process(float *samples, uint32_t size); - void Reset(); - void SetBassGain(float gain); - void SetEnable(bool enable); - void SetSideGain(float gainX, float gainY); - void SetXCoeffs(uint32_t low, uint32_t high); - void SetYCoeffs(uint32_t low, uint32_t high); - void SetSamplingRate(uint32_t samplerate); DynamicBass bass; diff --git a/src/cpp/viper/effects/FETCompressor.cpp b/src/cpp/viper/effects/FETCompressor.cpp new file mode 100644 index 0000000..09d09a5 --- /dev/null +++ b/src/cpp/viper/effects/FETCompressor.cpp @@ -0,0 +1 @@ +#include "FETCompressor.h.h" diff --git a/src/cpp/viper/effects/FETCompressor.h b/src/cpp/viper/effects/FETCompressor.h index f215ecd..7232fab 100644 --- a/src/cpp/viper/effects/FETCompressor.h +++ b/src/cpp/viper/effects/FETCompressor.h @@ -1,7 +1,20 @@ #pragma once +#include + class FETCompressor { - // TODO +public: + FETCompressor(); + ~FETCompressor(); + + void GetMeter(); + void GetParameter(); + void GetParamterDefault(); + void Process(); + void ProcessSidechain(); + void Reset(); + void SetParameter(int32_t param_1, float param_2); + void SetSamplingRate(uint32_t samplingRate); }; diff --git a/src/cpp/viper/effects/IIRFilter.cpp b/src/cpp/viper/effects/IIRFilter.cpp new file mode 100644 index 0000000..1ffc659 --- /dev/null +++ b/src/cpp/viper/effects/IIRFilter.cpp @@ -0,0 +1 @@ +#include "IIRFilter.h" diff --git a/src/cpp/viper/effects/IIRFilter.h b/src/cpp/viper/effects/IIRFilter.h index 1a46e42..c085e1d 100644 --- a/src/cpp/viper/effects/IIRFilter.h +++ b/src/cpp/viper/effects/IIRFilter.h @@ -1,7 +1,17 @@ #pragma once +#include + class IIRFilter { - // TODO +public: + IIRFilter(); + ~IIRFilter(); + + void Process(float *samples, uint32_t size); + void Reset(); + void SetBandLevel(); + void SetEnable(bool enable); + void SetSamplingRate(unsigned int i); }; diff --git a/src/cpp/viper/effects/PlaybackGain.cpp b/src/cpp/viper/effects/PlaybackGain.cpp new file mode 100644 index 0000000..e38e19e --- /dev/null +++ b/src/cpp/viper/effects/PlaybackGain.cpp @@ -0,0 +1 @@ +#include "PlaybackGain.h" diff --git a/src/cpp/viper/effects/PlaybackGain.h b/src/cpp/viper/effects/PlaybackGain.h index db1e4b7..d753fc9 100644 --- a/src/cpp/viper/effects/PlaybackGain.h +++ b/src/cpp/viper/effects/PlaybackGain.h @@ -1,7 +1,20 @@ #pragma once +#include + class PlaybackGain { - // TODO +public: + PlaybackGain(); + ~PlaybackGain(); + + void AnalyseWave(); + void Process(); + void Reset(); + void SetEnable(bool enable); + void SetMaxGainFactor(); + void SetRatio(); + void SetSamplingRate(uint32_t samplingRate); + void SetVolume(); }; diff --git a/src/cpp/viper/effects/Reverberation.h b/src/cpp/viper/effects/Reverberation.h index bd0d9cb..54aa02c 100644 --- a/src/cpp/viper/effects/Reverberation.h +++ b/src/cpp/viper/effects/Reverberation.h @@ -1,32 +1,22 @@ -// -// Created by mart on 7/28/21. -// - #pragma once +#include #include "../utils/CRevModel.h" class Reverberation { public: Reverberation(); - - void Reset(); + ~Reverberation(); void Process(float *buffer, uint32_t size); - - void SetEnable(bool enable); - - void SetRoomSize(float value); - + void Reset(); void SetDamp(float value); - - void SetWet(float value); - void SetDry(float value); - - void SetWidth(float value); - + void SetEnable(bool enable); + void SetRoomSize(float value); void SetSamplingRate(uint32_t value); + void SetWet(float value); + void SetWidth(float value); float roomsize; float width; diff --git a/src/cpp/viper/effects/SoftwareLimiter.cpp b/src/cpp/viper/effects/SoftwareLimiter.cpp new file mode 100644 index 0000000..1e33264 --- /dev/null +++ b/src/cpp/viper/effects/SoftwareLimiter.cpp @@ -0,0 +1 @@ +#include "SoftwareLimiter.h" diff --git a/src/cpp/viper/effects/SoftwareLimiter.h b/src/cpp/viper/effects/SoftwareLimiter.h index e610d8a..23bfc12 100644 --- a/src/cpp/viper/effects/SoftwareLimiter.h +++ b/src/cpp/viper/effects/SoftwareLimiter.h @@ -1,7 +1,15 @@ #pragma once +#include + class SoftwareLimiter { - // TODO +public: + SoftwareLimiter(); + ~SoftwareLimiter(); + + void Process(float *samples, uint32_t size); + void ResetLimiter(); + void SetGate(); }; diff --git a/src/cpp/viper/effects/SpeakerCorrection.h b/src/cpp/viper/effects/SpeakerCorrection.h index 801d142..dcc3c0c 100644 --- a/src/cpp/viper/effects/SpeakerCorrection.h +++ b/src/cpp/viper/effects/SpeakerCorrection.h @@ -1,22 +1,17 @@ -// -// Created by mart on 7/30/21. -// - #pragma once +#include #include "../utils/MultiBiquad.h" #include "../utils/FixedBiquad.h" class SpeakerCorrection { public: SpeakerCorrection(); + ~SpeakerCorrection(); void Process(float *samples, uint32_t size); - void Reset(); - void SetEnable(bool enabled); - void SetSamplingRate(uint32_t samplerate); uint32_t samplerate; diff --git a/src/cpp/viper/effects/SpectrumExtend.h b/src/cpp/viper/effects/SpectrumExtend.h index 3cb013d..797ae18 100644 --- a/src/cpp/viper/effects/SpectrumExtend.h +++ b/src/cpp/viper/effects/SpectrumExtend.h @@ -1,29 +1,19 @@ -// -// Created by mart on 7/30/21. -// - #pragma once - +#include #include "../utils/Harmonic.h" #include "../utils/MultiBiquad.h" class SpectrumExtend { public: SpectrumExtend(); - ~SpectrumExtend(); void Process(float *samples, uint32_t size); - void Reset(); - void SetEnable(bool enable); - void SetExciter(float value); - void SetReferenceFrequency(uint32_t freq); - void SetSamplingRate(uint32_t samplerate); MultiBiquad highpass[2]; diff --git a/src/cpp/viper/effects/TubeSimulator.h b/src/cpp/viper/effects/TubeSimulator.h index 489accf..0c14c24 100644 --- a/src/cpp/viper/effects/TubeSimulator.h +++ b/src/cpp/viper/effects/TubeSimulator.h @@ -1,7 +1,3 @@ -// -// Created by mart on 7/26/21. -// - #pragma once #include @@ -9,9 +5,9 @@ class TubeSimulator { public: TubeSimulator(); + ~TubeSimulator(); void Reset(); - void TubeProcess(float *buffer, uint32_t size); float acc[2]; diff --git a/src/cpp/viper/effects/VHE.h b/src/cpp/viper/effects/VHE.h index 678ba37..3901f53 100644 --- a/src/cpp/viper/effects/VHE.h +++ b/src/cpp/viper/effects/VHE.h @@ -1,29 +1,19 @@ -// -// Created by mart on 9/18/21. -// - #pragma once - +#include #include "../utils/PConvSingle_F32.h" #include "../utils/WaveBuffer_I32.h" class VHE { public: VHE(); - ~VHE(); - void Process(float *source, float *dest, int frameSize); - - void Reset(); - bool GetEnabled(); - + void Process(float *source, float *dest, int frameSize); + void Reset(); void SetEffectLevel(uint32_t level); - void SetEnable(bool enabled); - void SetSamplingRate(uint32_t srate); PConvSingle_F32 convLeft, convRight; diff --git a/src/cpp/viper/effects/ViPERBass.cpp b/src/cpp/viper/effects/ViPERBass.cpp new file mode 100644 index 0000000..9a8b3f1 --- /dev/null +++ b/src/cpp/viper/effects/ViPERBass.cpp @@ -0,0 +1 @@ +#include "ViPERBass.h" diff --git a/src/cpp/viper/effects/ViPERBass.h b/src/cpp/viper/effects/ViPERBass.h index 1b590ab..c71243f 100644 --- a/src/cpp/viper/effects/ViPERBass.h +++ b/src/cpp/viper/effects/ViPERBass.h @@ -1,7 +1,19 @@ #pragma once +#include + class ViPERBass { - // TODO +public: + ViPERBass(); + ~ViPERBass(); + + void Process(float *samples, uint32_t size); + void Reset(); + void SetBassFactor(); + void SetEnable(bool enable); + void SetProcessMode(); + void SetSamplingRate(uint32_t samplingRate); + void SetSpeaker(); }; diff --git a/src/cpp/viper/effects/ViPERClarity.h b/src/cpp/viper/effects/ViPERClarity.h index 6724571..fb207a2 100644 --- a/src/cpp/viper/effects/ViPERClarity.h +++ b/src/cpp/viper/effects/ViPERClarity.h @@ -1,10 +1,6 @@ -// -// Created by mart on 7/31/21. -// - #pragma once - +#include #include "../utils/NoiseSharpening.h" #include "../utils/HiFi.h" #include "../utils/HighShelf.h" @@ -18,19 +14,14 @@ enum ClarityMode { class ViPERClarity { public: ViPERClarity(); + ~ViPERClarity(); void Process(float *samples, uint32_t size); - void Reset(); - void SetClarity(float gainPercent); - void SetClarityToFilter(); - void SetEnable(bool enabled); - void SetProcessMode(ClarityMode mode); - void SetSamplingRate(uint32_t samplerate); NoiseSharpening sharp; diff --git a/src/cpp/viper/effects/ViPERDDC.cpp b/src/cpp/viper/effects/ViPERDDC.cpp new file mode 100644 index 0000000..7d4e664 --- /dev/null +++ b/src/cpp/viper/effects/ViPERDDC.cpp @@ -0,0 +1 @@ +#include "ViPERDDC.h" diff --git a/src/cpp/viper/effects/ViPERDDC.h b/src/cpp/viper/effects/ViPERDDC.h index 2f2a1cb..98edd5f 100644 --- a/src/cpp/viper/effects/ViPERDDC.h +++ b/src/cpp/viper/effects/ViPERDDC.h @@ -1,7 +1,18 @@ #pragma once +#include + class ViPERDDC { - // TODO +public: + ViPERDDC(); + ~ViPERDDC(); + + void Process(float *samples, uint32_t size); + void ReleaseResources(); + void Reset(); + void SetCoeffs(); + void SetEnable(bool enable); + void SetSamplingRate(uint32_t samplingRate); }; diff --git a/src/cpp/viper/utils/AdaptiveBuffer_F32.h b/src/cpp/viper/utils/AdaptiveBuffer_F32.h index 3b9c42a..e3eeaea 100644 --- a/src/cpp/viper/utils/AdaptiveBuffer_F32.h +++ b/src/cpp/viper/utils/AdaptiveBuffer_F32.h @@ -5,7 +5,20 @@ class AdaptiveBuffer_F32 { public: AdaptiveBuffer_F32(int channels, uint32_t size); - // TODO + ~AdaptiveBuffer_F32(); + + void FlushBuffer(); + uint32_t GetBufferLength(); + int32_t GetBufferOffset(); + int32_t *GetBufferPointer(); + uint32_t GetChannels(); + void PanFrames(int32_t param_1, int32_t param_2); + int32_t PopFrames(int16_t param_1, uint32_t param_2); + int32_t PushFrames(int16_t param_1, uint32_t param_2); + int32_t PushFrames(int32_t *param_1, uint32_t param_2); + int32_t PushZero(uint32_t param_1); + void ScaleFrames(int32_t param_1); + void SetBufferOffset(uint32_t param_1); };