Improve log header and fix some includes

This commit is contained in:
Iscle
2025-04-03 00:35:10 +02:00
parent 5840621060
commit 8463b73ccc
34 changed files with 246 additions and 192 deletions

View File

@ -1,7 +1,7 @@
#include "ViPER.h"
#include <cstring>
#include <chrono>
#include "constants.h"
#include <constants.h>
#include <log.h>
ViPER::ViPER() :
frameCount(0),
@ -11,8 +11,8 @@ ViPER::ViPER() :
iirFilter(IIRFilter(10)),
gainL(1.0),
gainR(1.0) {
VIPER_LOGI("Welcome to ViPER FX");
VIPER_LOGI("Current version is %d", VIPER_VERSION);
ALOGI("Welcome to ViPER FX");
ALOGI("Current version is %d", VIPER_VERSION);
this->convolver.SetEnable(false);
this->convolver.SetSamplingRate(this->samplingRate);
@ -94,7 +94,7 @@ void ViPER::process(std::vector<float>& buffer, uint32_t size) {
uint32_t tmpBufSize;
if (this->convolver.GetEnabled() || this->vhe.GetEnabled()) {
// VIPER_LOGD("Convolver or VHE is enable, use wave buffer");
// ALOGD("Convolver or VHE is enable, use wave buffer");
if (!this->waveBuffer.PushSamples(buffer.data(), size)) {
this->waveBuffer.Reset();
@ -119,7 +119,7 @@ void ViPER::process(std::vector<float>& buffer, uint32_t size) {
tmpBuf = ptr;
tmpBufSize = ret;
} else {
// VIPER_LOGD("Convolver and VHE are disabled, use adaptive buffer");
// ALOGD("Convolver and VHE are disabled, use adaptive buffer");
if (this->adaptiveBuffer.PushFrames(buffer.data(), size)) {
this->adaptiveBuffer.SetBufferOffset(size);
@ -132,7 +132,7 @@ void ViPER::process(std::vector<float>& buffer, uint32_t size) {
}
}
// VIPER_LOGD("Process buffer size: %d", tmpBufSize);
// ALOGD("Process buffer size: %d", tmpBufSize);
if (tmpBufSize != 0) {
this->viperDdc.Process(tmpBuf, size);
this->spectrumExtend.Process(tmpBuf, size);
@ -175,7 +175,7 @@ void ViPER::process(std::vector<float>& buffer, uint32_t size) {
//void ViPER::DispatchCommand(int param, int val1, int val2, int val3, int val4, uint32_t arrSize,
// signed char *arr) {
// VIPER_LOGD("Dispatch command: %d, %d, %d, %d, %d, %d, %p", param, val1, val2, val3, val4, arrSize, arr);
// ALOGD("Dispatch command: %d, %d, %d, %d, %d, %d, %p", param, val1, val2, val3, val4, arrSize, arr);
// switch (param) {
// case PARAM_SET_RESET_STATUS: {
// this->reset();

View File

@ -1,40 +0,0 @@
#pragma once
#ifdef ANDROID_TOOLCHAIN
#include <android/errno.h>
#else
#include <cerrno>
#endif
#include "../log.h" // TODO: Remove this dependency
enum class Architecture : uint8_t {
UNKNOWN = 0,
ARM,
ARM64,
X86,
X86_64,
};
#if defined(__arm__)
#define VIPER_ARCHITECTURE Architecture::ARM
#elif defined(__aarch64__)
#define VIPER_ARCHITECTURE Architecture::ARM64
#elif defined(__i386__)
#define VIPER_ARCHITECTURE Architecture::X86
#elif defined(__x86_64__)
#define VIPER_ARCHITECTURE Architecture::X86_64
#else
#warning "Unknown architecture"
#define VIPER_ARCHITECTURE Architecture::UNKNOWN
/*
* Note from the developer:
*
* There's no architecture dependent code in ViPER4Android, this is just for debugging purposes.
* Feel free to add your architecture if it's not listed here
*/
#endif
#define VIPER_NAME "ViPER4Android"
#define VIPER_AUTHORS "viper.WYF, Martmists, Iscle"
#define VIPER_DEFAULT_SAMPLING_RATE 44100

View File

@ -1,6 +1,6 @@
#include "AnalogX.h"
#include <cstring>
#include "../constants.h"
#include <constants.h>
static const float ANALOGX_HARMONICS[] = {
0.01f,

View File

@ -1,5 +1,5 @@
#include "ColorfulMusic.h"
#include "../constants.h"
#include <constants.h>
ColorfulMusic::ColorfulMusic() {
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;

View File

@ -1,5 +1,5 @@
#include "Convolver.h"
#include "../constants.h"
#include <constants.h>
#include <cstring>
#include <cstddef>

View File

@ -1,6 +1,6 @@
#include <cstring>
#include "DiffSurround.h"
#include "../constants.h"
#include <constants.h>
DiffSurround::DiffSurround() : buffers({
WaveBuffer(1, 0x1000),

View File

@ -1,5 +1,5 @@
#include "DynamicSystem.h"
#include "../constants.h"
#include <constants.h>
DynamicSystem::DynamicSystem() {
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;

View File

@ -1,6 +1,6 @@
#include <cmath>
#include "FETCompressor.h"
#include "../constants.h"
#include <constants.h>
static const float DEFAULT_FETCOMP_PARAMETERS[] = {
1.000000,

View File

@ -1,7 +1,7 @@
#include <cmath>
#include <cstring>
#include "IIRFilter.h"
#include "../constants.h"
#include <constants.h>
// Iscle: Verified with the latest version at 13/12/2022

View File

@ -1,6 +1,6 @@
#include <cmath>
#include "PlaybackGain.h"
#include "../constants.h"
#include <constants.h>
PlaybackGain::PlaybackGain() {
this->enable = false;

View File

@ -1,5 +1,4 @@
#include "Reverberation.h"
#include "../constants.h"
Reverberation::Reverberation() {
this->model.SetRoomSize(0.0);

View File

@ -1,5 +1,5 @@
#include "SpeakerCorrection.h"
#include "../constants.h"
#include <constants.h>
// Iscle: Verified with the latest version at 13/12/2022

View File

@ -1,5 +1,5 @@
#include "SpectrumExtend.h"
#include "../constants.h"
#include <constants.h>
static const float SPECTRUM_HARMONICS[10] = {
0.02f,

View File

@ -1,5 +1,5 @@
#include "VHE.h"
#include "../constants.h"
#include <constants.h>
#include "VHE_L0.h"
#include "VHE_L1.h"
#include "VHE_L2.h"
@ -48,12 +48,12 @@ void VHE::Reset() {
this->convRight.UnloadKernel();
if (this->effectLevel > 4) {
VIPER_LOGD("Invalid effect level %d", this->effectLevel);
ALOGD("Invalid effect level %d", this->effectLevel);
return;
}
if (this->samplingRate != 44100 && this->samplingRate != 48000) {
VIPER_LOGD("Invalid sampling rate %d", this->samplingRate);
ALOGD("Invalid sampling rate %d", this->samplingRate);
return;
}

View File

@ -1,5 +1,5 @@
#include "ViPERBass.h"
#include "../constants.h"
#include <constants.h>
// Iscle: Verified with the latest version at 13/12/2022

View File

@ -1,5 +1,5 @@
#include "ViPERClarity.h"
#include "../constants.h"
#include <constants.h>
// Iscle: Verified with the latest version at 13/12/2022

View File

@ -1,6 +1,6 @@
#include "ViPERDDC.h"
#include "../../log.h"
#include "../constants.h"
#include <log.h>
#include <constants.h>
#include <cstring>
ViPERDDC::ViPERDDC() :
@ -146,7 +146,7 @@ void ViPERDDC::SetSamplingRate(uint32_t samplingRate) {
if (this->samplingRate != samplingRate) {
this->samplingRate = samplingRate;
if (!isSamplingRateValid()) {
VIPER_LOGE("ViPERDDC::SetSamplingRate() -> Invalid sampling rate: %d", this->samplingRate);
ALOGE("ViPERDDC::SetSamplingRate() -> Invalid sampling rate: %d", this->samplingRate);
}
Reset();
}

View File

@ -1,7 +1,7 @@
#include <cstring>
#include <cmath>
#include "Crossfeed.h"
#include "../constants.h"
#include <constants.h>
// Basically Bauer-to-Stereophonic Binaural filter
// See: http://bs2b.sourceforge.net/

View File

@ -1,6 +1,6 @@
#include "DepthSurround.h"
#include <cmath>
#include "../constants.h"
#include <constants.h>
DepthSurround::DepthSurround() {
this->strength = 0;

View File

@ -1,5 +1,5 @@
#include "DynamicBass.h"
#include "../constants.h"
#include <constants.h>
DynamicBass::DynamicBass() {
this->qPeak = 0;

View File

@ -1,5 +1,5 @@
#include "HiFi.h"
#include "../constants.h"
#include <constants.h>
HiFi::HiFi() {
this->gain = 1.f;

View File

@ -1,5 +1,4 @@
#include "MinPhaseIIRCoeffs.h"
#include "../constants.h"
#include <cmath>
// Iscle: Verified with the latest version at 13/12/2022

View File

@ -1,5 +1,5 @@
#include "NoiseSharpening.h"
#include "../constants.h"
#include <constants.h>
NoiseSharpening::NoiseSharpening() {
this->samplingRate = VIPER_DEFAULT_SAMPLING_RATE;

View File

@ -1,5 +1,5 @@
#include "PassFilter.h"
#include "../constants.h"
#include <constants.h>
PassFilter::PassFilter() : filters({
IIR_NOrder_BW_LH(3),

View File

@ -1,5 +1,5 @@
#include "PolesFilter.h"
#include "../constants.h"
#include <constants.h>
#include <cstring>
#include <cmath>

View File

@ -1,5 +1,5 @@
#include "Polyphase.h"
#include "../constants.h"
#include <constants.h>
static const float POLYPHASE_COEFFICIENTS_2[] = {
-0.002339,

View File

@ -1,5 +1,5 @@
#include "Subwoofer.h"
#include "../constants.h"
#include <constants.h>
#include <cmath>
Subwoofer::Subwoofer() {