named enums

This commit is contained in:
Martijn 2021-08-02 21:14:28 +02:00
parent 779c172aa8
commit 3db1c228a3
4 changed files with 56 additions and 17 deletions

View File

@ -4,6 +4,17 @@
#pragma once #pragma once
#include "Effect.h" #include "Effect.h"
#include "viper.h"
#include "utils/WaveBuffer_I32.h"
#include "effects/SpectrumExtend.h"
#include "effects/Reverberation.h"
#include "effects/DynamicSystem.h"
#include "effects/ViPERClarity.h"
#include "effects/SpeakerCorrection.h"
#include "effects/AnalogX.h"
#include "effects/TubeSimulator.h"
#include "effects/Cure.h"
#include "effects/DiffSurround.h"
class ProcessUnit_FX : public Effect { class ProcessUnit_FX : public Effect {
public: public:
@ -17,4 +28,30 @@ public:
// TODO: Parameter types/names // TODO: Parameter types/names
void DispatchCommand(int param_1, int param_2,int param_3, int param_4,int param_5, int param_6,int param_7); void DispatchCommand(int param_1, int param_2,int param_3, int param_4,int param_5, int param_6,int param_7);
void ResetAllEffects(); void ResetAllEffects();
bool init_ok, enabled, force_enabled, fetcomp_enabled;
FxMode mode;
// AdaptiveBuffer_F32* adaptiveBuffer;
WaveBuffer_I32* waveBuffer;
// Convolver* convolver;
// VHE* vhe;
// ViPERDDC* vddc;
SpectrumExtend* spectrumExtend;
// IIRFilter* iirfilter;
// ColorfulMusic* colm;
Reverberation* reverb;
// PlaybackGain* playbackGain;
// FETCompressor* fetcomp;
DynamicSystem* dynsys;
// ViPERBass* bass;
ViPERClarity* clarity;
DiffSurround* diffSurround;
Cure* cure;
TubeSimulator* tube;
AnalogX* analogx;
SpeakerCorrection* speakerCorrection;
// SoftwareLimiter* limiter[2];
int unk[3];
}; };

View File

@ -14,7 +14,7 @@ ViPERClarity::ViPERClarity() {
} }
this->enabled = false; this->enabled = false;
this->processMode = 0; this->processMode = ClarityMode::NATURAL;
this->clarityGainPercent = 0.f; this->clarityGainPercent = 0.f;
this->samplerate = DEFAULT_SAMPLERATE; this->samplerate = DEFAULT_SAMPLERATE;
Reset(); Reset();
@ -22,13 +22,14 @@ ViPERClarity::ViPERClarity() {
void ViPERClarity::Process(float *samples, uint32_t size) { void ViPERClarity::Process(float *samples, uint32_t size) {
if (this->enabled) { if (this->enabled) {
if (this->processMode == 0) { if (this->processMode == ClarityMode::NATURAL) {
this->sharp.Process(samples, size); this->sharp.Process(samples, size);
} else if (this->processMode == 1) { } else if (this->processMode == ClarityMode::OZONE) {
for (int i = 0; i < size * 2; i++) { for (int i = 0; i < size * 2; i++) {
samples[i] = this->hiShelf[i % 2].Process(samples[i]); samples[i] = this->hiShelf[i % 2].Process(samples[i]);
} }
} else { } else {
// ClarityMode::XHIFI
this->hifi.Process(samples, size); this->hifi.Process(samples, size);
} }
} }
@ -49,7 +50,7 @@ void ViPERClarity::Reset() {
void ViPERClarity::SetClarity(float gainPercent) { void ViPERClarity::SetClarity(float gainPercent) {
this->clarityGainPercent = gainPercent; this->clarityGainPercent = gainPercent;
if (this->processMode != 1) { if (this->processMode != ClarityMode::OZONE) {
SetClarityToFilter(); SetClarityToFilter();
} else { } else {
Reset(); Reset();
@ -70,7 +71,7 @@ void ViPERClarity::SetEnable(bool enabled) {
} }
} }
void ViPERClarity::SetProcessMode(int mode) { void ViPERClarity::SetProcessMode(ClarityMode mode) {
this->processMode = mode; this->processMode = mode;
Reset(); Reset();
} }

View File

@ -9,6 +9,12 @@
#include "../utils/HiFi.h" #include "../utils/HiFi.h"
#include "../utils/HighShelf.h" #include "../utils/HighShelf.h"
enum ClarityMode {
NATURAL,
OZONE,
XHIFI
};
class ViPERClarity { class ViPERClarity {
public: public:
ViPERClarity(); ViPERClarity();
@ -19,14 +25,14 @@ public:
void SetClarity(float gainPercent); void SetClarity(float gainPercent);
void SetClarityToFilter(); void SetClarityToFilter();
void SetEnable(bool enabled); void SetEnable(bool enabled);
void SetProcessMode(int mode); void SetProcessMode(ClarityMode mode);
void SetSamplingRate(uint32_t samplerate); void SetSamplingRate(uint32_t samplerate);
NoiseSharpening sharp; NoiseSharpening sharp;
HighShelf hiShelf[2]; HighShelf hiShelf[2];
HiFi hifi; HiFi hifi;
bool enabled; bool enabled;
int processMode; ClarityMode processMode;
uint32_t samplerate; uint32_t samplerate;
float clarityGainPercent; float clarityGainPercent;
}; };

View File

@ -7,14 +7,12 @@
// Source: https://github.com/vipersaudio/viperfx_core_binary/blob/master/viperfx_intf.h // Source: https://github.com/vipersaudio/viperfx_core_binary/blob/master/viperfx_intf.h
extern "C" { extern "C" {
enum enum ParamsMode {
{
COMMAND_CODE_GET = 0x01, COMMAND_CODE_GET = 0x01,
COMMAND_CODE_SET, COMMAND_CODE_SET,
}; };
enum enum ParamsGet {
{
PARAM_GET_STATUS_BEGIN = 0x08000, PARAM_GET_STATUS_BEGIN = 0x08000,
PARAM_GET_DRIVER_VERSION, PARAM_GET_DRIVER_VERSION,
PARAM_GET_NEONENABLED, PARAM_GET_NEONENABLED,
@ -26,8 +24,7 @@ extern "C" {
PARAM_GET_STATUS_END PARAM_GET_STATUS_END
}; };
enum enum ParamsSet {
{
PARAM_SET_STATUS_BEGIN = 0x09000, PARAM_SET_STATUS_BEGIN = 0x09000,
PARAM_SET_RESET_STATUS, PARAM_SET_RESET_STATUS,
PARAM_SET_SAMPLINGRATE, PARAM_SET_SAMPLINGRATE,
@ -35,8 +32,7 @@ extern "C" {
PARAM_SET_STATUS_END PARAM_SET_STATUS_END
}; };
enum enum ParamsConfigure {
{
PARAM_PROCESSUNIT_FX_BEGIN = 0x10000, PARAM_PROCESSUNIT_FX_BEGIN = 0x10000,
PARAM_FX_TYPE_SWITCH, PARAM_FX_TYPE_SWITCH,
@ -152,8 +148,7 @@ extern "C" {
PARAM_PROCESSUNIT_FX_END PARAM_PROCESSUNIT_FX_END
}; };
enum enum FxMode {
{
ViPER_FX_TYPE_NONE = 0, ViPER_FX_TYPE_NONE = 0,
ViPER_FX_TYPE_HEADPHONE = 1, ViPER_FX_TYPE_HEADPHONE = 1,