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

View File

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

View File

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