mirror of
https://github.com/AndroidAudioMods/ViPERFX_RE.git
synced 2025-06-08 02:29:40 +08:00
Update
This commit is contained in:
parent
5b99913a8f
commit
e2cee17b48
@ -221,13 +221,15 @@ static int32_t handleGetParam(ViperContext *pContext, effect_param_t *pCmdParam,
|
|||||||
static int32_t Viper_ICommand(effect_handle_t self,
|
static int32_t Viper_ICommand(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("Viper_ICommand(self = %p, cmdCode = %d, cmdSize = %d, pCmdData = %p, replySize = %p, pReplyData = %p)", self, cmdCode, cmdSize, pCmdData, replySize, pReplyData);
|
||||||
|
|
||||||
auto pContext = reinterpret_cast<ViperContext *>(self);
|
auto pContext = reinterpret_cast<ViperContext *>(self);
|
||||||
|
|
||||||
if (pContext == nullptr || pContext->viper == nullptr) {
|
if (pContext == nullptr || pContext->viper == nullptr || replySize == nullptr || pReplyData == nullptr) {
|
||||||
|
VIPER_LOGD("Viper_ICommand() called with null self or replySize or pReplyData");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIPER_LOGD("Viper_ICommand() called with cmdCode = %d", cmdCode);
|
|
||||||
switch (cmdCode) {
|
switch (cmdCode) {
|
||||||
case EFFECT_CMD_INIT:
|
case EFFECT_CMD_INIT:
|
||||||
*((int *) pReplyData) = 0;
|
*((int *) pReplyData) = 0;
|
||||||
@ -248,7 +250,7 @@ static int32_t Viper_ICommand(effect_handle_t self,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case EFFECT_CMD_DISABLE: {
|
case EFFECT_CMD_DISABLE: {
|
||||||
pContext->viper->enabled = false;
|
// pContext->viper->enabled = false;
|
||||||
*((int *) pReplyData) = 0;
|
*((int *) pReplyData) = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -293,11 +295,15 @@ static void Viper_Init(ViperContext *pContext) {
|
|||||||
|
|
||||||
static int32_t
|
static int32_t
|
||||||
Viper_Create(const effect_uuid_t *uuid, int32_t sessionId __unused, int32_t ioId __unused, effect_handle_t *pHandle) {
|
Viper_Create(const effect_uuid_t *uuid, int32_t sessionId __unused, int32_t ioId __unused, effect_handle_t *pHandle) {
|
||||||
|
VIPER_LOGD("Viper_Create(uuid = %p, sessionId = %d, ioId = %d, pHandle = %p)", uuid, sessionId, ioId, pHandle);
|
||||||
|
|
||||||
if (uuid == nullptr || pHandle == nullptr) {
|
if (uuid == nullptr || pHandle == nullptr) {
|
||||||
|
VIPER_LOGD("Viper_Create() called with null uuid or pHandle");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(uuid, &viper_descriptor.uuid, sizeof(effect_uuid_t)) != 0) {
|
if (memcmp(uuid, &viper_descriptor.uuid, sizeof(effect_uuid_t)) != 0) {
|
||||||
|
VIPER_LOGD("Viper_Create() called with wrong uuid");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,9 +316,12 @@ Viper_Create(const effect_uuid_t *uuid, int32_t sessionId __unused, int32_t ioId
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Viper_Release(effect_handle_t handle) {
|
static int32_t Viper_Release(effect_handle_t handle) {
|
||||||
|
VIPER_LOGD("Viper_Release(handle = %p)", handle);
|
||||||
|
|
||||||
auto pContext = reinterpret_cast<ViperContext *>(handle);
|
auto pContext = reinterpret_cast<ViperContext *>(handle);
|
||||||
|
|
||||||
if (pContext == nullptr) {
|
if (pContext == nullptr) {
|
||||||
|
VIPER_LOGD("Viper_Release() called with null handle");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,11 +333,15 @@ static int32_t Viper_Release(effect_handle_t handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Viper_GetDescriptor(const effect_uuid_t *uuid, effect_descriptor_t *pDescriptor) {
|
static int32_t Viper_GetDescriptor(const effect_uuid_t *uuid, effect_descriptor_t *pDescriptor) {
|
||||||
|
VIPER_LOGD("Viper_GetDescriptor(uuid = %p, pDescriptor = %p)", uuid, pDescriptor);
|
||||||
|
|
||||||
if (uuid == nullptr || pDescriptor == nullptr) {
|
if (uuid == nullptr || pDescriptor == nullptr) {
|
||||||
|
VIPER_LOGD("Viper_GetDescriptor() called with null uuid or pDescriptor");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(uuid, &viper_descriptor.uuid, sizeof(effect_uuid_t)) != 0) {
|
if (memcmp(uuid, &viper_descriptor.uuid, sizeof(effect_uuid_t)) != 0) {
|
||||||
|
VIPER_LOGD("Viper_GetDescriptor() called with wrong uuid");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,73 +20,90 @@ extern "C" {
|
|||||||
#define PARAM_SET_UPDATE_STATUS 0x9002
|
#define PARAM_SET_UPDATE_STATUS 0x9002
|
||||||
#define PARAM_SET_RESET_STATUS 0x9003
|
#define PARAM_SET_RESET_STATUS 0x9003
|
||||||
|
|
||||||
enum ParamsSet {
|
#define PARAM_CONVOLUTION_ENABLE 65538
|
||||||
PARAM_CONV_PROCESS_ENABLED = 0x10002, // 0x10002
|
#define PARAM_CONVOLUTION_PREPARE_BUFFER 65540
|
||||||
PARAM_CONV_UPDATEKERNEL, // 0x10003
|
#define PARAM_CONVOLUTION_SET_BUFFER 65541
|
||||||
PARAM_CONV_CROSSCHANNEL = 0x10007, // 0x10007
|
#define PARAM_CONVOLUTION_COMMIT_BUFFER 65542
|
||||||
PARAM_VHE_PROCESS_ENABLED, // 0x10008
|
#define PARAM_CONVOLUTION_CROSS_CHANNEL 65543
|
||||||
PARAM_VHE_EFFECT_LEVEL, // 0x10009
|
|
||||||
PARAM_VDDC_PROCESS_ENABLED, // 0x1000A
|
#define PARAM_HEADPHONE_SURROUND_ENABLE 65544
|
||||||
PARAM_VDDC_COEFFS, // 0x1000B
|
#define PARAM_HEADPHONE_SURROUND_STRENGTH 65545
|
||||||
PARAM_VSE_PROCESS_ENABLED, // 0x1000C
|
|
||||||
PARAM_VSE_REFERENCE_BARK, // 0x1000D
|
#define PARAM_DDC_ENABLE 65546
|
||||||
PARAM_VSE_BARK_RECONSTRUCT, // 0x1000E
|
#define PARAM_DDC_COEFFICIENTS 65547
|
||||||
PARAM_FIREQ_PROCESS_ENABLED, // 0x1000F
|
|
||||||
PARAM_FIREQ_BANDLEVEL, // 0x10010
|
#define PARAM_SPECTRUM_EXTENSION_ENABLE 65548
|
||||||
PARAM_COLM_PROCESS_ENABLED, // 0x10011
|
#define PARAM_SPECTRUM_EXTENSION_BARK 65549 // Bark is a scale like dB
|
||||||
PARAM_COLM_WIDENING, // 0x10012
|
#define PARAM_SPECTRUM_EXTENSION_BARK_RECONSTRUCT 65550
|
||||||
PARAM_COLM_MIDIMAGE, // 0x10013
|
|
||||||
PARAM_COLM_DEPTH, // 0x10014
|
#define PARAM_FIR_EQUALIZER_ENABLE 65551
|
||||||
PARAM_DIFFSURR_PROCESS_ENABLED, // 0x10015
|
#define PARAM_FIR_EQUALIZER_BAND_LEVEL 65552
|
||||||
PARAM_DIFFSURR_DELAYTIME, // 0x10016
|
|
||||||
PARAM_REVB_PROCESS_ENABLED, // 0x10017
|
#define PARAM_FIELD_SURROUND_ENABLE 65553
|
||||||
PARAM_REVB_ROOMSIZE, // 0x10018
|
#define PARAM_FIELD_SURROUND_WIDENING 65554
|
||||||
PARAM_REVB_WIDTH, // 0x10019
|
#define PARAM_FIELD_SURROUND_MID_IMAGE 65555
|
||||||
PARAM_REVB_DAMP, // 0x1001A
|
#define PARAM_FIELD_SURROUND_DEPTH 65556
|
||||||
PARAM_REVB_WET, // 0x1001B
|
|
||||||
PARAM_REVB_DRY, // 0x1001C
|
#define PARAM_DIFFERENTIAL_SURROUND_ENABLE 65557
|
||||||
PARAM_AGC_PROCESS_ENABLED, // 0x1001D
|
#define PARAM_DIFFERENTIAL_SURROUND_DELAY 65558
|
||||||
PARAM_AGC_RATIO, // 0x1001E
|
|
||||||
PARAM_AGC_VOLUME, // 0x1001F
|
#define PARAM_REVERBERATION_ENABLE 0x10017
|
||||||
PARAM_AGC_MAXSCALER, // 0x10020
|
#define PARAM_REVERBERATION_ROOM_SIZE 0x10018
|
||||||
PARAM_DYNSYS_PROCESS_ENABLED, // 0x10021
|
#define PARAM_REVERBERATION_ROOM_WIDTH 0x10019
|
||||||
PARAM_DYNSYS_XCOEFFS, // 0x10022
|
#define PARAM_REVERBERATION_ROOM_DAMPENING 0x1001A
|
||||||
PARAM_DYNSYS_YCOEFFS, // 0x10023
|
#define PARAM_REVERBERATION_ROOM_WET_SIGNAL 0x1001B
|
||||||
PARAM_DYNSYS_SIDEGAIN, // 0x10024
|
#define PARAM_REVERBERATION_ROOM_DRY_SIGNAL 0x1001C
|
||||||
PARAM_DYNSYS_BASSGAIN, // 0x10025
|
|
||||||
PARAM_VIPERBASS_PROCESS_ENABLED, // 0x10026
|
#define PARAM_AUTOMATIC_GAIN_CONTROL_ENABLE 65565
|
||||||
PARAM_VIPERBASS_MODE, // 0x10027
|
#define PARAM_AUTOMATIC_GAIN_CONTROL_RATIO 65566
|
||||||
PARAM_VIPERBASS_SPEAKER, // 0x10028
|
#define PARAM_AUTOMATIC_GAIN_CONTROL_VOLUME 65567
|
||||||
PARAM_VIPERBASS_BASSGAIN, // 0x10029
|
#define PARAM_AUTOMATIC_GAIN_CONTROL_MAX_SCALER 65568
|
||||||
PARAM_VIPERCLARITY_PROCESS_ENABLED, // 0x1002A
|
|
||||||
PARAM_VIPERCLARITY_MODE, // 0x1002B
|
#define PARAM_DYNAMIC_SYSTEM_ENABLE 65569
|
||||||
PARAM_VIPERCLARITY_CLARITY, // 0x1002C
|
#define PARAM_DYNAMIC_SYSTEM_X_COEFFICIENTS 65570
|
||||||
PARAM_CURE_PROCESS_ENABLED, // 0x1002D
|
#define PARAM_DYNAMIC_SYSTEM_Y_COEFFICIENTS 65571
|
||||||
PARAM_CURE_CROSSFEED, // 0x1002E
|
#define PARAM_DYNAMIC_SYSTEM_SIDE_GAIN 65572
|
||||||
PARAM_TUBE_PROCESS_ENABLED, // 0x1002F
|
#define PARAM_DYNAMIC_SYSTEM_STRENGTH 65573
|
||||||
PARAM_ANALOGX_PROCESS_ENABLED, // 0x10030
|
|
||||||
PARAM_ANALOGX_MODE, // 0x10031
|
#define PARAM_FIDELITY_BASS_ENABLE 65574
|
||||||
PARAM_OUTPUT_VOLUME, // 0x10032
|
#define PARAM_FIDELITY_BASS_MODE 65575
|
||||||
PARAM_OUTPUT_PAN, // 0x10033
|
#define PARAM_FIDELITY_BASS_FREQUENCY 65576
|
||||||
PARAM_LIMITER_THRESHOLD, // 0x10034
|
#define PARAM_FIDELITY_BASS_GAIN 65577
|
||||||
PARAM_SPKFX_AGC_PROCESS_ENABLED = 0x10043, // 0x10043
|
|
||||||
PARAM_FETCOMP_PROCESS_ENABLED = 0x10049, // 0x10049
|
#define PARAM_FIDELITY_CLARITY_ENABLE 65578
|
||||||
PARAM_FETCOMP_THRESHOLD, // 0x1004A
|
#define PARAM_FIDELITY_CLARITY_MODE 65579
|
||||||
PARAM_FETCOMP_RATIO, // 0x1004B
|
#define PARAM_FIDELITY_CLARITY_GAIN 65580
|
||||||
PARAM_FETCOMP_KNEEWIDTH, // 0x1004C
|
|
||||||
PARAM_FETCOMP_AUTOKNEE_ENABLED, // 0x1004D
|
#define PARAM_CURE_CROSS_FEED_ENABLED 65581
|
||||||
PARAM_FETCOMP_GAIN, // 0x1004E
|
#define PARAM_CURE_CROSS_FEED_STRENGTH 65582
|
||||||
PARAM_FETCOMP_AUTOGAIN_ENABLED, // 0x1004F
|
|
||||||
PARAM_FETCOMP_ATTACK, // 0x10050
|
#define PARAM_TUBE_SIMULATOR_ENABLED 65583
|
||||||
PARAM_FETCOMP_AUTOATTACK_ENABLED, // 0x10051
|
|
||||||
PARAM_FETCOMP_RELEASE, // 0x10052
|
#define PARAM_ANALOGX_ENABLE 65584
|
||||||
PARAM_FETCOMP_AUTORELEASE_ENABLED, // 0x10053
|
#define PARAM_ANALOGX_MODE 65585
|
||||||
PARAM_FETCOMP_META_KNEEMULTI, // 0x10054
|
|
||||||
PARAM_FETCOMP_META_MAXATTACK, // 0x10055
|
#define PARAM_GATE_OUTPUT_VOLUME 65586
|
||||||
PARAM_FETCOMP_META_MAXRELEASE, // 0x10056
|
#define PARAM_GATE_CHANNEL_PAN 65587
|
||||||
PARAM_FETCOMP_META_CREST, // 0x10057
|
#define PARAM_GATE_LIMIT 65588
|
||||||
PARAM_FETCOMP_META_ADAPT, // 0x10058
|
|
||||||
PARAM_FETCOMP_META_NOCLIP_ENABLED, // 0x10059
|
#define PARAM_SPEAKER_OPTIMIZATION 65603
|
||||||
};
|
|
||||||
|
#define PARAM_FET_COMPRESSOR_ENABLE 65610
|
||||||
|
#define PARAM_FET_COMPRESSOR_THRESHOLD 65611
|
||||||
|
#define PARAM_FET_COMPRESSOR_RATIO 65612
|
||||||
|
#define PARAM_FET_COMPRESSOR_KNEE 65613
|
||||||
|
#define PARAM_FET_COMPRESSOR_AUTO_KNEE 65614
|
||||||
|
#define PARAM_FET_COMPRESSOR_GAIN 65615
|
||||||
|
#define PARAM_FET_COMPRESSOR_AUTO_GAIN 65616
|
||||||
|
#define PARAM_FET_COMPRESSOR_ATTACK 65617
|
||||||
|
#define PARAM_FET_COMPRESSOR_AUTO_ATTACK 65618
|
||||||
|
#define PARAM_FET_COMPRESSOR_RELEASE 65619
|
||||||
|
#define PARAM_FET_COMPRESSOR_AUTO_RELEASE 65620
|
||||||
|
#define PARAM_FET_COMPRESSOR_KNEE_MULTI 65621
|
||||||
|
#define PARAM_FET_COMPRESSOR_MAX_ATTACK 65622
|
||||||
|
#define PARAM_FET_COMPRESSOR_MAX_RELEASE 65623
|
||||||
|
#define PARAM_FET_COMPRESSOR_CREST 65624
|
||||||
|
#define PARAM_FET_COMPRESSOR_ADAPT 65625
|
||||||
|
#define PARAM_FET_COMPRESSOR_NO_CLIP 65626
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ void ViPER::processBuffer(float *buffer, uint32_t size) {
|
|||||||
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, size)) {
|
if (!this->waveBuffer->PushSamples(buffer, size)) {
|
||||||
this->waveBuffer->Reset();
|
this->waveBuffer->Reset();
|
||||||
@ -181,7 +181,7 @@ void ViPER::processBuffer(float *buffer, uint32_t size) {
|
|||||||
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, size)) {
|
if (this->adaptiveBuffer->PushFrames(buffer, size)) {
|
||||||
this->adaptiveBuffer->SetBufferOffset(size);
|
this->adaptiveBuffer->SetBufferOffset(size);
|
||||||
@ -251,172 +251,177 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
this->ResetAllEffects();
|
this->ResetAllEffects();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PARAM_CONV_PROCESS_ENABLED: {
|
case PARAM_CONVOLUTION_ENABLE: {
|
||||||
// this->convolver->SetEnabled(val1 != 0);
|
// this->convolver->SetEnabled(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10002
|
} // 0x10002
|
||||||
case PARAM_CONV_UPDATEKERNEL: {
|
case PARAM_CONVOLUTION_PREPARE_BUFFER: {
|
||||||
// this->convolver->SetKernel(arr, arrSize);
|
|
||||||
break;
|
break;
|
||||||
}
|
} // 0x10004
|
||||||
case PARAM_CONV_CROSSCHANNEL: {
|
case PARAM_CONVOLUTION_SET_BUFFER: {
|
||||||
|
break;
|
||||||
|
} // 0x10005
|
||||||
|
case PARAM_CONVOLUTION_COMMIT_BUFFER: {
|
||||||
|
break;
|
||||||
|
} // 0x10006
|
||||||
|
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_VHE_PROCESS_ENABLED: {
|
case PARAM_HEADPHONE_SURROUND_ENABLE: {
|
||||||
this->vhe->SetEnable(val1 != 0);
|
this->vhe->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10008
|
} // 0x10008
|
||||||
case PARAM_VHE_EFFECT_LEVEL: {
|
case PARAM_HEADPHONE_SURROUND_STRENGTH: {
|
||||||
this->vhe->SetEffectLevel(val1);
|
this->vhe->SetEffectLevel(val1);
|
||||||
break;
|
break;
|
||||||
} // 0x10009
|
} // 0x10009
|
||||||
case PARAM_VDDC_PROCESS_ENABLED: {
|
case PARAM_DDC_ENABLE: {
|
||||||
this->viperDdc->SetEnable(val1 != 0);
|
this->viperDdc->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1000A
|
} // 0x1000A
|
||||||
case PARAM_VDDC_COEFFS: {
|
case PARAM_DDC_COEFFICIENTS: {
|
||||||
// TODO: Finish
|
// TODO: Finish
|
||||||
//this->viperDdc->SetCoeffs();
|
//this->viperDdc->SetCoeffs();
|
||||||
break;
|
break;
|
||||||
} // 0x1000B
|
} // 0x1000B
|
||||||
case PARAM_VSE_PROCESS_ENABLED: {
|
case PARAM_SPECTRUM_EXTENSION_ENABLE: {
|
||||||
this->spectrumExtend->SetEnable(val1 != 0);
|
this->spectrumExtend->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1000C
|
} // 0x1000C
|
||||||
case PARAM_VSE_REFERENCE_BARK: {
|
case PARAM_SPECTRUM_EXTENSION_BARK: {
|
||||||
this->spectrumExtend->SetReferenceFrequency(val1);
|
this->spectrumExtend->SetReferenceFrequency(val1);
|
||||||
break;
|
break;
|
||||||
} // 0x1000D
|
} // 0x1000D
|
||||||
case PARAM_VSE_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_FIREQ_PROCESS_ENABLED: {
|
case PARAM_FIR_EQUALIZER_ENABLE: {
|
||||||
this->iirFilter->SetEnable(val1 != 0);
|
this->iirFilter->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1000F
|
} // 0x1000F
|
||||||
case PARAM_FIREQ_BANDLEVEL: {
|
case PARAM_FIR_EQUALIZER_BAND_LEVEL: {
|
||||||
this->iirFilter->SetBandLevel(val1, (float) val2 / 100.0f);
|
this->iirFilter->SetBandLevel(val1, (float) val2 / 100.0f);
|
||||||
break;
|
break;
|
||||||
} // 0x10010
|
} // 0x10010
|
||||||
case PARAM_COLM_PROCESS_ENABLED: {
|
case PARAM_FIELD_SURROUND_ENABLE: {
|
||||||
this->colorfulMusic->SetEnable(val1 != 0);
|
this->colorfulMusic->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10011
|
} // 0x10011
|
||||||
case PARAM_COLM_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_COLM_MIDIMAGE: {
|
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_COLM_DEPTH: {
|
case PARAM_FIELD_SURROUND_DEPTH: {
|
||||||
this->colorfulMusic->SetDepthValue((short) val1);
|
this->colorfulMusic->SetDepthValue((short) val1);
|
||||||
break;
|
break;
|
||||||
} // 0x10014
|
} // 0x10014
|
||||||
case PARAM_DIFFSURR_PROCESS_ENABLED: {
|
case PARAM_DIFFERENTIAL_SURROUND_ENABLE: {
|
||||||
this->diffSurround->SetEnable(val1 != 0);
|
this->diffSurround->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10015
|
} // 0x10015
|
||||||
case PARAM_DIFFSURR_DELAYTIME: {
|
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_REVB_PROCESS_ENABLED: {
|
case PARAM_REVERBERATION_ENABLE: {
|
||||||
this->reverberation->SetEnable(val1 != 0);
|
this->reverberation->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10017
|
} // 0x10017
|
||||||
case PARAM_REVB_ROOMSIZE: {
|
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_REVB_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_REVB_DAMP: {
|
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_REVB_WET: {
|
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_REVB_DRY: {
|
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_AGC_PROCESS_ENABLED: {
|
case PARAM_AUTOMATIC_GAIN_CONTROL_ENABLE: {
|
||||||
this->playbackGain->SetEnable(val1 != 0);
|
this->playbackGain->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1001D
|
} // 0x1001D
|
||||||
case PARAM_AGC_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_AGC_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_AGC_MAXSCALER: {
|
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_DYNSYS_PROCESS_ENABLED: {
|
case PARAM_DYNAMIC_SYSTEM_ENABLE: {
|
||||||
this->dynamicSystem->SetEnable(val1 != 0);
|
this->dynamicSystem->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10021
|
} // 0x10021
|
||||||
case PARAM_DYNSYS_XCOEFFS: {
|
case PARAM_DYNAMIC_SYSTEM_X_COEFFICIENTS: {
|
||||||
this->dynamicSystem->SetXCoeffs(val1, val2);
|
this->dynamicSystem->SetXCoeffs(val1, val2);
|
||||||
break;
|
break;
|
||||||
} // 0x10022
|
} // 0x10022
|
||||||
case PARAM_DYNSYS_YCOEFFS: {
|
case PARAM_DYNAMIC_SYSTEM_Y_COEFFICIENTS: {
|
||||||
this->dynamicSystem->SetYCoeffs(val1, val2);
|
this->dynamicSystem->SetYCoeffs(val1, val2);
|
||||||
break;
|
break;
|
||||||
} // 0x10023
|
} // 0x10023
|
||||||
case PARAM_DYNSYS_SIDEGAIN: {
|
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_DYNSYS_BASSGAIN: {
|
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_VIPERBASS_PROCESS_ENABLED: {
|
case PARAM_FIDELITY_BASS_ENABLE: {
|
||||||
this->viperBass->SetEnable(val1 != 0);
|
this->viperBass->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10026
|
} // 0x10026
|
||||||
case PARAM_VIPERBASS_MODE: {
|
case PARAM_FIDELITY_BASS_MODE: {
|
||||||
this->viperBass->SetProcessMode((ViPERBass::ProcessMode) val1);
|
this->viperBass->SetProcessMode((ViPERBass::ProcessMode) val1);
|
||||||
break;
|
break;
|
||||||
} // 0x10027
|
} // 0x10027
|
||||||
case PARAM_VIPERBASS_SPEAKER: {
|
case PARAM_FIDELITY_BASS_FREQUENCY: {
|
||||||
this->viperBass->SetSpeaker(val1);
|
this->viperBass->SetSpeaker(val1);
|
||||||
break;
|
break;
|
||||||
} // 0x10028
|
} // 0x10028
|
||||||
case PARAM_VIPERBASS_BASSGAIN: {
|
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_VIPERCLARITY_PROCESS_ENABLED: {
|
case PARAM_FIDELITY_CLARITY_ENABLE: {
|
||||||
this->viperClarity->SetEnable(val1 != 0);
|
this->viperClarity->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1002A
|
} // 0x1002A
|
||||||
case PARAM_VIPERCLARITY_MODE: {
|
case PARAM_FIDELITY_CLARITY_MODE: {
|
||||||
this->viperClarity->SetProcessMode((ViPERClarity::ClarityMode) val1);
|
this->viperClarity->SetProcessMode((ViPERClarity::ClarityMode) val1);
|
||||||
break;
|
break;
|
||||||
} // 0x1002B
|
} // 0x1002B
|
||||||
case PARAM_VIPERCLARITY_CLARITY: {
|
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_PROCESS_ENABLED: {
|
case PARAM_CURE_CROSS_FEED_ENABLED: {
|
||||||
this->cure->SetEnable(val1 != 0);
|
this->cure->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1002D
|
} // 0x1002D
|
||||||
case PARAM_CURE_CROSSFEED: {
|
case PARAM_CURE_CROSS_FEED_STRENGTH: {
|
||||||
switch (val1) {
|
switch (val1) {
|
||||||
case 0:
|
case 0:
|
||||||
// Cure_R::SetPreset(pCVar17,0x5f028a);
|
// Cure_R::SetPreset(pCVar17,0x5f028a);
|
||||||
@ -430,11 +435,11 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} // 0x1002E
|
} // 0x1002E
|
||||||
case PARAM_TUBE_PROCESS_ENABLED: {
|
case PARAM_TUBE_SIMULATOR_ENABLED: {
|
||||||
this->tubeSimulator->SetEnable(val1 != 0);
|
this->tubeSimulator->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x1002F
|
} // 0x1002F
|
||||||
case PARAM_ANALOGX_PROCESS_ENABLED: {
|
case PARAM_ANALOGX_ENABLE: {
|
||||||
this->analogX->SetEnable(val1 != 0);
|
this->analogX->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10030
|
} // 0x10030
|
||||||
@ -442,11 +447,11 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
this->analogX->SetProcessingModel(val1);
|
this->analogX->SetProcessingModel(val1);
|
||||||
break;
|
break;
|
||||||
} // 0x10031
|
} // 0x10031
|
||||||
case PARAM_OUTPUT_VOLUME: {
|
case PARAM_GATE_OUTPUT_VOLUME: {
|
||||||
this->frameScale = (float) val1 / 100.0f;
|
this->frameScale = (float) val1 / 100.0f;
|
||||||
break;
|
break;
|
||||||
} // 0x10032
|
} // 0x10032
|
||||||
case PARAM_OUTPUT_PAN: {
|
case PARAM_GATE_CHANNEL_PAN: {
|
||||||
float tmp = (float) val1 / 100.0f;
|
float tmp = (float) val1 / 100.0f;
|
||||||
if (tmp < 0.0f) {
|
if (tmp < 0.0f) {
|
||||||
this->leftPan = 1.0f;
|
this->leftPan = 1.0f;
|
||||||
@ -457,67 +462,67 @@ void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, u
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} // 0x10033
|
} // 0x10033
|
||||||
case PARAM_LIMITER_THRESHOLD: {
|
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_SPKFX_AGC_PROCESS_ENABLED: {
|
case PARAM_SPEAKER_OPTIMIZATION: {
|
||||||
this->speakerCorrection->SetEnable(val1 != 0);
|
this->speakerCorrection->SetEnable(val1 != 0);
|
||||||
break;
|
break;
|
||||||
} // 0x10043
|
} // 0x10043
|
||||||
case PARAM_FETCOMP_PROCESS_ENABLED: {
|
case PARAM_FET_COMPRESSOR_ENABLE: {
|
||||||
break;
|
break;
|
||||||
} // 0x10049
|
} // 0x10049
|
||||||
case PARAM_FETCOMP_THRESHOLD: {
|
case PARAM_FET_COMPRESSOR_THRESHOLD: {
|
||||||
break;
|
break;
|
||||||
} // 0x1004A
|
} // 0x1004A
|
||||||
case PARAM_FETCOMP_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_FETCOMP_KNEEWIDTH: {
|
case PARAM_FET_COMPRESSOR_KNEE: {
|
||||||
break;
|
break;
|
||||||
} // 0x1004C
|
} // 0x1004C
|
||||||
case PARAM_FETCOMP_AUTOKNEE_ENABLED: {
|
case PARAM_FET_COMPRESSOR_AUTO_KNEE: {
|
||||||
break;
|
break;
|
||||||
} // 0x1004D
|
} // 0x1004D
|
||||||
case PARAM_FETCOMP_GAIN: {
|
case PARAM_FET_COMPRESSOR_GAIN: {
|
||||||
break;
|
break;
|
||||||
} // 0x1004E
|
} // 0x1004E
|
||||||
case PARAM_FETCOMP_AUTOGAIN_ENABLED: {
|
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_FETCOMP_ATTACK: {
|
case PARAM_FET_COMPRESSOR_ATTACK: {
|
||||||
break;
|
break;
|
||||||
} // 0x10050
|
} // 0x10050
|
||||||
case PARAM_FETCOMP_AUTOATTACK_ENABLED: {
|
case PARAM_FET_COMPRESSOR_AUTO_ATTACK: {
|
||||||
break;
|
break;
|
||||||
} // 0x10051
|
} // 0x10051
|
||||||
case PARAM_FETCOMP_RELEASE: {
|
case PARAM_FET_COMPRESSOR_RELEASE: {
|
||||||
break;
|
break;
|
||||||
} // 0x10052
|
} // 0x10052
|
||||||
case PARAM_FETCOMP_AUTORELEASE_ENABLED: {
|
case PARAM_FET_COMPRESSOR_AUTO_RELEASE: {
|
||||||
break;
|
break;
|
||||||
} // 0x10053
|
} // 0x10053
|
||||||
case PARAM_FETCOMP_META_KNEEMULTI: {
|
case PARAM_FET_COMPRESSOR_KNEE_MULTI: {
|
||||||
break;
|
break;
|
||||||
} // 0x10054
|
} // 0x10054
|
||||||
case PARAM_FETCOMP_META_MAXATTACK: {
|
case PARAM_FET_COMPRESSOR_MAX_ATTACK: {
|
||||||
break;
|
break;
|
||||||
} // 0x10055
|
} // 0x10055
|
||||||
case PARAM_FETCOMP_META_MAXRELEASE: {
|
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_FETCOMP_META_CREST: {
|
case PARAM_FET_COMPRESSOR_CREST: {
|
||||||
break;
|
break;
|
||||||
} // 0x10057
|
} // 0x10057
|
||||||
case PARAM_FETCOMP_META_ADAPT: {
|
case PARAM_FET_COMPRESSOR_ADAPT: {
|
||||||
break;
|
break;
|
||||||
} // 0x10058
|
} // 0x10058
|
||||||
case PARAM_FETCOMP_META_NOCLIP_ENABLED: {
|
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
|
||||||
|
@ -4,18 +4,16 @@
|
|||||||
ColorfulMusic::ColorfulMusic() {
|
ColorfulMusic::ColorfulMusic() {
|
||||||
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;
|
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;
|
||||||
this->enabled = false;
|
this->enabled = false;
|
||||||
this->stereo3DSurround.SetStereoWiden(0.0f);
|
this->stereo3dSurround.SetStereoWiden(0.0);
|
||||||
this->depthSurround.SetSamplingRate(this->samplingRate);
|
this->depthSurround.SetSamplingRate(this->samplingRate);
|
||||||
this->depthSurround.SetStrength(0);
|
this->depthSurround.SetStrength(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorfulMusic::Process(float *samples, uint32_t size) {
|
void ColorfulMusic::Process(float *samples, uint32_t size) {
|
||||||
if (!this->enabled) {
|
if (!this->enabled) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->depthSurround.Process(samples, size);
|
this->depthSurround.Process(samples, size);
|
||||||
this->stereo3DSurround.Process(samples, size);
|
this->stereo3dSurround.Process(samples, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorfulMusic::Reset() {
|
void ColorfulMusic::Reset() {
|
||||||
@ -28,15 +26,15 @@ void ColorfulMusic::SetDepthValue(short depthValue) {
|
|||||||
|
|
||||||
void ColorfulMusic::SetEnable(bool enable) {
|
void ColorfulMusic::SetEnable(bool enable) {
|
||||||
if (this->enabled != enable) {
|
if (this->enabled != enable) {
|
||||||
this->enabled = enable;
|
if (!this->enabled) {
|
||||||
if (enable) {
|
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
this->enabled = enable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorfulMusic::SetMidImageValue(float midImageValue) {
|
void ColorfulMusic::SetMidImageValue(float midImageValue) {
|
||||||
this->stereo3DSurround.SetMiddleImage(midImageValue);
|
this->stereo3dSurround.SetMiddleImage(midImageValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorfulMusic::SetSamplingRate(uint32_t samplingRate) {
|
void ColorfulMusic::SetSamplingRate(uint32_t samplingRate) {
|
||||||
@ -47,5 +45,5 @@ void ColorfulMusic::SetSamplingRate(uint32_t samplingRate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ColorfulMusic::SetWidenValue(float widenValue) {
|
void ColorfulMusic::SetWidenValue(float widenValue) {
|
||||||
this->stereo3DSurround.SetStereoWiden(widenValue);
|
this->stereo3dSurround.SetStereoWiden(widenValue);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
void SetWidenValue(float widenValue);
|
void SetWidenValue(float widenValue);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Stereo3DSurround stereo3DSurround;
|
Stereo3DSurround stereo3dSurround;
|
||||||
DepthSurround depthSurround;
|
DepthSurround depthSurround;
|
||||||
uint32_t samplingRate;
|
uint32_t samplingRate;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
@ -5,36 +5,6 @@ Cure::Cure() {
|
|||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
Cure::~Cure() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Cure::Process(float *buffer, uint32_t size) {
|
|
||||||
if (this->enabled) {
|
|
||||||
this->crossfeed.ProcessFrames(buffer, size);
|
|
||||||
this->pass.ProcessFrames(buffer, size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Cure::Reset() {
|
|
||||||
this->crossfeed.Reset();
|
|
||||||
this->pass.Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Cure::SetEnable(bool enabled) {
|
|
||||||
if (this->enabled != enabled) {
|
|
||||||
this->enabled = enabled;
|
|
||||||
if (enabled) {
|
|
||||||
Reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Cure::SetSamplingRate(uint32_t samplingRate) {
|
|
||||||
this->crossfeed.SetSamplingRate(samplingRate);
|
|
||||||
this->pass.SetSamplingRate(samplingRate);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Cure::GetCutoff() {
|
uint16_t Cure::GetCutoff() {
|
||||||
return this->crossfeed.GetCutoff();
|
return this->crossfeed.GetCutoff();
|
||||||
}
|
}
|
||||||
@ -51,10 +21,31 @@ struct Crossfeed::Preset Cure::GetPreset() {
|
|||||||
return this->crossfeed.GetPreset();
|
return this->crossfeed.GetPreset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Cure::Process(float *buffer, uint32_t size) {
|
||||||
|
if (this->enabled) {
|
||||||
|
this->crossfeed.ProcessFrames(buffer, size);
|
||||||
|
this->passFilter.ProcessFrames(buffer, size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cure::Reset() {
|
||||||
|
this->crossfeed.Reset();
|
||||||
|
this->passFilter.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
void Cure::SetCutoff(uint16_t cutoff) {
|
void Cure::SetCutoff(uint16_t cutoff) {
|
||||||
this->crossfeed.SetCutoff(cutoff);
|
this->crossfeed.SetCutoff(cutoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Cure::SetEnable(bool enabled) {
|
||||||
|
if (this->enabled != enabled) {
|
||||||
|
this->enabled = enabled;
|
||||||
|
if (enabled) {
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Cure::SetFeedback(float feedback) {
|
void Cure::SetFeedback(float feedback) {
|
||||||
this->crossfeed.SetFeedback(feedback);
|
this->crossfeed.SetFeedback(feedback);
|
||||||
}
|
}
|
||||||
@ -63,3 +54,7 @@ void Cure::SetPreset(struct Crossfeed::Preset preset) {
|
|||||||
this->crossfeed.SetPreset(preset);
|
this->crossfeed.SetPreset(preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Cure::SetSamplingRate(uint32_t samplingRate) {
|
||||||
|
this->crossfeed.SetSamplingRate(samplingRate);
|
||||||
|
this->passFilter.SetSamplingRate(samplingRate);
|
||||||
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
class Cure {
|
class Cure {
|
||||||
public:
|
public:
|
||||||
Cure();
|
Cure();
|
||||||
~Cure();
|
|
||||||
|
|
||||||
uint16_t GetCutoff();
|
uint16_t GetCutoff();
|
||||||
float GetFeedback();
|
float GetFeedback();
|
||||||
@ -21,7 +20,8 @@ public:
|
|||||||
void SetPreset(struct Crossfeed::Preset preset);
|
void SetPreset(struct Crossfeed::Preset preset);
|
||||||
void SetSamplingRate(uint32_t samplingRate);
|
void SetSamplingRate(uint32_t samplingRate);
|
||||||
|
|
||||||
|
private:
|
||||||
Crossfeed crossfeed;
|
Crossfeed crossfeed;
|
||||||
PassFilter pass;
|
PassFilter passFilter;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
};
|
};
|
||||||
|
@ -9,6 +9,7 @@ DiffSurround::DiffSurround() {
|
|||||||
for (auto &buffer : this->buffers) {
|
for (auto &buffer : this->buffers) {
|
||||||
buffer = new WaveBuffer(1, 0x1000);
|
buffer = new WaveBuffer(1, 0x1000);
|
||||||
}
|
}
|
||||||
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
DiffSurround::~DiffSurround() {
|
DiffSurround::~DiffSurround() {
|
||||||
@ -42,11 +43,10 @@ void DiffSurround::Process(float *samples, uint32_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DiffSurround::Reset() {
|
void DiffSurround::Reset() {
|
||||||
for (auto &buffer : this->buffers) {
|
this->buffers[0]->Reset();
|
||||||
buffer->Reset();
|
this->buffers[1]->Reset();
|
||||||
}
|
|
||||||
|
|
||||||
this->buffers[1]->PushZeros((uint32_t) (this->delayTime / 1000.0f * (float) this->samplingRate));
|
this->buffers[1]->PushZeros((uint32_t) ((double) this->delayTime / 1000.0 * (double) this->samplingRate));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiffSurround::SetDelayTime(float delayTime) {
|
void DiffSurround::SetDelayTime(float delayTime) {
|
||||||
@ -58,10 +58,10 @@ void DiffSurround::SetDelayTime(float delayTime) {
|
|||||||
|
|
||||||
void DiffSurround::SetEnable(bool enabled) {
|
void DiffSurround::SetEnable(bool enabled) {
|
||||||
if (this->enabled != enabled) {
|
if (this->enabled != enabled) {
|
||||||
this->enabled = enabled;
|
if (!this->enabled) {
|
||||||
if (enabled) {
|
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
this->enabled = enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,55 +2,51 @@
|
|||||||
#include "../constants.h"
|
#include "../constants.h"
|
||||||
|
|
||||||
DynamicSystem::DynamicSystem() {
|
DynamicSystem::DynamicSystem() {
|
||||||
this->enabled = false;
|
|
||||||
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;
|
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;
|
||||||
this->bass.SetSamplingRate(this->samplingRate);
|
this->enable = false;
|
||||||
this->bass.Reset();
|
this->dynamicBass.SetSamplingRate(this->samplingRate);
|
||||||
|
this->dynamicBass.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicSystem::Process(float *samples, uint32_t size) {
|
void DynamicSystem::Process(float *samples, uint32_t size) {
|
||||||
if (this->enabled) {
|
if (!this->enable) return;
|
||||||
this->bass.FilterSamples(samples, size);
|
|
||||||
}
|
this->dynamicBass.FilterSamples(samples, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicSystem::Reset() {
|
void DynamicSystem::Reset() {
|
||||||
this->bass.SetSamplingRate(this->samplingRate);
|
this->dynamicBass.SetSamplingRate(this->samplingRate);
|
||||||
this->bass.Reset();
|
this->dynamicBass.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicSystem::SetBassGain(float gain) {
|
void DynamicSystem::SetBassGain(float gain) {
|
||||||
this->bass.SetBassGain(gain);
|
this->dynamicBass.SetBassGain(gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicSystem::SetEnable(bool enable) {
|
void DynamicSystem::SetEnable(bool enable) {
|
||||||
if (this->enabled != enable) {
|
if (this->enable != enable) {
|
||||||
this->enabled = enable;
|
if (!this->enable) {
|
||||||
if (enable) {
|
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
this->enable = enable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicSystem::SetSideGain(float gainX, float gainY) {
|
|
||||||
this->bass.SetSideGain(gainX, gainY);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicSystem::SetXCoeffs(uint32_t low, uint32_t high) {
|
|
||||||
this->bass.SetFilterXPassFrequency(low, high);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicSystem::SetYCoeffs(uint32_t low, uint32_t high) {
|
|
||||||
this->bass.SetFilterYPassFrequency(low, high);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicSystem::SetSamplingRate(uint32_t samplingRate) {
|
void DynamicSystem::SetSamplingRate(uint32_t samplingRate) {
|
||||||
if (this->samplingRate != samplingRate) {
|
if (this->samplingRate != samplingRate) {
|
||||||
this->samplingRate = samplingRate;
|
this->samplingRate = samplingRate;
|
||||||
this->bass.SetSamplingRate(samplingRate);
|
this->dynamicBass.SetSamplingRate(samplingRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicSystem::~DynamicSystem() {
|
void DynamicSystem::SetSideGain(float gainX, float gainY) {
|
||||||
|
this->dynamicBass.SetSideGain(gainX, gainY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicSystem::SetXCoeffs(uint32_t low, uint32_t high) {
|
||||||
|
this->dynamicBass.SetFilterXPassFrequency(low, high);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicSystem::SetYCoeffs(uint32_t low, uint32_t high) {
|
||||||
|
this->dynamicBass.SetFilterYPassFrequency(low, high);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
class DynamicSystem {
|
class DynamicSystem {
|
||||||
public:
|
public:
|
||||||
DynamicSystem();
|
DynamicSystem();
|
||||||
~DynamicSystem();
|
|
||||||
|
|
||||||
void Process(float *samples, uint32_t size);
|
void Process(float *samples, uint32_t size);
|
||||||
void Reset();
|
void Reset();
|
||||||
@ -17,9 +16,10 @@ public:
|
|||||||
void SetXCoeffs(uint32_t low, uint32_t high);
|
void SetXCoeffs(uint32_t low, uint32_t high);
|
||||||
void SetYCoeffs(uint32_t low, uint32_t high);
|
void SetYCoeffs(uint32_t low, uint32_t high);
|
||||||
|
|
||||||
DynamicBass bass;
|
private:
|
||||||
|
DynamicBass dynamicBass;
|
||||||
uint32_t samplingRate;
|
uint32_t samplingRate;
|
||||||
bool enabled;
|
bool enable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ float FETCompressor::GetParameterDefault(FETCompressor::Parameter parameter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FETCompressor::Process(float *samples, uint32_t size) {
|
void FETCompressor::Process(float *samples, uint32_t size) {
|
||||||
|
return;
|
||||||
if (size == 0) return;
|
if (size == 0) return;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < size * 2; i += 2) {
|
for (uint32_t i = 0; i < size * 2; i += 2) {
|
||||||
|
@ -13,43 +13,11 @@ Crossfeed::Crossfeed() {
|
|||||||
this->b1_hi = 0.f;
|
this->b1_hi = 0.f;
|
||||||
this->gain = 0.f;
|
this->gain = 0.f;
|
||||||
memset(&this->lfs, 0, 6 * sizeof(float));
|
memset(&this->lfs, 0, 6 * sizeof(float));
|
||||||
this->samplerate = VIPER_DEFAULT_SAMPLING_RATE;
|
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;
|
||||||
this->preset.cutoff = 700;
|
this->preset.cutoff = 700;
|
||||||
this->preset.feedback = 45;
|
this->preset.feedback = 45;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crossfeed::Reset() {
|
|
||||||
uint16_t cutoff = this->preset.cutoff;
|
|
||||||
uint16_t level = this->preset.feedback;
|
|
||||||
|
|
||||||
level /= 10.0;
|
|
||||||
|
|
||||||
double GB_lo = level * -5.0 / 6.0 - 3.0;
|
|
||||||
double GB_hi = level / 6.0 - 3.0;
|
|
||||||
|
|
||||||
double G_lo = pow(10, GB_lo / 20.0);
|
|
||||||
double G_hi = 1.0 - pow(10, GB_hi / 20.0);
|
|
||||||
double Fc_hi = cutoff * pow(2.0, (GB_lo - 20.0 * log10(G_hi)) / 12.0);
|
|
||||||
|
|
||||||
double x = exp(-2.0 * M_PI * cutoff / this->samplerate);
|
|
||||||
this->b1_lo = (float) x;
|
|
||||||
this->a0_lo = (float) (G_lo * (1.0 - x));
|
|
||||||
|
|
||||||
x = exp(-2.0 * M_PI * Fc_hi / this->samplerate);
|
|
||||||
this->b1_hi = (float) x;
|
|
||||||
this->a0_hi = (float) (1.0 - G_hi * (1.0 - x));
|
|
||||||
this->a1_hi = (float) -x;
|
|
||||||
|
|
||||||
this->gain = (float) (1.0 / (1.0 - G_hi + G_lo));
|
|
||||||
memset(&this->lfs, 0, 6 * sizeof(float));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Crossfeed::ProcessFrames(float *buffer, uint32_t size) {
|
|
||||||
for (uint32_t x = 0; x < size; x += 2) {
|
|
||||||
FilterSample(&buffer[x]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define lo_filter(in, out_1) (this->a0_lo * (in) + this->b1_lo * (out_1))
|
#define lo_filter(in, out_1) (this->a0_lo * (in) + this->b1_lo * (out_1))
|
||||||
#define hi_filter(in, in_1, out_1) (this->a0_hi * (in) + this->a1_hi * (in_1) + this->b1_hi * (out_1))
|
#define hi_filter(in, in_1, out_1) (this->a0_hi * (in) + this->a1_hi * (in_1) + this->b1_hi * (out_1))
|
||||||
|
|
||||||
@ -75,7 +43,7 @@ float Crossfeed::GetFeedback() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float Crossfeed::GetLevelDelay() {
|
float Crossfeed::GetLevelDelay() {
|
||||||
if (this->preset.cutoff <= 1800) {
|
if (this->preset.cutoff <= 1800) { // TODO: Previous version reports <= 2000
|
||||||
return (float) ((18700.0 / (double) this->preset.cutoff) * 10.0);
|
return (float) ((18700.0 / (double) this->preset.cutoff) * 10.0);
|
||||||
} else {
|
} else {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
@ -86,6 +54,38 @@ struct Crossfeed::Preset Crossfeed::GetPreset() {
|
|||||||
return this->preset;
|
return this->preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Crossfeed::ProcessFrames(float *buffer, uint32_t size) {
|
||||||
|
for (uint32_t i = 0; i < size; i += 2) {
|
||||||
|
FilterSample(&buffer[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Crossfeed::Reset() {
|
||||||
|
uint16_t cutoff = this->preset.cutoff;
|
||||||
|
uint16_t level = this->preset.feedback;
|
||||||
|
|
||||||
|
level /= 10.0;
|
||||||
|
|
||||||
|
double GB_lo = level * -5.0 / 6.0 - 3.0;
|
||||||
|
double GB_hi = level / 6.0 - 3.0;
|
||||||
|
|
||||||
|
double G_lo = pow(10, GB_lo / 20.0);
|
||||||
|
double G_hi = 1.0 - pow(10, GB_hi / 20.0);
|
||||||
|
double Fc_hi = cutoff * pow(2.0, (GB_lo - 20.0 * log10(G_hi)) / 12.0);
|
||||||
|
|
||||||
|
double x = exp(-2.0 * M_PI * cutoff / this->samplingRate);
|
||||||
|
this->b1_lo = (float) x;
|
||||||
|
this->a0_lo = (float) (G_lo * (1.0 - x));
|
||||||
|
|
||||||
|
x = exp(-2.0 * M_PI * Fc_hi / this->samplingRate);
|
||||||
|
this->b1_hi = (float) x;
|
||||||
|
this->a0_hi = (float) (1.0 - G_hi * (1.0 - x));
|
||||||
|
this->a1_hi = (float) -x;
|
||||||
|
|
||||||
|
this->gain = (float) (1.0 / (1.0 - G_hi + G_lo));
|
||||||
|
memset(&this->lfs, 0, 6 * sizeof(float));
|
||||||
|
}
|
||||||
|
|
||||||
void Crossfeed::SetCutoff(uint16_t cutoff) {
|
void Crossfeed::SetCutoff(uint16_t cutoff) {
|
||||||
this->preset.cutoff = cutoff;
|
this->preset.cutoff = cutoff;
|
||||||
Reset();
|
Reset();
|
||||||
@ -102,6 +102,8 @@ void Crossfeed::SetPreset(struct Crossfeed::Preset preset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Crossfeed::SetSamplingRate(uint32_t samplingRate) {
|
void Crossfeed::SetSamplingRate(uint32_t samplingRate) {
|
||||||
this->samplerate = samplingRate;
|
if (this->samplingRate != samplingRate) {
|
||||||
Reset();
|
this->samplingRate = samplingRate;
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,28 +12,19 @@ public:
|
|||||||
Crossfeed();
|
Crossfeed();
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
void ProcessFrames(float *buffer, uint32_t size);
|
void ProcessFrames(float *buffer, uint32_t size);
|
||||||
|
|
||||||
void FilterSample(float *sample);
|
void FilterSample(float *sample);
|
||||||
|
|
||||||
uint16_t GetCutoff();
|
uint16_t GetCutoff();
|
||||||
|
|
||||||
float GetFeedback();
|
float GetFeedback();
|
||||||
|
|
||||||
float GetLevelDelay();
|
float GetLevelDelay();
|
||||||
|
|
||||||
struct Preset GetPreset();
|
struct Preset GetPreset();
|
||||||
|
|
||||||
void SetCutoff(uint16_t cutoff);
|
void SetCutoff(uint16_t cutoff);
|
||||||
|
|
||||||
void SetFeedback(float feedback);
|
void SetFeedback(float feedback);
|
||||||
|
|
||||||
void SetPreset(struct Preset preset);
|
void SetPreset(struct Preset preset);
|
||||||
|
|
||||||
void SetSamplingRate(uint32_t samplingRate);
|
void SetSamplingRate(uint32_t samplingRate);
|
||||||
|
|
||||||
uint32_t samplerate;
|
private:
|
||||||
|
uint32_t samplingRate;
|
||||||
float a0_lo, b1_lo;
|
float a0_lo, b1_lo;
|
||||||
float a0_hi, b1_hi, a1_hi;
|
float a0_hi, b1_hi, a1_hi;
|
||||||
float gain;
|
float gain;
|
||||||
|
@ -7,37 +7,21 @@ public:
|
|||||||
IIR_1st();
|
IIR_1st();
|
||||||
|
|
||||||
void Mute();
|
void Mute();
|
||||||
|
|
||||||
void SetCoefficients(float b0, float b1, float a1);
|
void SetCoefficients(float b0, float b1, float a1);
|
||||||
|
|
||||||
void setHPF_A(float frequency, uint32_t samplingRate);
|
void setHPF_A(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setHPF_BW(float frequency, uint32_t samplingRate);
|
void setHPF_BW(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setHPF_C(float frequency, uint32_t samplingRate);
|
void setHPF_C(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setHPFwLPS_A(float frequency, uint32_t samplingRate);
|
void setHPFwLPS_A(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setHSF_A(float f1, float f2, uint32_t samplingRate);
|
void setHSF_A(float f1, float f2, uint32_t samplingRate);
|
||||||
|
|
||||||
void setLPF_A(float frequency, uint32_t samplingRate);
|
void setLPF_A(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setLPF_BW(float frequency, uint32_t samplingRate);
|
void setLPF_BW(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setLPF_C(float frequency, uint32_t samplingRate);
|
void setLPF_C(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setLSF_A(float f1, float f2, uint32_t samplingRate);
|
void setLSF_A(float f1, float f2, uint32_t samplingRate);
|
||||||
|
|
||||||
void setPole(float a1);
|
void setPole(float a1);
|
||||||
|
|
||||||
void setPoleHPF(float frequency, uint32_t samplingRate);
|
void setPoleHPF(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setPoleLPF(float frequency, uint32_t samplingRate);
|
void setPoleLPF(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setZero(float b1);
|
void setZero(float b1);
|
||||||
|
|
||||||
void setZeroHPF(float frequency, uint32_t samplingRate);
|
void setZeroHPF(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setZeroLPF(float frequency, uint32_t samplingRate);
|
void setZeroLPF(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
float b0, b1, a1;
|
float b0, b1, a1;
|
||||||
|
@ -9,11 +9,10 @@ public:
|
|||||||
~IIR_NOrder_BW_LH();
|
~IIR_NOrder_BW_LH();
|
||||||
|
|
||||||
void Mute();
|
void Mute();
|
||||||
|
|
||||||
void setLPF(float frequency, uint32_t samplingRate);
|
void setLPF(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
void setHPF(float frequency, uint32_t samplingRate);
|
void setHPF(float frequency, uint32_t samplingRate);
|
||||||
|
|
||||||
|
|
||||||
IIR_1st *filters;
|
IIR_1st *filters;
|
||||||
uint32_t order;
|
uint32_t order;
|
||||||
};
|
};
|
||||||
|
@ -17,25 +17,6 @@ PassFilter::~PassFilter() {
|
|||||||
delete this->filters[3];
|
delete this->filters[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
void PassFilter::Reset() {
|
|
||||||
uint32_t cutoff;
|
|
||||||
if (this->samplingRate < 44100) {
|
|
||||||
cutoff = this->samplingRate - 100;
|
|
||||||
} else {
|
|
||||||
cutoff = 18000;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->filters[0]->setLPF((float) cutoff, this->samplingRate);
|
|
||||||
this->filters[1]->setLPF((float) cutoff, this->samplingRate);
|
|
||||||
this->filters[2]->setLPF(10.f, cutoff);
|
|
||||||
this->filters[3]->setLPF(10.f, cutoff);
|
|
||||||
|
|
||||||
this->filters[0]->Mute();
|
|
||||||
this->filters[1]->Mute();
|
|
||||||
this->filters[2]->Mute();
|
|
||||||
this->filters[3]->Mute();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PassFilter::ProcessFrames(float *buffer, uint32_t size) {
|
void PassFilter::ProcessFrames(float *buffer, uint32_t size) {
|
||||||
for (uint32_t x = 0; x < size; x++) {
|
for (uint32_t x = 0; x < size; x++) {
|
||||||
float left = buffer[2 * x];
|
float left = buffer[2 * x];
|
||||||
@ -51,7 +32,28 @@ void PassFilter::ProcessFrames(float *buffer, uint32_t size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PassFilter::SetSamplingRate(uint32_t samplingRate) {
|
void PassFilter::Reset() {
|
||||||
this->samplingRate = samplingRate;
|
float cutoff;
|
||||||
Reset();
|
if (this->samplingRate < 44100) {
|
||||||
|
cutoff = (float) this->samplingRate - 100.0f;
|
||||||
|
} else {
|
||||||
|
cutoff = 18000.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->filters[0]->setLPF(cutoff, this->samplingRate);
|
||||||
|
this->filters[1]->setLPF(cutoff, this->samplingRate);
|
||||||
|
this->filters[2]->setHPF(10.0, this->samplingRate);
|
||||||
|
this->filters[3]->setHPF(10.0, this->samplingRate);
|
||||||
|
|
||||||
|
this->filters[0]->Mute();
|
||||||
|
this->filters[1]->Mute();
|
||||||
|
this->filters[2]->Mute();
|
||||||
|
this->filters[3]->Mute();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PassFilter::SetSamplingRate(uint32_t samplingRate) {
|
||||||
|
if (this->samplingRate != samplingRate) {
|
||||||
|
this->samplingRate = samplingRate;
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,13 @@
|
|||||||
class PassFilter {
|
class PassFilter {
|
||||||
public:
|
public:
|
||||||
PassFilter();
|
PassFilter();
|
||||||
|
|
||||||
~PassFilter();
|
~PassFilter();
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
void ProcessFrames(float *buffer, uint32_t size);
|
void ProcessFrames(float *buffer, uint32_t size);
|
||||||
|
|
||||||
void SetSamplingRate(uint32_t samplingRate);
|
void SetSamplingRate(uint32_t samplingRate);
|
||||||
|
|
||||||
|
private:
|
||||||
IIR_NOrder_BW_LH *filters[4];
|
IIR_NOrder_BW_LH *filters[4];
|
||||||
uint32_t samplingRate;
|
uint32_t samplingRate;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user