Initial commit

This commit is contained in:
Martmists 2021-02-13 15:32:09 +01:00
commit 0f30a35b49
110 changed files with 26030 additions and 0 deletions

15
.gitignore vendored Normal file
View File

@ -0,0 +1,15 @@
# IntelliJ project files
.idea/
out/
gen/
# cmake
cmake-build-debug/
CMakeFiles/
Makefile
cmake_install.cmake
CMakeCache.txt
*.cbp
# build
build/

43
CMakeLists.txt Normal file
View File

@ -0,0 +1,43 @@
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.10.2)
# Declares and names the project.
project("viper")
file(GLOB EFFECTS src/effects/*.cpp)
file(GLOB UTIL src/util/*.cpp)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
libv4a_fx
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main.cpp
src/ProcessUnit_FX.cpp
${EFFECTS}
${UTIL} src/data.h)
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
libv4a_fx)

12
README.md Normal file
View File

@ -0,0 +1,12 @@
# ViPERFX RE
This is a project aimed to reverse-engineer ViPERFX. The version of the shared library used is the armv7 version
taken from the ViPER4Android Magisk apk. It was then imported in Ghidra and analyzed.
There's a lot of code that doesn't quite make sense, and it's important to look at the bytecode if something seems strange.
Liberties may be taken to write equivalent code in a mor readable way.
# Contributing
Feel free to PR in a more "clean" version of various methods, or general project cleanup.
You may rename fields, but ideally this is left until all methods are cleaned.

1942
src/ProcessUnit_FX.cpp Normal file

File diff suppressed because it is too large Load Diff

137
src/ProcessUnit_FX.h Normal file
View File

@ -0,0 +1,137 @@
//
// Created by mart on 2/13/21.
//
#ifndef VIPER_PROCESSUNIT_FX_H
#define VIPER_PROCESSUNIT_FX_H
#include "main.h"
class ProcessUnit_FX {
public:
undefined * * field_0x0;
Effect* field_0x4;
uint samplerate; // Created by retype action
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined4 field_0x14;
undefined4 field_0x18;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
undefined field_0x20;
undefined field_0x21;
undefined field_0x22;
undefined field_0x23;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
undefined field_0x28;
undefined field_0x29;
undefined field_0x2a;
undefined field_0x2b;
undefined field_0x2c;
undefined field_0x2d;
undefined field_0x2e;
undefined field_0x2f;
undefined field_0x30;
undefined field_0x31;
undefined field_0x32;
undefined field_0x33;
undefined4 field_0x34;
undefined4 field_0x38;
undefined field_0x3c;
undefined field_0x3d;
undefined field_0x3e;
undefined field_0x3f;
undefined field_0x40;
undefined field_0x41;
undefined field_0x42;
undefined field_0x43;
undefined field_0x44;
undefined field_0x45;
undefined field_0x46;
undefined field_0x47;
undefined field_0x48;
undefined field_0x49;
undefined field_0x4a;
undefined field_0x4b;
undefined field_0x4c;
undefined field_0x4d;
undefined field_0x4e;
undefined field_0x4f;
undefined field_0x50;
undefined field_0x51;
undefined field_0x52;
undefined field_0x53;
undefined field_0x54;
undefined field_0x55;
undefined field_0x56;
undefined field_0x57;
undefined field_0x58;
undefined field_0x59;
undefined field_0x5a;
undefined field_0x5b;
undefined field_0x5c;
undefined field_0x5d;
undefined field_0x5e;
undefined field_0x5f;
undefined4 field_0x60;
undefined4 field_0x64;
undefined * field_0x68;
undefined field_0x6c;
undefined field_0x6d;
undefined field_0x6e;
undefined field_0x6f;
undefined8 field_0x70;
undefined field_0x78;
undefined field_0x79;
undefined field_0x7a;
undefined field_0x7b;
undefined4 field_0x7c;
AdaptiveBuffer_FPI32 * floatIntBuffer;
WaveBuffer_R32 * waveBuffer;
undefined4 field_0x88;
Convolver;
VHE;
ViPERDDC * vddc;
SpectrumExtend;
IIRFilter;
ColorfulMusic colorful;
Reverberation * reverb;
PlaybackGain;
FETCompressor;
DynamicSystem;
ViPERBass * vbass;
ViPERClarity * vclarity;
DiffSurround;
Cure;
TubeSimulator * tubeSim;
AnalogX;
SpeakerCorrection;
SoftwareLimiter * softLimit1;
SoftwareLimiter * softLimit2;
undefined4 field_0xd8;
undefined4 field_0xdc;
undefined4 field_0xe0;
public:
ProcessUnit_FX();
~ProcessUnit_FX();
void ResetAllEffects();
void DispatchCommand(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6,signed *param_7);
int processBuffer(short *param_1,int param_2);
int command(uint param_1,uint param_2,void *param_3,uint *param_4,void *param_5);
};
#endif //VIPER_PROCESSUNIT_FX_H

23
src/data.h Normal file
View File

@ -0,0 +1,23 @@
//
// Created by mart on 2/13/21.
//
#ifndef VIPER_DATA_H
#define VIPER_DATA_H
#include "util/misc.h"
// TODO: Unsure if these should be BE/LE
const effect_descriptor_t DAT_000d126c = {
effect_uuid_t { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
effect_uuid_t { 0x87C9D341, 0xCFE6, 0xE311, 0x8AA8, 0x11, 0xAB, 0xA5, 0xD5, 0xC5, 0x1B },
0x20000,
0x10f00000,
8,
1,
"ViPER4Android [2.5.0.4]",
"ViPER.WYF"
};
#endif //VIPER_DATA_H

195
src/effects/AnalogX.cpp Normal file
View File

@ -0,0 +1,195 @@
//
// Created by mart on 2/12/21.
//
#include "AnalogX.h"
// AnalogX::Reset()
void AnalogX::Reset() {
int iVar1;
Harmonic *this_00;
Harmonic *this_01;
float in_s0;
float in_s1;
undefined8 uVar2;
float in_s2;
float extraout_s2;
float extraout_s2_00;
float extraout_s2_01;
float extraout_s2_02;
float extraout_s2_03;
float extraout_s2_04;
float extraout_s2_05;
float extraout_s2_06;
float extraout_s2_07;
float in_s3;
float extraout_s3;
float extraout_s3_00;
float extraout_s3_01;
float extraout_s3_02;
float extraout_s3_03;
float extraout_s3_04;
float extraout_s3_05;
float extraout_s3_06;
float extraout_s3_07;
this_01 = &this->field_0x48;
this_00 = &this->field_0x84;
uVar2 = MultiBiquad::RefreshFilter((MultiBiquad *)this,1,in_s0,in_s1,in_s2,in_s3,false);
uVar2 = MultiBiquad::RefreshFilter
(&this->field_0x24,1,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),extraout_s2,
extraout_s3,false);
uVar2 = MultiBiquad::RefreshFilter
(&this->field_0x108,5,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),
extraout_s2_00,extraout_s3_00,true);
MultiBiquad::RefreshFilter
(&this->field_0x12c,5,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),extraout_s2_01,
extraout_s3_01,true);
Harmonic::Reset(this_01);
Harmonic::Reset(this_00);
iVar1 = this->processingModel;
if (iVar1 == 1) {
Harmonic::SetHarmonics(this_01,(float *)&DAT_000ce8dc);
uVar2 = Harmonic::SetHarmonics(this_00,(float *)&DAT_000ce8dc);
*(undefined4 *)&this->field_0x150 = 0x266594b;
uVar2 = MultiBiquad::RefreshFilter
(&this->field_0xc0,0,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),
extraout_s2_06,extraout_s3_06,false);
MultiBiquad::RefreshFilter
(&this->field_0xe4,0,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),extraout_s2_07,
extraout_s3_07,false);
this->field_0x154 = 0;
return;
}
if (iVar1 != 2) {
if (iVar1 != 0) {
this->field_0x154 = 0;
return;
}
Harmonic::SetHarmonics(this_01,(float *)&DAT_000ce8b4);
uVar2 = Harmonic::SetHarmonics(this_00,(float *)&DAT_000ce8b4);
*(undefined4 *)&this->field_0x150 = 0x1332618;
uVar2 = MultiBiquad::RefreshFilter
(&this->field_0xc0,0,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),
extraout_s2_02,extraout_s3_02,false);
MultiBiquad::RefreshFilter
(&this->field_0xe4,0,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),extraout_s2_03,
extraout_s3_03,false);
this->field_0x154 = 0;
return;
}
Harmonic::SetHarmonics(this_01,(float *)&DAT_000ce904);
uVar2 = Harmonic::SetHarmonics(this_00,(float *)&DAT_000ce904);
*(undefined4 *)&this->field_0x150 = 0x4ccbfb1;
uVar2 = MultiBiquad::RefreshFilter
(&this->field_0xc0,0,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),
extraout_s2_04,extraout_s3_04,false);
MultiBiquad::RefreshFilter
(&this->field_0xe4,0,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),extraout_s2_05,
extraout_s3_05,false);
this->field_0x154 = 0;
return;
}
// AnalogX::AnalogX()
AnalogX::AnalogX() {
MultiBiquad::MultiBiquad((MultiBiquad *)this);
MultiBiquad::MultiBiquad(&this->field_0x24);
Harmonic::Harmonic(&this->field_0x48);
Harmonic::Harmonic(&this->field_0x84);
MultiBiquad::MultiBiquad(&this->field_0xc0);
MultiBiquad::MultiBiquad(&this->field_0xe4);
MultiBiquad::MultiBiquad(&this->field_0x108);
MultiBiquad::MultiBiquad(&this->field_0x12c);
this->samplerate = 0xac44;
this->processingModel = 0;
this->enabled = false;
Reset(this);
return this;
}
// AnalogX::SetSamplingRate(unsigned int)
void AnalogX::SetSamplingRate(uint param_1) {
if (this->samplerate == param_1) {
return;
}
this->samplerate = param_1;
Reset(this);
return;
}
// AnalogX::SetProcessingModel(int)
void AnalogX::SetProcessingModel(int param_1) {
if (this->processingModel == param_1) {
return;
}
this->processingModel = param_1;
Reset(this);
return;
}
// AnalogX::Process(int*, int)
void AnalogX::Process(int *param_1,int param_2) {
ulonglong uVar1;
longlong lVar2;
int iVar3;
int *piVar4;
int iVar5;
int iVar6;
undefined8 uVar7;
int local_58;
if (this->enabled != false) {
if (0 < param_2 * 2) {
iVar5 = 0;
piVar4 = param_1;
do {
iVar6 = *piVar4;
iVar5 = iVar5 + 2;
iVar3 = MultiBiquad::ProcessSample((MultiBiquad *)this,iVar6);
iVar3 = Harmonic::Process(&this->field_0x48,iVar3);
uVar1 = (longlong)iVar3 * (longlong)*(int *)&this->field_0x150 + 0x1000000;
uVar7 = VectorShiftRight((uVar1 & 0xffffffff00000000) + (uVar1 & 0xffffffff),0x19);
local_58 = (int)uVar7;
iVar3 = MultiBiquad::ProcessSample(&this->field_0xc0,iVar6 + local_58);
lVar2 = (longlong)iVar3 * 0x1998c7e + 0x1000000;
iVar3 = MultiBiquad::ProcessSample
(&this->field_0x108,
(uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
iVar6 = piVar4[1];
*piVar4 = iVar3;
iVar3 = MultiBiquad::ProcessSample(&this->field_0x24,iVar6);
iVar3 = Harmonic::Process(&this->field_0x84,iVar3);
uVar1 = (longlong)iVar3 * (longlong)*(int *)&this->field_0x150 + 0x1000000;
uVar7 = VectorShiftRight((uVar1 & 0xffffffff00000000) + (uVar1 & 0xffffffff),0x19);
local_58 = (int)uVar7;
iVar3 = MultiBiquad::ProcessSample(&this->field_0xe4,iVar6 + local_58);
lVar2 = (longlong)iVar3 * 0x1998c7e + 0x1000000;
iVar3 = MultiBiquad::ProcessSample
(&this->field_0x12c,
(uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
piVar4[1] = iVar3;
piVar4 = piVar4 + 2;
} while (iVar5 + param_2 * -2 < 0 != SBORROW4(iVar5,param_2 * 2));
}
if (this->field_0x154 < (int)((uint)this->samplerate >> 2)) {
this->field_0x154 = param_2 + this->field_0x154;
memset(param_1,0,param_2 << 3);
return;
}
}
return;
}

39
src/effects/AnalogX.h Normal file
View File

@ -0,0 +1,39 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_ANALOGX_H
#define VIPER_ANALOGX_H
class AnalogX {
struct MultiBiquad field_0x0;
struct MultiBiquad field_0x24;
struct Harmonic field_0x48;
struct Harmonic field_0x84;
struct MultiBiquad field_0xc0;
struct MultiBiquad field_0xe4;
struct MultiBiquad field_0x108;
struct MultiBiquad field_0x12c;
undefined field_0x150;
undefined field_0x151;
undefined field_0x152;
undefined field_0x153;
int field_0x154;
undefined4 processingModel;
int samplerate; // Created by retype action
bool enabled; // Created by retype action
undefined field_0x161;
undefined field_0x162;
undefined field_0x163;
public:
void Reset();
AnalogX();
void SetSamplingRate(uint param_1);
void SetProcessingModel(int param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_ANALOGX_H

View File

@ -0,0 +1,102 @@
//
// Created by mart on 2/12/21.
//
#include "ColorfulMusic.h"
// ColorfulMusic::ColorfulMusic()
ColorfulMusic::ColorfulMusic() {
DepthSurround *this_00;
float fVar1;
this_00 = (DepthSurround *)&this->field_0x18;
Stereo3DSurround::Stereo3DSurround((Stereo3DSurround *)this);
fVar1 = (float)DepthSurround::DepthSurround(this_00);
*(undefined4 *)&this->field_0x64 = 0xac44;
*(undefined *)&this->field_0x68 = 0;
Stereo3DSurround::SetStereoWiden((Stereo3DSurround *)this,fVar1);
DepthSurround::SetSamplingRate((uint)this_00);
DepthSurround::SetStrength(this_00,0);
return this;
}
// ColorfulMusic::SetSamplingRate(unsigned int)
void ColorfulMusic::SetSamplingRate(uint param_1) {
if (*(uint *)&this->field_0x64 == param_1) {
return;
}
*(uint *)&this->field_0x64 = param_1;
DepthSurround::SetSamplingRate(&this->field_0x18);
return;
}
float ColorfulMusic::setStereoWidenValue(float param_1) {
// TODO: S3DS call
}
float ColorfulMusic::setMidImageValue(float param_1) {
// TODO: S3DS call
}
// ColorfulMusic::SetDepthValue(short)
void ColorfulMusic::SetDepthValue(short param_1) {
DepthSurround::SetStrength((DepthSurround *)&this->field_0x18,param_1);
return;
}
// ColorfulMusic::Reset()
void ColorfulMusic::Reset() {
DepthSurround::SetSamplingRate(&this->field_0x18);
return;
}
// ColorfulMusic::SetEnable(bool)
undefined4 ColorfulMusic::SetEnable(bool param_1) {
char cVar1;
cVar1 = *(char *)&this->field_0x68;
if (cVar1 == '\0') {
if (param_1 == false) {
return 0;
}
Reset(this);
cVar1 = *(char *)&this->field_0x68;
}
if (param_1 == (bool)cVar1) {
return 0;
}
*(bool *)&this->field_0x68 = param_1;
return 1;
}
// ColorfulMusic::Process(int*, int)
void ColorfulMusic::Process(int *param_1,int param_2) {
if (*(char *)&this->field_0x68 == '\0') {
return;
}
DepthSurround::Process((DepthSurround *)&this->field_0x18,param_1,param_2);
Stereo3DSurround::Process((Stereo3DSurround *)this,param_1,param_2);
return;
}

133
src/effects/ColorfulMusic.h Normal file
View File

@ -0,0 +1,133 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_COLORFULMUSIC_H
#define VIPER_COLORFULMUSIC_H
#include "Stereo3DSurround.h"
class ColorfulMusic {
undefined field_0x0;
undefined field_0x1;
undefined field_0x2;
undefined field_0x3;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
undefined field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined field_0x18;
undefined field_0x19;
undefined field_0x1a;
undefined field_0x1b;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
undefined field_0x20;
undefined field_0x21;
undefined field_0x22;
undefined field_0x23;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
undefined field_0x28;
undefined field_0x29;
undefined field_0x2a;
undefined field_0x2b;
undefined field_0x2c;
undefined field_0x2d;
undefined field_0x2e;
undefined field_0x2f;
undefined field_0x30;
undefined field_0x31;
undefined field_0x32;
undefined field_0x33;
undefined field_0x34;
undefined field_0x35;
undefined field_0x36;
undefined field_0x37;
undefined field_0x38;
undefined field_0x39;
undefined field_0x3a;
undefined field_0x3b;
undefined field_0x3c;
undefined field_0x3d;
undefined field_0x3e;
undefined field_0x3f;
undefined field_0x40;
undefined field_0x41;
undefined field_0x42;
undefined field_0x43;
undefined field_0x44;
undefined field_0x45;
undefined field_0x46;
undefined field_0x47;
undefined field_0x48;
undefined field_0x49;
undefined field_0x4a;
undefined field_0x4b;
undefined field_0x4c;
undefined field_0x4d;
undefined field_0x4e;
undefined field_0x4f;
undefined field_0x50;
undefined field_0x51;
undefined field_0x52;
undefined field_0x53;
undefined field_0x54;
undefined field_0x55;
undefined field_0x56;
undefined field_0x57;
undefined field_0x58;
undefined field_0x59;
undefined field_0x5a;
undefined field_0x5b;
undefined field_0x5c;
undefined field_0x5d;
undefined field_0x5e;
undefined field_0x5f;
undefined field_0x60;
undefined field_0x61;
undefined field_0x62;
undefined field_0x63;
undefined field_0x64;
undefined field_0x65;
undefined field_0x66;
undefined field_0x67;
undefined field_0x68;
undefined field_0x69;
undefined field_0x6a;
undefined field_0x6b;
public:
ColorfulMusic();
void SetSamplingRate(uint param_1);
void SetDepthValue(short param_1);
void Reset();
float setMidImageValue(float param_1);
float setStereoWidenValue(float param_1);
undefined4 SetEnable(bool param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_COLORFULMUSIC_H

1035
src/effects/Convolver.cpp Normal file

File diff suppressed because it is too large Load Diff

401
src/effects/Convolver.h Normal file
View File

@ -0,0 +1,401 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_CONVOLVER_H
#define VIPER_CONVOLVER_H
class Convolver {
undefined field_0x0;
undefined field_0x1;
undefined field_0x2;
undefined field_0x3;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
undefined field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined field_0x18;
undefined field_0x19;
undefined field_0x1a;
undefined field_0x1b;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
undefined field_0x20;
undefined field_0x21;
undefined field_0x22;
undefined field_0x23;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
undefined field_0x28;
undefined field_0x29;
undefined field_0x2a;
undefined field_0x2b;
undefined field_0x2c;
undefined field_0x2d;
undefined field_0x2e;
undefined field_0x2f;
undefined field_0x30;
undefined field_0x31;
undefined field_0x32;
undefined field_0x33;
undefined field_0x34;
undefined field_0x35;
undefined field_0x36;
undefined field_0x37;
undefined field_0x38;
undefined field_0x39;
undefined field_0x3a;
undefined field_0x3b;
undefined field_0x3c;
undefined field_0x3d;
undefined field_0x3e;
undefined field_0x3f;
undefined field_0x40;
undefined field_0x41;
undefined field_0x42;
undefined field_0x43;
undefined field_0x44;
undefined field_0x45;
undefined field_0x46;
undefined field_0x47;
undefined field_0x48;
undefined field_0x49;
undefined field_0x4a;
undefined field_0x4b;
undefined field_0x4c;
undefined field_0x4d;
undefined field_0x4e;
undefined field_0x4f;
undefined field_0x50;
undefined field_0x51;
undefined field_0x52;
undefined field_0x53;
undefined field_0x54;
undefined field_0x55;
undefined field_0x56;
undefined field_0x57;
undefined field_0x58;
undefined field_0x59;
undefined field_0x5a;
undefined field_0x5b;
undefined field_0x5c;
undefined field_0x5d;
undefined field_0x5e;
undefined field_0x5f;
undefined field_0x60;
undefined field_0x61;
undefined field_0x62;
undefined field_0x63;
undefined field_0x64;
undefined field_0x65;
undefined field_0x66;
undefined field_0x67;
undefined field_0x68;
undefined field_0x69;
undefined field_0x6a;
undefined field_0x6b;
undefined field_0x6c;
undefined field_0x6d;
undefined field_0x6e;
undefined field_0x6f;
undefined field_0x70;
undefined field_0x71;
undefined field_0x72;
undefined field_0x73;
undefined field_0x74;
undefined field_0x75;
undefined field_0x76;
undefined field_0x77;
undefined field_0x78;
undefined field_0x79;
undefined field_0x7a;
undefined field_0x7b;
undefined field_0x7c;
undefined field_0x7d;
undefined field_0x7e;
undefined field_0x7f;
undefined field_0x80;
undefined field_0x81;
undefined field_0x82;
undefined field_0x83;
undefined field_0x84;
undefined field_0x85;
undefined field_0x86;
undefined field_0x87;
undefined field_0x88;
undefined field_0x89;
undefined field_0x8a;
undefined field_0x8b;
undefined field_0x8c;
undefined field_0x8d;
undefined field_0x8e;
undefined field_0x8f;
undefined field_0x90;
undefined field_0x91;
undefined field_0x92;
undefined field_0x93;
undefined field_0x94;
undefined field_0x95;
undefined field_0x96;
undefined field_0x97;
undefined field_0x98;
undefined field_0x99;
undefined field_0x9a;
undefined field_0x9b;
undefined field_0x9c;
undefined field_0x9d;
undefined field_0x9e;
undefined field_0x9f;
undefined field_0xa0;
undefined field_0xa1;
undefined field_0xa2;
undefined field_0xa3;
undefined field_0xa4;
undefined field_0xa5;
undefined field_0xa6;
undefined field_0xa7;
undefined field_0xa8;
undefined field_0xa9;
undefined field_0xaa;
undefined field_0xab;
undefined field_0xac;
undefined field_0xad;
undefined field_0xae;
undefined field_0xaf;
undefined field_0xb0;
undefined field_0xb1;
undefined field_0xb2;
undefined field_0xb3;
undefined field_0xb4;
undefined field_0xb5;
undefined field_0xb6;
undefined field_0xb7;
undefined field_0xb8;
undefined field_0xb9;
undefined field_0xba;
undefined field_0xbb;
undefined field_0xbc;
undefined field_0xbd;
undefined field_0xbe;
undefined field_0xbf;
undefined field_0xc0;
undefined field_0xc1;
undefined field_0xc2;
undefined field_0xc3;
undefined field_0xc4;
undefined field_0xc5;
undefined field_0xc6;
undefined field_0xc7;
undefined field_0xc8;
undefined field_0xc9;
undefined field_0xca;
undefined field_0xcb;
undefined field_0xcc;
undefined field_0xcd;
undefined field_0xce;
undefined field_0xcf;
undefined field_0xd0;
undefined field_0xd1;
undefined field_0xd2;
undefined field_0xd3;
undefined field_0xd4;
undefined field_0xd5;
undefined field_0xd6;
undefined field_0xd7;
undefined field_0xd8;
undefined field_0xd9;
undefined field_0xda;
undefined field_0xdb;
undefined field_0xdc;
undefined field_0xdd;
undefined field_0xde;
undefined field_0xdf;
undefined field_0xe0;
undefined field_0xe1;
undefined field_0xe2;
undefined field_0xe3;
undefined field_0xe4;
undefined field_0xe5;
undefined field_0xe6;
undefined field_0xe7;
undefined field_0xe8;
undefined field_0xe9;
undefined field_0xea;
undefined field_0xeb;
undefined field_0xec;
undefined field_0xed;
undefined field_0xee;
undefined field_0xef;
undefined field_0xf0;
undefined field_0xf1;
undefined field_0xf2;
undefined field_0xf3;
undefined field_0xf4;
undefined field_0xf5;
undefined field_0xf6;
undefined field_0xf7;
undefined field_0xf8;
undefined field_0xf9;
undefined field_0xfa;
undefined field_0xfb;
undefined field_0xfc;
undefined field_0xfd;
undefined field_0xfe;
undefined field_0xff;
undefined field_0x100;
undefined field_0x101;
undefined field_0x102;
undefined field_0x103;
undefined field_0x104;
undefined field_0x105;
undefined field_0x106;
undefined field_0x107;
undefined field_0x108;
undefined field_0x109;
undefined field_0x10a;
undefined field_0x10b;
undefined field_0x10c;
undefined field_0x10d;
undefined field_0x10e;
undefined field_0x10f;
undefined field_0x110;
undefined field_0x111;
undefined field_0x112;
undefined field_0x113;
undefined field_0x114;
undefined field_0x115;
undefined field_0x116;
undefined field_0x117;
undefined field_0x118;
undefined field_0x119;
undefined field_0x11a;
undefined field_0x11b;
undefined field_0x11c;
undefined field_0x11d;
undefined field_0x11e;
undefined field_0x11f;
undefined field_0x120;
undefined field_0x121;
undefined field_0x122;
undefined field_0x123;
undefined field_0x124;
undefined field_0x125;
undefined field_0x126;
undefined field_0x127;
undefined field_0x128;
undefined field_0x129;
undefined field_0x12a;
undefined field_0x12b;
undefined field_0x12c;
undefined field_0x12d;
undefined field_0x12e;
undefined field_0x12f;
undefined field_0x130;
undefined field_0x131;
undefined field_0x132;
undefined field_0x133;
undefined field_0x134;
undefined field_0x135;
undefined field_0x136;
undefined field_0x137;
undefined field_0x138;
undefined field_0x139;
undefined field_0x13a;
undefined field_0x13b;
undefined field_0x13c;
undefined field_0x13d;
undefined field_0x13e;
undefined field_0x13f;
undefined field_0x140;
undefined field_0x141;
undefined field_0x142;
undefined field_0x143;
undefined field_0x144;
undefined field_0x145;
undefined field_0x146;
undefined field_0x147;
undefined field_0x148;
undefined field_0x149;
undefined field_0x14a;
undefined field_0x14b;
undefined field_0x14c;
undefined field_0x14d;
undefined field_0x14e;
undefined field_0x14f;
undefined field_0x150;
undefined field_0x151;
undefined field_0x152;
undefined field_0x153;
undefined field_0x154;
undefined field_0x155;
undefined field_0x156;
undefined field_0x157;
undefined field_0x158;
undefined field_0x159;
undefined field_0x15a;
undefined field_0x15b;
undefined field_0x15c;
undefined field_0x15d;
undefined field_0x15e;
undefined field_0x15f;
undefined field_0x160;
undefined field_0x161;
undefined field_0x162;
undefined field_0x163;
undefined field_0x164;
undefined field_0x165;
undefined field_0x166;
undefined field_0x167;
undefined field_0x168;
undefined field_0x169;
undefined field_0x16a;
undefined field_0x16b;
undefined field_0x16c;
undefined field_0x16d;
undefined field_0x16e;
undefined field_0x16f;
undefined field_0x170;
undefined field_0x171;
undefined field_0x172;
undefined field_0x173;
public:
Convolver();
~Convolver();
undefined GetEnabled();
void SetSamplingRate(uint param_1);
void PrepareKernelBuffer(uint param_1,uint param_2,int param_3);
void SetKernelBuffer(uint param_1,float *param_2,uint param_3);
undefined4 GetKernelID();
void SetCrossChannel(float param_1);
void Reset();
undefined4 SetEnable(bool param_1);
void SetKernel(float *param_1,uint param_2);
void SetKernelStereo(float *param_1,float *param_2,uint param_3);
void SetKernel(char *param_1);
void CommitKernelBuffer(uint param_1,uint param_2,uint param_3);
int Process(float *param_1,float *param_2,int param_3);
};
#endif //VIPER_CONVOLVER_H

131
src/effects/Cure.cpp Normal file
View File

@ -0,0 +1,131 @@
//
// Created by mart on 2/13/21.
//
#include "Cure.h"
// Cure::~Cure()
Cure::~Cure() {
PassFilter::~PassFilter(&this->field_0x38);
Crossfeed::~Crossfeed((Crossfeed *)this);
return this;
}
// Cure::Reset()
void Cure::Reset() {
Crossfeed::Reset((Crossfeed *)this);
PassFilter::Reset();
return;
}
// Cure::Cure()
Cure::Cure() {
Crossfeed::Crossfeed((Crossfeed *)this);
PassFilter::PassFilter(&this->field_0x38);
this->enabled = false;
Reset(this);
return this;
}
// Cure::SetEnable(bool)
undefined4 Cure::SetEnable(bool param_1) {
if (this->enabled != param_1) {
Reset(this);
this->enabled = param_1;
return 1;
}
return 0;
}
// Cure::SetSamplingRate(int)
void Cure::SetSamplingRate(int param_1) {
Crossfeed::SetSamplingRate((Crossfeed *)this,param_1);
PassFilter::SetSamplingRate(&this->field_0x38,param_1);
return;
}
void Cure::~ZN4Cure9SetCutoffEi(int param_1) {
SetPreset(this,param_1 | (uint)(ushort)this->feedback << 0x10);
return;
}
void Cure::~ZN4Cure11SetFeedbackEf(float param_1) {
undefined4 in_cr7;
coprocessor_function(10,6,1,in_cr7,in_cr7,in_cr7);
SetPreset(this,(uint)(ushort)this->cutoff);
return;
}
void Cure::~ZN4Cure9SetPresetEj(uint param_1) {
*(uint *)&this->cutoff = param_1;
Reset(this);
return;
}
short Cure::~ZN4Cure9GetCutoffEv() {
return this->cutoff;
}
float Cure::~ZN4Cure11GetFeedbackEv() {
return (float)(longlong)(int)(uint)(ushort)this->feedback / 10.0;
}
float Cure::~ZN4Cure13GetLevelDelayEv() {
int iVar1;
undefined4 in_cr7;
float fVar2;
iVar1 = GetCutoff(this);
if (iVar1 - 300U < 0x6a5) {
fVar2 = 18700.0 / (float)(longlong)iVar1;
coprocessor_function(10,6,4,in_cr7,in_cr7,in_cr7);
}
else {
fVar2 = 0.0;
}
return fVar2;
}
undefined4 Cure::~ZN4Cure9GetPresetEv() {
return *(undefined4 *)&this->cutoff;
}
// Cure::Process(int*, int)
void Cure::Process(int *param_1,int param_2) {
if (this->enabled == false) {
return;
}
Crossfeed::ProcessFrames((Crossfeed *)this,param_1,param_2);
PassFilter::ProcessFrames(&this->field_0x38,param_1,param_2);
return;
}

34
src/effects/Cure.h Normal file
View File

@ -0,0 +1,34 @@
//
// Created by mart on 2/13/21.
//
#ifndef VIPER_CURE_H
#define VIPER_CURE_H
class Cure {
struct Crossfeed field_0x0;
struct PassFilter field_0x38;
bool enabled; // Created by retype action
undefined field_0x4d;
undefined field_0x4e;
undefined field_0x4f;
public:
~Cure();
void Reset();
Cure();
undefined4 SetEnable(bool param_1);
void SetSamplingRate(int param_1);
void ~ZN4Cure9SetCutoffEi(int param_1);
void ~ZN4Cure11SetFeedbackEf(float param_1);
void ~ZN4Cure9SetPresetEj(uint param_1);
short ~ZN4Cure9GetCutoffEv();
float ~ZN4Cure11GetFeedbackEv();
float ~ZN4Cure13GetLevelDelayEv();
undefined4 ~ZN4Cure9GetPresetEv();
void Process(int *param_1,int param_2);
};
#endif //VIPER_CURE_H

View File

@ -0,0 +1,178 @@
//
// Created by mart on 2/12/21.
//
#include "DepthSurround.h"
// DepthSurround::RefreshStrength(short)
void DepthSurround::RefreshStrength(short param_1) {
undefined4 uVar1;
uint uVar2;
undefined4 extraout_r1;
uint uVar3;
short sVar4;
undefined4 unaff_r4;
undefined4 unaff_r5;
undefined4 unaff_r6;
undefined4 in_lr;
undefined4 in_cr0;
undefined4 in_cr1;
double dVar5;
longlong lVar6;
sVar4 = param_1;
if (param_1 != 0) {
sVar4 = 1;
}
this[3] = (DepthSurround)(499 < param_1);
this[2] = SUB21(sVar4,0);
if (sVar4 != 0) {
uVar1 = 0;
dVar5 = pow((double)CONCAT44(unaff_r5,unaff_r4),(double)CONCAT44(in_lr,unaff_r6));
coprocessor_function(0xb,6,5,in_cr1,in_cr1,in_cr0);
lVar6 = __fixdfdi(SUB84(dVar5,0),uVar1,extraout_r1);
uVar3 = (uint)((ulonglong)lVar6 >> 0x20);
uVar2 = (uint)lVar6;
if (0 < (int)(uVar3 + (uVar2 >= 0x80000000)) !=
(lVar6 < 0 && (int)(~uVar3 + (uint)(uVar2 < 0x80000000)) < 0)) {
uVar2 = 0x7fffffff;
}
*(uint *)(this + 4) = uVar2;
return;
}
*(undefined4 *)(this + 4) = 0;
return;
}
// DepthSurround::SetSamplingRate(unsigned int)
void DepthSurround::SetSamplingRate(uint param_1) {
uint in_r1;
float in_s0;
float fVar1;
undefined8 uVar2;
float extraout_s2;
float extraout_s3;
float extraout_s4;
fVar1 = (float)TimeConstDelay::SetParameters
((TimeConstDelay *)(param_1 + 0x10),(uint)ROUND((float)(ulonglong)in_r1),
in_s0);
uVar2 = TimeConstDelay::SetParameters
((TimeConstDelay *)(param_1 + 0x1c),(uint)ROUND((float)(ulonglong)in_r1),fVar1);
FixedBiquad::SetHighPassParameter
((FixedBiquad *)(param_1 + 0x28),(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),
extraout_s2,extraout_s3,extraout_s4);
*(undefined4 *)(param_1 + 8) = 0;
*(undefined4 *)(param_1 + 0xc) = 0;
return;
}
// DepthSurround::DepthSurround()
DepthSurround::DepthSurround() {
TimeConstDelay::TimeConstDelay((TimeConstDelay *)(this + 0x10));
TimeConstDelay::TimeConstDelay((TimeConstDelay *)(this + 0x1c));
FixedBiquad::FixedBiquad((FixedBiquad *)(this + 0x28));
*(undefined2 *)this = 0;
this[2] = (DepthSurround)0x0;
this[3] = (DepthSurround)0x0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
*(undefined4 *)(this + 0xc) = 0;
SetSamplingRate((uint)this);
RefreshStrength(this,*(short *)this);
return this;
}
// DepthSurround::SetStrength(short)
void DepthSurround::SetStrength(short param_1) {
*(short *)this = param_1;
RefreshStrength(this,param_1);
return;
}
// DepthSurround::Process(int*, int)
void DepthSurround::Process(int *param_1,int param_2) {
int iVar1;
int iVar2;
int iVar3;
int iVar4;
int iVar5;
int *piVar6;
uint uVar7;
undefined8 uVar8;
int local_48;
int local_40;
if (this[2] != (DepthSurround)0x0) {
uVar7 = (uint)(byte)this[3];
if (uVar7 == 0) {
if (0 < param_2) {
piVar6 = param_1 + 1;
do {
iVar3 = piVar6[-1];
uVar7 = uVar7 + 1;
iVar4 = param_1[1];
iVar1 = TimeConstDelay::ProcessSample((int)(this + 0x10));
iVar2 = TimeConstDelay::ProcessSample((int)(this + 0x1c));
uVar8 = VectorShiftRight((longlong)*(int *)(this + 4) * (longlong)iVar2 + 0x1000000,0x19);
local_48 = (int)uVar8;
uVar8 = VectorShiftRight((longlong)iVar1 * (longlong)*(int *)(this + 4) + 0x1000000,0x19);
*(int *)(this + 0xc) = local_48;
local_40 = (int)uVar8;
*(int *)(this + 8) = local_40;
iVar1 = (iVar3 + local_40) - (iVar4 + local_48) >> 1;
iVar2 = iVar3 + local_40 + iVar4 + local_48 >> 1;
iVar3 = FixedBiquad::ProcessSample((FixedBiquad *)(this + 0x28),iVar1);
iVar1 = iVar1 - iVar3;
piVar6[-1] = iVar2 + iVar1;
param_1[1] = iVar2 - iVar1;
param_1 = param_1 + 2;
piVar6 = piVar6 + 2;
} while (uVar7 != param_2);
}
}
else {
if (0 < param_2) {
iVar1 = 0;
piVar6 = param_1 + 1;
do {
iVar4 = piVar6[-1];
iVar1 = iVar1 + 1;
iVar5 = param_1[1];
iVar2 = TimeConstDelay::ProcessSample((int)(this + 0x10));
iVar3 = TimeConstDelay::ProcessSample((int)(this + 0x1c));
uVar8 = VectorShiftRight((longlong)*(int *)(this + 4) * (longlong)-iVar3 + 0x1000000,0x19)
;
local_48 = (int)uVar8;
uVar8 = VectorShiftRight((longlong)iVar2 * (longlong)*(int *)(this + 4) + 0x1000000,0x19);
*(int *)(this + 0xc) = local_48;
local_40 = (int)uVar8;
*(int *)(this + 8) = local_40;
iVar2 = (iVar4 + local_40) - (iVar5 + local_48) >> 1;
iVar3 = iVar4 + local_40 + iVar5 + local_48 >> 1;
iVar4 = FixedBiquad::ProcessSample((FixedBiquad *)(this + 0x28),iVar2);
iVar2 = iVar2 - iVar4;
piVar6[-1] = iVar3 + iVar2;
param_1[1] = iVar3 - iVar2;
param_1 = param_1 + 2;
piVar6 = piVar6 + 2;
} while (iVar1 != param_2);
return;
}
}
}
return;
}

View File

@ -0,0 +1,31 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_DEPTHSURROUND_H
#define VIPER_DEPTHSURROUND_H
#include "Stereo3DSurround.h"
class DepthSurround {
short field_0x0;
bool enabled;
undefined field_0x3;
int field_0x4;
int field_0x8;
int field_0xc;
struct TimeConstDelay field_0x10;
struct TimeConstDelay field_0x1c;
struct FixedBiquad field_0x28;
public:
void RefreshStrength(short param_1);
void SetSamplingRate(uint param_1);
DepthSurround();
void SetStrength(short param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_DEPTHSURROUND_H

View File

@ -0,0 +1,179 @@
//
// Created by mart on 2/12/21.
//
#include "DiffSurround.h"
// DiffSurround::~DiffSurround()
DiffSurround::~DiffSurround() {
WaveBuffer_I32 *pWVar1;
pWVar1 = *(WaveBuffer_I32 **)&this->field_0xc;
*(undefined4 *)&this->field_0x8 = 0;
if (pWVar1 != nullptr) {
WaveBuffer_I32::~WaveBuffer_I32(pWVar1);
operator_delete(pWVar1);
}
pWVar1 = *(WaveBuffer_I32 **)&this->field_0x10;
*(undefined4 *)&this->field_0xc = 0;
if (pWVar1 != nullptr) {
WaveBuffer_I32::~WaveBuffer_I32(pWVar1);
operator_delete(pWVar1);
}
*(undefined4 *)&this->field_0x10 = 0;
return this;
}
// DiffSurround::Reset()
void DiffSurround::Reset() {
undefined4 in_cr0;
undefined4 in_cr1;
if (*(WaveBuffer_I32 **)&this->field_0xc == nullptr) {
return;
}
if (*(int *)&this->field_0x10 == 0) {
return;
}
WaveBuffer_I32::Reset(*(WaveBuffer_I32 **)&this->field_0xc);
WaveBuffer_I32::Reset(*(WaveBuffer_I32 **)&this->field_0x10);
coprocessor_function(0xb,6,5,in_cr0,in_cr1,in_cr0);
WaveBuffer_I32::PushZeros
(*(WaveBuffer_I32 **)&this->field_0x10,SUB84(ROUND((double)(ulonglong)*(uint *)this),0))
;
return;
}
// DiffSurround::DiffSurround()
DiffSurround::DiffSurround() {
WaveBuffer_I32 *pWVar1;
*(undefined4 *)this = 0xac44;
*(undefined4 *)&this->field_0x8 = 0;
*(undefined *)&this->field_0x4 = 0;
pWVar1 = (WaveBuffer_I32 *)operator_new(0x20);
WaveBuffer_I32::WaveBuffer_I32(pWVar1,1,0x1000);
*(WaveBuffer_I32 **)&this->field_0xc = pWVar1;
pWVar1 = (WaveBuffer_I32 *)operator_new(0x20);
WaveBuffer_I32::WaveBuffer_I32(pWVar1,1,0x1000);
*(WaveBuffer_I32 **)&this->field_0x10 = pWVar1;
Reset(this);
return this;
}
// DiffSurround::SetEnable(bool)
undefined4 DiffSurround::SetEnable(bool param_1) {
char cVar1;
cVar1 = *(char *)&this->field_0x4;
if (cVar1 == '\0') {
if (param_1 == false) {
return 0;
}
Reset(this);
cVar1 = *(char *)&this->field_0x4;
}
if (param_1 == (bool)cVar1) {
return 0;
}
*(bool *)&this->field_0x4 = param_1;
return 1;
}
// DiffSurround::SetSamplingRate(unsigned int)
void DiffSurround::SetSamplingRate(uint param_1) {
if (*(uint *)this == param_1) {
return;
}
*(uint *)this = param_1;
Reset(this);
return;
}
// DiffSurround::SetDelayTime(float)
void DiffSurround::SetDelayTime(float param_1) {
undefined4 in_r1;
bool in_ZR;
if (in_ZR) {
return;
}
*(undefined4 *)&this->field_0x8 = in_r1;
Reset(this);
return;
}
// DiffSurround::Process(int*, int)
void DiffSurround::Process(int *param_1,int param_2) {
int iVar1;
int iVar2;
int iVar3;
int iVar4;
int *piVar5;
int *piVar6;
if (*(char *)&this->field_0x4 == '\0') {
return;
}
if (*(WaveBuffer_I32 **)&this->field_0xc == nullptr) {
return;
}
if (*(int *)&this->field_0x10 == 0) {
return;
}
iVar2 = WaveBuffer_I32::PushZerosGetBuffer(*(WaveBuffer_I32 **)&this->field_0xc,param_2);
iVar3 = WaveBuffer_I32::PushZerosGetBuffer(*(WaveBuffer_I32 **)&this->field_0x10,param_2);
if (iVar2 == 0 || iVar3 == 0) {
Reset(this);
return;
}
iVar4 = 0;
iVar1 = param_2 * 2;
if (iVar1 < 1) {
WaveBuffer_I32::GetCurrentBufferI32Ptr(*(WaveBuffer_I32 **)&this->field_0xc);
WaveBuffer_I32::GetCurrentBufferI32Ptr(*(WaveBuffer_I32 **)&this->field_0x10);
}
else {
piVar5 = param_1;
do {
piVar6 = piVar5 + 2;
*(int *)(iVar2 + iVar4) = *piVar5;
*(int *)(iVar3 + iVar4) = piVar5[1];
iVar4 = iVar4 + 4;
piVar5 = piVar6;
} while (piVar6 != param_1 + iVar1);
iVar2 = WaveBuffer_I32::GetCurrentBufferI32Ptr(*(WaveBuffer_I32 **)&this->field_0xc);
iVar3 = WaveBuffer_I32::GetCurrentBufferI32Ptr(*(WaveBuffer_I32 **)&this->field_0x10);
iVar4 = 0;
do {
*param_1 = *(int *)(iVar2 + iVar4);
piVar5 = (int *)(iVar3 + iVar4);
iVar4 = iVar4 + 4;
param_1[1] = *piVar5;
param_1 = param_1 + 2;
} while (iVar4 != ((iVar1 - 1U >> 1) + 1) * 4);
}
WaveBuffer_I32::PopSamples(*(WaveBuffer_I32 **)&this->field_0xc,param_2,false);
WaveBuffer_I32::PopSamples(*(WaveBuffer_I32 **)&this->field_0x10,param_2,false);
return;
}

View File

@ -0,0 +1,44 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_DIFFSURROUND_H
#define VIPER_DIFFSURROUND_H
#include "../libv4a_fx.so.h"
class DiffSurround {
undefined field_0x0;
undefined field_0x1;
undefined field_0x2;
undefined field_0x3;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
undefined field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
public:
~DiffSurround();
void Reset();
DiffSurround();
undefined4 SetEnable(bool param_1);
void SetSamplingRate(uint param_1);
void SetDelayTime(float param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_DIFFSURROUND_H

214
src/effects/DynamicBass.cpp Normal file
View File

@ -0,0 +1,214 @@
//
// Created by mart on 2/12/21.
//
#include "DynamicBass.h"
// DynamicBass::SetSamplingRate(unsigned int)
void DynamicBass::SetSamplingRate(uint param_1) {
undefined8 uVar1;
float extraout_s2;
this->field_0x10 = param_1;
PolesFilter::SetSamplingRate(&this->field_0x24,param_1);
uVar1 = PolesFilter::SetSamplingRate(&this->field_0x98,param_1);
FixedBiquad::SetLowPassParameter
(&this->field_0x10c,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),extraout_s2);
return;
}
// DynamicBass::SetFilterXPassFrequency(int, int)
void DynamicBass::SetFilterXPassFrequency(int param_1,int param_2) {
undefined8 uVar1;
float extraout_s2;
this->field_0x0 = param_1;
this->field_0x4 = param_2;
PolesFilter::SetPassFilter(&this->field_0x24,param_1,param_2);
uVar1 = PolesFilter::SetSamplingRate(&this->field_0x24,this->field_0x10);
FixedBiquad::SetLowPassParameter
(&this->field_0x10c,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),extraout_s2);
return;
}
// DynamicBass::SetFilterYPassFrequency(int, int)
void DynamicBass::SetFilterYPassFrequency(int param_1,int param_2) {
this->field_0x8 = param_1;
this->field_0xc = param_2;
PolesFilter::SetPassFilter(&this->field_0x98,param_1,param_2);
PolesFilter::SetSamplingRate(&this->field_0x98,this->field_0x10);
return;
}
// DynamicBass::SetSideGain(float, float)
void DynamicBass::SetSideGain(int param_1,int param_2) {
this->field_0x20 = ROUND((float)param_1 * 3.355443e+07 + 0.5);
this->field_0x1c = ROUND((float)param_2 * 3.355443e+07 + 0.5);
return;
}
// DynamicBass::SetBassGain(float)
void DynamicBass::SetBassGain(int param_1) {
int iVar1;
undefined4 in_cr6;
undefined4 in_cr7;
float in_s0;
float in_s1;
float in_s2;
float fVar2;
fVar2 = ROUND((float)param_1 * 3.355443e+07 + 0.5);
coprocessor_function(10,6,1,in_cr7,in_cr6,in_cr6);
this->field_0x18 = fVar2;
iVar1 = (int)SUB42(ROUND(fVar2),0);
if (iVar1 < 0x641) {
this->field_0x14 = iVar1;
}
else {
this->field_0x14 = 0x640;
}
FixedBiquad::SetLowPassParameter(&this->field_0x10c,in_s0,in_s1,in_s2);
return;
}
// DynamicBass::Reset()
void DynamicBass::Reset() {
undefined8 uVar1;
float extraout_s2;
PolesFilter::~ZN11PolesFilter5ResetEv(&this->field_0x24);
uVar1 = PolesFilter::~ZN11PolesFilter5ResetEv(&this->field_0x98);
FixedBiquad::SetLowPassParameter
(&this->field_0x10c,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),extraout_s2);
return;
}
// DynamicBass::DynamicBass()
DynamicBass::DynamicBass() {
uint uVar1;
undefined8 uVar2;
float extraout_s2;
PolesFilter::PolesFilter(&this->field_0x24);
PolesFilter::PolesFilter(&this->field_0x98);
FixedBiquad::FixedBiquad(&this->field_0x10c);
this->field_0x14 = 0;
SetSamplingRate(this,0xac44);
uVar1 = this->field_0x10;
this->field_0xc = 0x50;
if ((int)uVar1 < 0) {
uVar1 = uVar1 + 3;
}
this->field_0x18 = 0x2000000;
this->field_0x1c = 0x2000000;
this->field_0x20 = 0x2000000;
this->field_0x0 = 0x78;
this->field_0x4 = (int)uVar1 >> 2;
this->field_0x8 = 0x28;
PolesFilter::SetPassFilter(&this->field_0x24,0x78,(int)uVar1 >> 2);
uVar2 = PolesFilter::SetPassFilter(&this->field_0x98,this->field_0x8,this->field_0xc);
FixedBiquad::SetLowPassParameter
(&this->field_0x10c,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),extraout_s2);
Reset(this);
return this;
}
// DynamicBass::FilterSamples(int*, int)
void DynamicBass::FilterSamples(int *param_1,int param_2) {
longlong lVar1;
longlong lVar2;
longlong lVar3;
longlong lVar4;
int iVar5;
int *piVar6;
int iVar7;
int iVar8;
int iVar9;
int local_98;
uint local_58;
uint local_54;
int local_50;
int local_4c;
int local_48;
int local_44;
int local_40;
int local_3c;
int local_38;
int local_34;
int local_30;
int local_2c [2];
if ((int)this->field_0x0 < 0x79) {
if (0 < param_2 * 2) {
iVar7 = 0;
piVar6 = param_1 + 1;
do {
iVar9 = piVar6[-1];
iVar7 = iVar7 + 2;
iVar8 = param_1[1];
iVar5 = FixedBiquad::ProcessSample(&this->field_0x10c,iVar9 + iVar8);
piVar6[-1] = iVar9 + iVar5;
param_1[1] = iVar8 + iVar5;
piVar6 = piVar6 + 2;
param_1 = param_1 + 2;
} while (iVar7 + param_2 * -2 < 0 != SBORROW4(iVar7,param_2 * 2));
return;
}
}
else {
if (0 < param_2 * 2) {
local_98 = 0;
piVar6 = param_1 + 1;
do {
local_98 = local_98 + 2;
PolesFilter::DoFilterLeft(&this->field_0x24,piVar6[-1],(int *)&local_58,&local_50,&local_48)
;
PolesFilter::DoFilterRight
(&this->field_0x24,param_1[1],(int *)&local_54,&local_4c,&local_44);
lVar1 = (longlong)(int)local_58 * (longlong)(int)this->field_0x18 + 0x1000000;
lVar2 = (longlong)(int)this->field_0x18 * (longlong)(int)local_54 + 0x1000000;
local_58 = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
local_54 = (uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7;
PolesFilter::DoFilterLeft(&this->field_0x98,local_58,&local_40,&local_38,&local_30);
PolesFilter::DoFilterRight(&this->field_0x98,local_54,&local_3c,&local_34,local_2c);
lVar1 = (longlong)local_38 * (longlong)(int)this->field_0x20 + 0x1000000;
lVar2 = (longlong)(int)this->field_0x20 * (longlong)local_34 + 0x1000000;
lVar3 = (longlong)local_40 * (longlong)(int)this->field_0x1c + 0x1000000;
lVar4 = (longlong)(int)this->field_0x1c * (longlong)local_3c + 0x1000000;
piVar6[-1] = local_50 +
local_30 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7) + local_48;
param_1[1] = local_4c +
local_2c[0] + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7) +
((uint)lVar4 >> 0x19 | (int)((ulonglong)lVar4 >> 0x20) << 7) + local_44;
param_1 = param_1 + 2;
piVar6 = piVar6 + 2;
} while (local_98 < param_2 * 2);
}
}
return;
}

35
src/effects/DynamicBass.h Normal file
View File

@ -0,0 +1,35 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_DYNAMICBASS_H
#define VIPER_DYNAMICBASS_H
class DynamicBass {
undefined4 field_0x0;
int field_0x4;
int field_0x8;
int field_0xc;
uint field_0x10;
undefined4 field_0x14;
undefined4 field_0x18;
undefined4 field_0x1c;
undefined4 field_0x20;
struct PolesFilter field_0x24;
struct PolesFilter field_0x98;
struct FixedBiquad field_0x10c;
public:
void SetSamplingRate(uint param_1);
void SetFilterXPassFrequency(int param_1,int param_2);
void SetFilterYPassFrequency(int param_1,int param_2);
void SetSideGain(int param_1,int param_2);
void SetBassGain(int param_1);
void Reset();
DynamicBass();
void FilterSamples(int *param_1,int param_2);
};
#endif //VIPER_DYNAMICBASS_H

View File

@ -0,0 +1,131 @@
//
// Created by mart on 2/12/21.
//
#include "DynamicSystem.h"
// DynamicSystem::DynamicSystem()
DynamicSystem::DynamicSystem() {
DynamicBass::DynamicBass((DynamicBass *)this);
this->enabled = false;
this->samplerate = 0xac44;
DynamicBass::SetSamplingRate((DynamicBass *)this,0xac44);
DynamicBass::Reset((DynamicBass *)this);
return this;
}
// DynamicSystem::SetSamplingRate(unsigned int)
void DynamicSystem::SetSamplingRate(uint param_1) {
if (this->samplerate == param_1) {
return;
}
this->samplerate = param_1;
DynamicBass::SetSamplingRate((DynamicBass *)this,param_1);
return;
}
void DynamicSystem::~ZN13DynamicSystem10SetXCoeffsEjj(int param_1,int param_2) {
undefined8 uVar1;
float extraout_s2;
this->field_0x0 = param_1;
this->field_0x4 = param_2;
PolesFilter::SetPassFilter(&this->field_0x24,param_1,param_2);
uVar1 = PolesFilter::SetSamplingRate(&this->field_0x24,this->field_0x10);
FixedBiquad::SetLowPassParameter
(&this->field_0x10c,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),extraout_s2);
return;
}
void DynamicSystem::~ZN13DynamicSystem10SetYCoeffsEjj(int param_1,int param_2) {
this->field_0x8 = param_1;
this->field_0xc = param_2;
PolesFilter::SetPassFilter(&this->field_0x98,param_1,param_2);
PolesFilter::SetSamplingRate(&this->field_0x98,this->field_0x10);
return;
}
void DynamicSystem::~ZN13DynamicSystem11SetSideGainEff(int param_1,int param_2) {
this->field_0x20 = ROUND((float)param_1 * 3.355443e+07 + 0.5);
this->field_0x1c = ROUND((float)param_2 * 3.355443e+07 + 0.5);
return;
}
void DynamicSystem::~ZN13DynamicSystem11SetBassGainEf(int param_1) {
int iVar1;
undefined4 in_cr6;
undefined4 in_cr7;
float in_s0;
float in_s1;
float in_s2;
float fVar2;
fVar2 = ROUND((float)param_1 * 3.355443e+07 + 0.5);
coprocessor_function(10,6,1,in_cr7,in_cr6,in_cr6);
this->field_0x18 = fVar2;
iVar1 = (int)SUB42(ROUND(fVar2),0);
if (iVar1 < 0x641) {
this->field_0x14 = iVar1;
}
else {
this->field_0x14 = 0x640;
}
FixedBiquad::SetLowPassParameter(&this->field_0x10c,in_s0,in_s1,in_s2);
return;
}
// DynamicSystem::Reset()
void DynamicSystem::Reset() {
DynamicBass::SetSamplingRate((DynamicBass *)this,this->samplerate);
DynamicBass::Reset((DynamicBass *)this);
return;
}
// DynamicSystem::SetEnable(bool)
undefined4 DynamicSystem::SetEnable(bool param_1) {
char cVar1;
cVar1 = this->enabled;
if ((bool)cVar1 == false) {
if (param_1 == false) {
return 0;
}
Reset(this);
cVar1 = this->enabled;
}
if (param_1 == (bool)cVar1) {
return 0;
}
this->enabled = param_1;
return 1;
}
// DynamicSystem::Process(int*, int)
void DynamicSystem::Process(int *param_1,int param_2) {
if (this->enabled == false) {
return;
}
DynamicBass::FilterSamples((DynamicBass *)this,param_1,param_2);
return;
}

View File

@ -0,0 +1,41 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_DYNAMICSYSTEM_H
#define VIPER_DYNAMICSYSTEM_H
class DynamicSystem {
undefined4 field_0x0;
int field_0x4;
int field_0x8;
int field_0xc;
uint field_0x10;
undefined4 field_0x14;
undefined4 field_0x18;
undefined4 field_0x1c;
undefined4 field_0x20;
struct PolesFilter field_0x24;
struct PolesFilter field_0x98;
struct FixedBiquad field_0x10c;
int samplerate; // Created by retype action
bool enabled; // Created by retype action
undefined field_0x135;
undefined field_0x136;
undefined field_0x137;
public:
DynamicSystem();
void SetSamplingRate(uint param_1);
void ~ZN13DynamicSystem10SetXCoeffsEjj(int param_1,int param_2);
void ~ZN13DynamicSystem10SetYCoeffsEjj(int param_1,int param_2);
void ~ZN13DynamicSystem11SetSideGainEff(int param_1,int param_2);
void ~ZN13DynamicSystem11SetBassGainEf(int param_1);
void Reset();
undefined4 SetEnable(bool param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_DYNAMICSYSTEM_H

527
src/effects/Effect.cpp Normal file
View File

@ -0,0 +1,527 @@
//
// Created by mart on 2/12/21.
//
#include <cstring>
#include <malloc.h>
#include "../libv4a_fx.so.h"
#include "Effect.h"
// Effect::Effect()
Effect::Effect() {
*(undefined *)&this->field_0x4 = 0;
*(undefined *)&this->field_0x5 = 1;
this->samplerate = 0xac44;
memset(&this->field_0xc,0,0x40);
*(undefined *)&this->field_0x29 = 1;
this->field_0x28 = '\x01';
this->field_0x14 = 0xac44;
*(undefined *)&this->field_0x49 = 0;
this->field_0x48 = '\x01';
this->samplerate = 0xac44;
this->field_0x60 = nullptr;
this->field_0x64 = nullptr;
this->field_0x68 = nullptr;
this->field_0x18 = (int *)0x3;
this->field_0x38 = 3;
this->field_0x2a = 0x3f;
this->field_0x4a = 0x3f;
}
// Effect::~Effect()
Effect::~Effect() {
if (this->field_0x60 != nullptr) {
free(this->field_0x60);
}
this->field_0x60 = nullptr;
this->field_0x64 = nullptr;
this->field_0x68 = nullptr;
}
// Effect::configure(void*)
int Effect::configure(effect_config_t *param_1) {
int *piVar1;
int *piVar2;
int *piVar3;
int *piVar4;
int *piVar5;
int *piVar6;
int *piVar7;
int *piVar8;
int *piVar9;
void *pvVar10;
int *piVar11;
void *pvVar12;
int *piVar13;
uint uVar14;
int *piVar15;
uint uVar16;
undefined local_4b;
undefined local_2b;
piVar1 = (int *)(param_1->inputCfg).buffer.frameCount;
piVar5 = (int *)(param_1->inputCfg).buffer.buffer;
piVar9 = (int *)(param_1->inputCfg).samplingRate;
piVar13 = (int *)(param_1->inputCfg).channels;
piVar2 = (int *)(param_1->inputCfg).bufferProvider.getBuffer;
piVar6 = (int *)(param_1->inputCfg).bufferProvider.releaseBuffer;
pvVar10 = (param_1->inputCfg).bufferProvider.cookie;
uVar14 = *(uint *)&(param_1->inputCfg).format;
piVar3 = (int *)(param_1->outputCfg).buffer.frameCount;
piVar7 = (int *)(param_1->outputCfg).buffer.buffer;
piVar11 = (int *)(param_1->outputCfg).samplingRate;
piVar15 = (int *)(param_1->outputCfg).channels;
piVar4 = (int *)(param_1->outputCfg).bufferProvider.getBuffer;
piVar8 = (int *)(param_1->outputCfg).bufferProvider.releaseBuffer;
pvVar12 = (param_1->outputCfg).bufferProvider.cookie;
uVar16 = *(uint *)&(param_1->outputCfg).format;
__android_log_print(4,"ViPER4Android_v2","Begin audio configure ...");
__android_log_print(4,"ViPER4Android_v2","Checking input and output configuration ...");
if (((uVar14 & 0x20000) != 0) && ((uVar16 & 0x20000) != 0)) {
if (piVar11 != piVar9) {
__android_log_print(4,"ViPER4Android_v2",
"ViPER4Android disabled, reason [in.SR = %d, out.SR = %d]",piVar9,piVar11)
;
*(undefined *)&this->field_0x5 = 0;
return EINVAL;
}
if ((int *)0xf3c < piVar11 + -0x2b11) {
__android_log_print(4,"ViPER4Android_v2","ViPER4Android disabled, reason [SR out of range]");
*(undefined *)&this->field_0x5 = 0;
return EINVAL;
}
this->samplerate = piVar11;
}
if (((uVar14 & 0x40000) != 0) && ((uVar16 & 0x40000) != 0)) {
if (piVar13 != piVar15) {
__android_log_print(4,"ViPER4Android_v2",
"ViPER4Android disabled, reason [in.CH = %d, out.CH = %d]",piVar13,piVar15
);
*(undefined *)&this->field_0x5 = 0;
return EINVAL;
}
if (piVar13 != (int *)0x3) {
__android_log_print(4,"ViPER4Android_v2","ViPER4Android disabled, reason [CH != 2]");
*(undefined *)&this->field_0x5 = 0;
return EINVAL;
}
}
if (((uVar14 & 0x80000) != 0) && ((uVar16 & 0x80000) != 0)) {
if ((uVar14 & 0xfd) != 1) {
__android_log_print(4,"ViPER4Android_v2","ViPER4Android disabled, reason [in.FMT = %d]");
__android_log_print(4,"ViPER4Android_v2","We only accept s16 and fixed.31 format");
*(undefined *)&this->field_0x5 = 0;
return EINVAL;
}
if ((uVar16 & 0xfd) != 1) {
__android_log_print(4,"ViPER4Android_v2","ViPER4Android disabled, reason [out.FMT = %d]");
__android_log_print(4,"ViPER4Android_v2","We only accept s16 and fixed.31 format");
*(undefined *)&this->field_0x5 = 0;
return EINVAL;
}
}
__android_log_print(4,"ViPER4Android_v2","Input and output configuration checked.");
if ((uVar14 & 0x10000) != 0) {
this->field_0xc = piVar1;
this->field_0x10 = piVar5;
}
if ((uVar14 & 0x200000) != 0) {
this->field_0x1c = piVar2;
this->field_0x20 = piVar6;
this->field_0x24 = pvVar10;
}
if ((uVar14 & 0x20000) != 0) {
this->field_0x14 = piVar9;
}
if ((uVar14 & 0x40000) != 0) {
this->field_0x18 = piVar13;
}
if ((uVar14 & 0x80000) != 0) {
this->field_0x28 = (char)uVar14;
}
if ((uVar14 & 0x100000) != 0) {
local_4b = (undefined)(uVar14 >> 8);
*(undefined *)&this->field_0x29 = local_4b;
}
if ((uVar16 & 0x10000) != 0) {
this->field_0x2c = piVar3;
this->field_0x30 = piVar7;
}
if ((uVar16 & 0x200000) != 0) {
this->field_0x3c = piVar4;
this->field_0x40 = piVar8;
this->field_0x44 = pvVar12;
}
if ((uVar16 & 0x20000) != 0) {
this->samplerate = piVar11;
}
if ((uVar16 & 0x40000) != 0) {
this->field_0x38 = piVar15;
}
if ((uVar16 & 0x80000) != 0) {
this->field_0x48 = (char)uVar16;
}
if ((uVar16 & 0x100000) != 0) {
local_2b = (undefined)(uVar16 >> 8);
*(undefined *)&this->field_0x49 = local_2b;
}
__android_log_print(4,"ViPER4Android_v2","Audio configure finished");
*(undefined *)&this->field_0x5 = 1;
return OK;
}
// Effect::command(unsigned int, unsigned int, void*, unsigned int*, void*)
int Effect::command(uint param_1,uint param_2,void *param_3,uint *param_4,void *param_5) {
int *piVar1;
int **ppiVar2;
int **ppiVar3;
char *pcVar4;
int *piVar5;
int *piVar6;
switch(param_1) {
case 0:
*(undefined4 *)param_5 = 0;
return OK;
case 1:
goto LAB_0006f49c;
case 2:
break;
case 3:
*(undefined *)&this->field_0x4 = 1;
*(undefined4 *)param_5 = 0;
return OK;
case 4:
*(undefined *)&this->field_0x4 = 0;
*(undefined4 *)param_5 = 0;
return OK;
case 5:
LAB_0006f49c:
*(undefined4 *)param_5 = 0;
return OK;
case 6:
break;
case 7:
*(undefined4 *)param_5 = 0;
return OK;
case 8:
*(undefined4 *)param_5 = 0xffffffea;
*(undefined4 *)((int)param_5 + 8) = 0;
*param_4 = 0xc;
return OK;
case 9:
break;
case 10:
break;
case 0xb:
break;
case 0xc:
*(undefined4 *)param_5 = 0xffffffea;
return EINVAL;
case 0xd:
break;
case 0xe:
if (param_5 == nullptr) {
return EINVAL;
}
if (*param_4 != 0x40) {
return EINVAL;
}
ppiVar2 = &this->field_0xc;
do {
ppiVar3 = ppiVar2 + 4;
piVar5 = ppiVar2[1];
piVar6 = ppiVar2[2];
piVar1 = ppiVar2[3];
*(int **)param_5 = *ppiVar2;
*(int **)((int)param_5 + 4) = piVar5;
*(int **)((int)param_5 + 8) = piVar6;
*(int **)((int)param_5 + 0xc) = piVar1;
param_5 = (int **)((int)param_5 + 0x10);
ppiVar2 = ppiVar3;
} while (ppiVar3 != (int **)&this->field_0x4c);
break;
case 0xf:
return EINVAL;
case 0x10:
return EINVAL;
case 0x11:
return EINVAL;
case 0x12:
return EINVAL;
case 0x13:
break;
case 0x14:
if ((param_3 == nullptr) && (param_2 == 8)) {
if (cRam00000000 == '\0') {
pcVar4 = "false";
}
else {
pcVar4 = "true";
}
__android_log_print(4,"ViPER4Android_v2","Effect offload status = %s",pcVar4,0);
return EINVAL;
}
default:
return EINVAL;
}
return OK;
}
// Effect::process(audio_buffer_s*, audio_buffer_s*)
int Effect::process(audio_buffer_s *param_1,audio_buffer_s *param_2) {
char cVar1;
char cVar2;
int *piVar3;
void *pvVar4;
int EVar5;
short *psVar6;
int *piVar7;
short *psVar8;
short *psVar9;
int *piVar10;
int *piVar11;
int *piVar12;
int *piVar13;
int *piVar14;
int *piVar15;
undefined4 uVar16;
undefined4 uVar17;
ProcessUnit_FX *pPVar18;
int *piVar19;
uint uVar20;
int *local_38;
int *local_34;
int *local_30;
int *local_2c;
if (*(char *)&this->field_0x5 == '\0') {
return EINVAL;
}
uVar16 = this->field_0x24;
piVar12 = this->field_0x20;
uVar17 = this->field_0x44;
local_38 = nullptr;
local_34 = nullptr;
piVar15 = this->field_0x2c;
piVar14 = this->field_0x30;
piVar10 = this->field_0x1c;
piVar19 = this->field_0x3c;
piVar13 = this->field_0x40;
cVar1 = this->field_0x28;
cVar2 = this->field_0x48;
if (param_1 == nullptr) {
piVar11 = (int *)param_1;
piVar7 = this->field_0xc;
piVar3 = this->field_0x10;
if ((((this->field_0x10 == nullptr) &&
(piVar11 = piVar10, piVar7 = local_38, piVar3 = local_34, piVar10 != nullptr)) &&
(piVar11 = piVar12, piVar12 != nullptr)) &&
((*(code *)piVar10)(uVar16,&local_38), piVar11 = local_34, piVar7 = local_38,
piVar3 = local_34, local_34 != nullptr)) {
piVar11 = (int *)0x1;
}
}
else {
piVar11 = nullptr;
piVar7 = *(int **)param_1;
piVar3 = *(int **)(param_1 + 4);
}
local_34 = piVar3;
local_38 = piVar7;
local_30 = nullptr;
local_2c = nullptr;
if (param_2 == nullptr) {
piVar10 = (int *)param_2;
piVar7 = piVar15;
if (((piVar14 == nullptr) &&
(piVar10 = piVar19, piVar15 = piVar19, piVar7 = local_30, piVar14 = local_2c,
piVar19 != nullptr)) &&
((piVar10 = piVar13, piVar15 = piVar13, piVar13 != nullptr &&
((*(code *)piVar19)(uVar17,&local_30), piVar10 = local_2c, piVar15 = local_30,
piVar7 = local_30, piVar14 = local_2c, local_2c != nullptr)))) {
piVar10 = (int *)0x1;
}
}
else {
piVar10 = nullptr;
piVar15 = *(int **)param_2;
piVar7 = *(int **)param_2;
piVar14 = *(int **)(param_2 + 4);
}
local_2c = piVar14;
local_30 = piVar7;
piVar14 = local_38;
if (local_38 != piVar15) {
LAB_0006f694:
if (piVar11 != nullptr) {
(*(code *)piVar12)(uVar16,&local_38);
}
LAB_0006f69c:
if (piVar10 != nullptr) {
(*(code *)piVar13)(uVar17,&local_30);
}
return EINVAL;
}
if (piVar15 == nullptr) {
joined_r0x0006f6bc:
if (piVar11 != nullptr) {
(*(code *)piVar12)(uVar16,&local_38);
}
LAB_0006f6c0:
if (piVar10 != nullptr) {
(*(code *)piVar13)(uVar17,&local_30);
}
return OK;
}
if ((local_34 == nullptr) || (local_2c == nullptr)) goto LAB_0006f694;
if (cVar2 == '\x01' && cVar1 == '\x01') {
if (local_34 != local_2c) {
memcpy(local_2c,local_34,(int)piVar15 << 2);
}
if (this->field_0x68 != nullptr) {
EVar5 = ProcessUnit_FX::processBuffer(this->field_0x68,(short *)local_2c,(int)piVar15);
goto LAB_0006f868;
}
}
else {
uVar20 = (uint)(cVar2 == '\x03' && cVar1 == '\x03');
if (uVar20 == 0) {
if (cVar2 != '\x03' || cVar1 != '\x01') {
if (cVar1 != '\x03' || cVar2 != '\x01') {
if (piVar11 != nullptr) {
(*(code *)piVar12)(uVar16,&local_38);
}
goto LAB_0006f69c;
}
if ((local_34 != local_2c) && (0 < (int)piVar15 * 2)) {
piVar19 = local_34 + -1;
piVar14 = local_2c;
do {
piVar19 = piVar19 + 1;
piVar7 = (int *)((int)piVar14 + 2);
*(short *)piVar14 = (short)((uint)*piVar19 >> 0x10);
piVar14 = piVar7;
} while (piVar7 != local_2c + (int)piVar15);
}
if (this->field_0x68 != nullptr) {
EVar5 = ProcessUnit_FX::processBuffer(this->field_0x68,(short *)local_2c,(int)piVar15);
goto LAB_0006f868;
}
goto LAB_0006f9a8;
}
if ((local_34 != local_2c) && (0 < (int)piVar15 * 2)) {
do {
*(int *)((int)local_2c + uVar20 * 2) = (int)*(short *)((int)local_34 + uVar20) << 0x10;
uVar20 = uVar20 + 2;
} while (uVar20 != (int)piVar15 * 4);
}
if ((int)this->field_0x64 < (int)piVar15) {
if (this->field_0x60 != nullptr) {
free(this->field_0x60);
}
this->field_0x60 = nullptr;
LAB_0006f93c:
pvVar4 = valloc((int)piVar14 << 2);
this->field_0x60 = pvVar4;
this->field_0x64 = piVar15;
if (pvVar4 == nullptr) {
this->field_0x64 = nullptr;
if (piVar11 != nullptr) {
(*(code *)piVar12)(uVar16,&local_38);
}
goto LAB_0006f6c0;
}
}
else {
if (this->field_0x60 == nullptr) goto LAB_0006f93c;
}
pPVar18 = this->field_0x68;
if (pPVar18 != nullptr) {
memcpy(this->field_0x60,local_34,(int)piVar14 << 2);
EVar5 = ProcessUnit_FX::processBuffer(pPVar18,(short *)this->field_0x60,(int)piVar15);
psVar6 = (short *)this->field_0x60;
piVar14 = local_2c;
psVar9 = psVar6;
do {
psVar8 = psVar9 + 1;
*piVar14 = (int)*psVar9 << 0x10;
piVar14 = piVar14 + 1;
psVar9 = psVar8;
} while (psVar8 != psVar6 + (int)piVar15 * 2);
goto LAB_0006f868;
}
}
else {
if (local_34 != local_2c) {
memcpy(local_2c,local_34,(int)piVar15 << 3);
}
if ((int)this->field_0x64 < (int)piVar15) {
if (this->field_0x60 != nullptr) {
free(this->field_0x60);
}
this->field_0x60 = nullptr;
LAB_0006f788:
pvVar4 = valloc((int)piVar14 << 2);
this->field_0x60 = pvVar4;
this->field_0x64 = piVar15;
if (pvVar4 == nullptr) {
this->field_0x64 = nullptr;
goto joined_r0x0006f6bc;
}
}
else {
if (this->field_0x60 == nullptr) goto LAB_0006f788;
}
pPVar18 = this->field_0x68;
if (pPVar18 != nullptr) {
psVar6 = (short *)this->field_0x60;
piVar14 = local_2c;
psVar9 = psVar6;
do {
psVar8 = psVar9 + 1;
*psVar9 = (short)((uint)*piVar14 >> 0x10);
piVar14 = piVar14 + 1;
psVar9 = psVar8;
} while (psVar8 != psVar6 + (int)piVar15 * 2);
EVar5 = ProcessUnit_FX::processBuffer(pPVar18,psVar6,(int)piVar15);
psVar6 = (short *)this->field_0x60;
piVar14 = local_2c;
psVar9 = psVar6;
do {
psVar8 = psVar9 + 1;
*piVar14 = (int)*psVar9 << 0x10;
piVar14 = piVar14 + 1;
psVar9 = psVar8;
} while (psVar8 != psVar6 + (int)piVar15 * 2);
goto LAB_0006f868;
}
}
}
LAB_0006f9a8:
EVar5 = OK;
LAB_0006f868:
if (piVar11 != nullptr) {
(*(code *)piVar12)(uVar16,&local_38);
}
if (piVar10 != nullptr) {
(*(code *)piVar13)(uVar17,&local_30);
return EVar5;
}
return EVar5;
}

69
src/effects/Effect.h Normal file
View File

@ -0,0 +1,69 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_EFFECT
#define VIPER_EFFECT
class Effect{
undefined4 field_0x0;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
undefined4 field_0x8;
int * field_0xc;
int * field_0x10;
int field_0x14;
int * field_0x18;
int * field_0x1c;
int * field_0x20;
undefined4 field_0x24;
char field_0x28;
undefined field_0x29;
undefined2 field_0x2a;
int * field_0x2c;
int * field_0x30;
undefined4 samplerate;
undefined4 field_0x38;
int * field_0x3c;
int * field_0x40;
undefined4 field_0x44;
char field_0x48;
undefined field_0x49;
undefined2 field_0x4a;
undefined field_0x4c;
undefined field_0x4d;
undefined field_0x4e;
undefined field_0x4f;
undefined field_0x50;
undefined field_0x51;
undefined field_0x52;
undefined field_0x53;
undefined field_0x54;
undefined field_0x55;
undefined field_0x56;
undefined field_0x57;
undefined field_0x58;
undefined field_0x59;
undefined field_0x5a;
undefined field_0x5b;
undefined field_0x5c;
undefined field_0x5d;
undefined field_0x5e;
undefined field_0x5f;
void * field_0x60;
int * field_0x64;
struct ProcessUnit_FX * field_0x68;
public:
Effect();
~Effect();
int configure(effect_config_t *param_1);
int command(uint param_1,uint param_2,void *param_3,uint *param_4,void *param_5);
virtual int process(audio_buffer_s *param_1,audio_buffer_s *param_2);
};
#endif //VIPER_EFFECT

View File

@ -0,0 +1,463 @@
//
// Created by mart on 2/12/21.
//
#include "FETCompressor.h"
// FETCompressor::~FETCompressor()
FETCompressor::~FETCompressor() {
return;
}
// FETCompressor::SetParameter(int, float)
void FETCompressor::SetParameter(int param_1,float param_2) {
undefined4 uVar1;
int in_r1;
float in_r2;
undefined uVar2;
int iVar3;
char cVar4;
bool bVar5;
char cVar6;
undefined4 in_cr6;
undefined4 in_cr7;
float in_s1;
float fVar7;
iVar3 = param_1 + in_r1 * 4;
*(float *)(iVar3 + 4) = in_r2;
cVar6 = SBORROW4(in_r1,0x10);
cVar4 = in_r1 + -0x10 < 0;
bVar5 = in_r1 == 0x10;
switch(in_r1) {
case 0:
if (in_r1 < 0x10) {
iVar3 = 0;
}
uVar2 = (undefined)iVar3;
if (0xf < in_r1) {
uVar2 = 1;
}
*(undefined *)(param_1 + 0x4c) = uVar2;
return;
case 1:
uVar1 = 0x41200000;
coprocessor_function(10,6,5,in_cr7,in_cr7,in_cr6);
fVar7 = powf(param_2,in_s1);
logf(fVar7);
*(undefined4 *)(param_1 + 100) = uVar1;
return;
case 2:
*(float *)(param_1 + 0x74) = 0.0 - in_r2;
return;
case 3:
uVar1 = 0x41200000;
coprocessor_function(10,6,5,in_cr7,in_cr7,in_cr6);
fVar7 = powf(param_2,in_s1);
logf(fVar7);
*(undefined4 *)(param_1 + 0x68) = uVar1;
return;
case 4:
if (in_r1 < 0x10) {
iVar3 = 0;
}
uVar2 = (undefined)iVar3;
if (0xf < in_r1) {
uVar2 = 1;
}
*(undefined *)(param_1 + 0x4d) = uVar2;
return;
case 5:
uVar1 = 0x41200000;
coprocessor_function(10,6,5,in_cr7,in_cr7,in_cr6);
fVar7 = powf(param_2,in_s1);
logf(fVar7);
*(undefined4 *)(param_1 + 0x70) = uVar1;
return;
case 6:
if (in_r1 < 0x10) {
iVar3 = 0;
}
uVar2 = (undefined)iVar3;
if (0xf < in_r1) {
uVar2 = 1;
}
*(undefined *)(param_1 + 0x4e) = uVar2;
return;
case 7:
fVar7 = in_r2 * 7.600903 - 9.21034;
expf(param_2);
iVar3 = *(int *)param_1;
*(float *)(param_1 + 0x80) = fVar7;
if (bVar5 || cVar4 != cVar6) {
iVar3 = 0x3f800000;
}
if (!bVar5 && cVar4 == cVar6) {
iVar3 = FUN_00067ef8((float)(longlong)iVar3);
}
*(int *)(param_1 + 0x84) = iVar3;
return;
case 8:
if (in_r1 < 0x10) {
iVar3 = 0;
}
uVar2 = (undefined)iVar3;
if (0xf < in_r1) {
uVar2 = 1;
}
*(undefined *)(param_1 + 0x4f) = uVar2;
return;
case 9:
fVar7 = in_r2 * 5.991465 - 5.298317;
expf(param_2);
iVar3 = *(int *)param_1;
*(float *)(param_1 + 0x88) = fVar7;
if (bVar5 || cVar4 != cVar6) {
iVar3 = 0x3f800000;
}
if (!bVar5 && cVar4 == cVar6) {
iVar3 = FUN_00067ef8((float)(longlong)iVar3);
}
*(int *)(param_1 + 0x8c) = iVar3;
return;
case 10:
if (in_r1 < 0x10) {
iVar3 = 0;
}
uVar2 = (undefined)iVar3;
if (0xf < in_r1) {
uVar2 = 1;
}
*(undefined *)(param_1 + 0x50) = uVar2;
return;
case 0xb:
*(float *)(param_1 + 0x90) = in_r2 * 4.0 + 0.0;
return;
case 0xc:
fVar7 = in_r2 * 7.600903 - 9.21034;
expf(param_2);
*(float *)(param_1 + 0x94) = fVar7;
return;
case 0xd:
fVar7 = in_r2 * 5.991465 - 5.298317;
expf(param_2);
*(float *)(param_1 + 0x98) = fVar7;
return;
case 0xe:
fVar7 = in_r2 * 5.991465 - 5.298317;
expf(param_2);
iVar3 = *(int *)param_1;
*(float *)(param_1 + 0x9c) = fVar7;
if (bVar5 || cVar4 != cVar6) {
iVar3 = 0x3f800000;
}
if (!bVar5 && cVar4 == cVar6) {
iVar3 = FUN_00067ef8((float)(longlong)iVar3);
}
*(int *)(param_1 + 0xa0) = iVar3;
return;
case 0xf:
fVar7 = in_r2 * 1.386294 + 0.0;
expf(param_2);
iVar3 = *(int *)param_1;
*(float *)(param_1 + 0xa4) = fVar7;
if (bVar5 || cVar4 != cVar6) {
iVar3 = 0x3f800000;
}
if (!bVar5 && cVar4 == cVar6) {
iVar3 = FUN_00067ef8((float)(longlong)iVar3);
}
*(int *)(param_1 + 0xa8) = iVar3;
return;
case 0x10:
if (in_r1 < 0x10) {
iVar3 = 0;
}
uVar2 = (undefined)iVar3;
if (0xf < in_r1) {
uVar2 = 1;
}
*(undefined *)(param_1 + 0xac) = uVar2;
}
return;
}
// FETCompressor::GetParameter(int)
float FETCompressor::GetParameter(int param_1) {
return this->parameters[param_1];
}
// FETCompressor::GetParameterDefault(int)
float FETCompressor::GetParameterDefault(int param_1) {
if ((uint)param_1 < 0x11) {
return FLOAT_ARRAY_000ce870[param_1];
}
return 0.0;
}
// WARNING: Removing unreachable block (ram,0x000682cc)
// FETCompressor::GetMeter(int)
float FETCompressor::GetMeter(int param_1) {
bool bVar1;
if (param_1 != 0) {
return 0.0;
}
bVar1 = this->field_0x4c == '\0';
if ((!bVar1) && (bVar1)) {
return ((0.0 - (float)this->field_0x58) - DAT_000d5894) / (0.0 - DAT_000d5894);
}
return 1.0;
}
// FETCompressor::Reset()
void FETCompressor::Reset() {
undefined4 uVar1;
uVar1 = FUN_00067ef8((float)(longlong)this->samplerate,0x3d4ccccd);
this->field_0x48 = uVar1;
this->field_0x60 = this->field_0x64;
this->field_0x6c = this->field_0x70;
this->field_0x78 = 0x358637bd;
this->field_0x7c = 0x358637bd;
this->field_0x54 = 0;
this->field_0x58 = 0;
this->field_0x5c = 0;
return;
}
// FETCompressor::FETCompressor()
FETCompressor::FETCompressor() {
int iVar1;
float fVar2;
iVar1 = 0;
this->samplerate = 0xac44;
do {
fVar2 = (float)GetParameterDefault(this,iVar1);
iVar1 = iVar1 + 1;
SetParameter((int)this,fVar2);
} while (iVar1 != 0x11);
Reset(this);
return this;
}
// FETCompressor::SetSamplingRate(int)
void FETCompressor::SetSamplingRate(int param_1) {
int iVar1;
float fVar2;
iVar1 = 0;
this->samplerate = param_1;
do {
fVar2 = (float)GetParameter(this,iVar1);
iVar1 = iVar1 + 1;
SetParameter((int)this,fVar2);
} while (iVar1 != 0x11);
Reset(this);
return;
}
// WARNING: Removing unreachable block (ram,0x0006850c)
// WARNING: Removing unreachable block (ram,0x00068520)
// WARNING: Removing unreachable block (ram,0x00068624)
// WARNING: Removing unreachable block (ram,0x0006852c)
// FETCompressor::ProcessSidechain(float)
void FETCompressor::ProcessSidechain(float param_1) {
void *pFVar1;
FETCompressor *in_r1;
bool in_NG;
bool in_ZR;
char in_OV;
char cVar1;
char cVar2;
bool bVar3;
undefined uVar4;
undefined4 in_cr4;
undefined4 in_cr5;
undefined4 in_cr6;
undefined4 in_cr7;
undefined4 in_cr8;
float extraout_s0;
float extraout_s0_00;
float fVar5;
float fVar6;
float in_s15;
float fVar7;
float fVar8;
float fVar9;
float fVar10;
coprocessor_function(10,6,0,in_cr7,in_cr8,in_cr8);
if (in_ZR || in_NG != (bool)in_OV) {
in_s15 = 1e-06;
}
fVar8 = (float)this->field_0x84;
fVar5 = (float)this->field_0x7c + (in_s15 - (float)this->field_0x7c) * (float)this->field_0xa0;
fVar9 = this->field_0x80;
if (in_NG) {
in_s15 = (float)this->field_0x78 + (float)this->field_0xa0 * (in_s15 - (float)this->field_0x78);
}
bVar3 = *(char *)&this->field_0x4f != '\0';
this->field_0x7c = fVar5;
this->field_0x78 = in_s15;
fVar5 = in_s15 / fVar5;
pFVar1 = this;
if (bVar3) {
param_1 = (float)this->samplerate;
fVar9 = (this->field_0x94 + this->field_0x94) / fVar5;
if (bVar3) {
pFVar1 = (void *)FUN_00067ef8((float)(longlong)(int)param_1,fVar9);
param_1 = extraout_s0;
fVar8 = extraout_s0;
}
else {
fVar8 = 1.0;
}
}
fVar10 = (float)this->field_0x8c;
cVar2 = '\0';
uVar4 = *(char *)&this->field_0x50 == '\0';
cVar1 = '\0';
if (!(bool)uVar4) {
param_1 = (float)this->samplerate;
if ((bool)uVar4) {
fVar10 = 1.0;
}
else {
pFVar1 = (void *)FUN_00067ef8((float)(longlong)(int)param_1,
(this->field_0x98 + this->field_0x98) / fVar5 - fVar9);
param_1 = extraout_s0_00;
fVar10 = extraout_s0_00;
}
}
if ((bool)uVar4 || cVar2 != cVar1) {
pFVar1 = (FETCompressor *)0x358637bd;
}
if (!(bool)uVar4 && cVar2 == cVar1) {
pFVar1 = in_r1;
}
fVar5 = logf(param_1);
fVar9 = (float)this->field_0x60;
bVar3 = *(char *)&this->field_0x4d == '\0';
if (bVar3) {
coprocessor_function(10,6,4,in_cr6,in_cr6,in_cr5);
fVar6 = (float)this->field_0x5c;
coprocessor_function(10,6,0,in_cr5,in_cr6,in_cr4);
coprocessor_function(10,6,4,in_cr6,in_cr6,in_cr4);
}
else {
fVar6 = (float)this->field_0x5c;
coprocessor_function(10,6,5,in_cr6,in_cr6,in_cr5);
if (!bVar3) {
coprocessor_function(10,6,1,in_cr5,in_cr6,in_cr5);
}
}
coprocessor_function(10,6,4,in_cr7,in_cr7,in_cr5);
fVar7 = (float)pFVar1 - fVar9;
if (bVar3) {
fVar7 = (float)this->field_0x54 + (((float)pFVar1 - fVar9) - (float)this->field_0x54) * fVar10;
}
this->field_0x54 = fVar7;
fVar8 = (float)this->field_0x58 + (fVar7 - (float)this->field_0x58) * fVar8;
this->field_0x58 = fVar8;
this->field_0x5c = fVar6 + (((0.0 - fVar8) - fVar9) - fVar6) * (float)this->field_0xa8;
if (*(char *)&this->field_0x4e != '\0') {
bVar3 = *(char *)&this->field_0xac != '\0';
if (bVar3) {
fVar8 = (float)pFVar1 - fVar8;
if (bVar3) {
fVar8 = (fVar8 - fVar9) + 0.00115127;
}
if (bVar3) {
this->field_0x5c = fVar8;
}
}
expf(fVar5);
return;
}
expf(fVar5);
return;
}
// FETCompressor::Process(int*, int)
void FETCompressor::Process(int *param_1,int param_2) {
longlong lVar1;
FETCompressor *pFVar2;
int *piVar3;
int iVar4;
undefined4 in_cr7;
undefined4 in_cr8;
float in_s0;
float extraout_s0;
float fVar5;
float fVar6;
if (param_2 * 2 < 1) {
fVar5 = (float)this->field_0x60;
fVar6 = (float)this->field_0x6c;
}
else {
piVar3 = param_1 + 1;
iVar4 = 0;
do {
coprocessor_function(10,6,4,in_cr7,in_cr7,in_cr8);
coprocessor_function(10,2,0,in_cr7,in_cr7,in_cr8);
pFVar2 = this;
ProcessSidechain(this,in_s0);
if (this->field_0x4c != '\0') {
fVar5 = ROUND((float)pFVar2 * 3.355443e+07 + 0.5);
lVar1 = (longlong)piVar3[-1] * (longlong)(int)fVar5 + 0x1000000;
piVar3[-1] = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
lVar1 = (longlong)(int)fVar5 * (longlong)param_1[1] + 0x1000000;
param_1[1] = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
}
iVar4 = iVar4 + 2;
param_1 = param_1 + 2;
piVar3 = piVar3 + 2;
fVar5 = (float)this->field_0x60 +
((float)this->field_0x64 - (float)this->field_0x60) * (float)this->field_0x48;
fVar6 = (float)this->field_0x6c +
(float)this->field_0x48 * ((float)this->field_0x70 - (float)this->field_0x6c);
this->field_0x60 = fVar5;
this->field_0x6c = fVar6;
in_s0 = extraout_s0;
} while (iVar4 + param_2 * -2 < 0 != SBORROW4(iVar4,param_2 * 2));
}
this->field_0x58 = ((float)this->field_0x58 + 9.999999e-19) - 9.999999e-19;
this->field_0x54 = ((float)this->field_0x54 + 9.999999e-19) - 9.999999e-19;
this->field_0x5c = ((float)this->field_0x5c + 9.999999e-19) - 9.999999e-19;
this->field_0x7c = ((float)this->field_0x7c + 9.999999e-19) - 9.999999e-19;
this->field_0x78 = ((float)this->field_0x78 + 9.999999e-19) - 9.999999e-19;
this->field_0x60 = (fVar5 + 9.999999e-19) - 9.999999e-19;
this->field_0x6c = (fVar6 + 9.999999e-19) - 9.999999e-19;
return;
}

View File

@ -0,0 +1,62 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_FETCOMPRESSOR_H
#define VIPER_FETCOMPRESSOR_H
class FETCompressor {
int samplerate;
float parameters[17]; // Created by retype action
undefined4 field_0x48;
char field_0x4c;
undefined field_0x4d;
undefined field_0x4e;
undefined field_0x4f;
undefined field_0x50;
undefined field_0x51;
undefined field_0x52;
undefined field_0x53;
undefined4 field_0x54;
undefined4 field_0x58;
undefined4 field_0x5c;
undefined4 field_0x60;
undefined4 field_0x64;
undefined4 field_0x68;
undefined4 field_0x6c;
undefined4 field_0x70;
float field_0x74;
undefined4 field_0x78;
undefined4 field_0x7c;
float field_0x80;
int field_0x84;
float field_0x88;
int field_0x8c;
float field_0x90;
float field_0x94;
float field_0x98;
float field_0x9c;
int field_0xa0;
float field_0xa4;
int field_0xa8;
undefined field_0xac;
undefined field_0xad;
undefined field_0xae;
undefined field_0xaf;
public:
~FETCompressor();
void SetParameter(int param_1,float param_2);
float GetParameter(int param_1);
float GetParameterDefault(int param_1);
float GetMeter(int param_1);
void Reset();
FETCompressor();
void SetSamplingRate(int param_1);
void ProcessSidechain(float param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_FETCOMPRESSOR_H

View File

@ -0,0 +1,250 @@
//
// Created by mart on 2/12/21.
//
#include "FIREqualizer.h"
// FIREqualizer::~FIREqualizer()
FIREqualizer::~FIREqualizer() {
if ((void *)this->field_0x0 != nullptr) {
operator_delete((void *)this->field_0x0);
}
this->field_0x0 = 0;
return this;
}
// FIREqualizer::SetBandLevel(unsigned int, float)
void FIREqualizer::SetBandLevel(uint param_1,float param_2) {
float in_r2;
float fVar1;
if (this->field_0x0 == 0) {
return;
}
if (9 < param_1) {
return;
}
if (9 < (int)param_1) {
in_r2 = in_r2 + in_r2;
}
fVar1 = ROUND((in_r2 + 1.0) * 3.355443e+07 + 0.5);
*(uint *)(this->field_0x0 + (9 - param_1) * 4) = (uint)fVar1 & ~((int)fVar1 >> 0x1f);
return;
}
// FIREqualizer::Reset()
void FIREqualizer::Reset() {
if (this->field_0x0 == 0) {
return;
}
memset((void *)(this->field_0x0 + 0x28),0,0x400);
memset((void *)(this->field_0x0 + 0x428),0,0x400);
memset((void *)(this->field_0x0 + 0x828),0,0x400);
memset((void *)(this->field_0x0 + 0xc28),0,0x400);
memset((void *)(this->field_0x0 + 0x1028),0,0x48);
memset((void *)(this->field_0x0 + 0x1070),0,0x48);
*(undefined4 *)(this->field_0x0 + 0x10b8) = 0;
return;
}
// FIREqualizer::SetEnable(bool)
undefined4 FIREqualizer::SetEnable(bool param_1) {
bool cVar1;
cVar1 = this->enabled;
if (cVar1 == false) {
if (param_1 == false) {
return 0;
}
Reset(this);
cVar1 = this->enabled;
}
if (param_1 == cVar1) {
return 0;
}
this->enabled = param_1;
return 1;
}
// FIREqualizer::SetSamplingRate(unsigned int)
void FIREqualizer::SetSamplingRate(uint param_1) {
if (this->samplerate == param_1) {
return;
}
this->samplerate = param_1;
Reset(this);
return;
}
// FIREqualizer::FIREqualizer()
FIREqualizer::FIREqualizer() {
void *__s;
uint uVar1;
uint uVar2;
float extraout_s0;
float fVar3;
__s = operator_new(0x10c0);
memset(__s,0,0x10c0);
this->field_0x0 = (int)__s;
uVar1 = 0;
fVar3 = extraout_s0;
do {
uVar2 = uVar1 + 1;
fVar3 = (float)SetBandLevel(this,uVar1,fVar3);
uVar1 = uVar2;
} while (uVar2 != 10);
Reset(this);
this->samplerate = 0;
SetSamplingRate(this,0xac44);
this->enabled = false;
return this;
}
// FIREqualizer::Process(int*, int)
void FIREqualizer::Process(int *param_1,int param_2) {
int *piVar1;
uint *puVar2;
int *piVar3;
longlong lVar4;
longlong lVar5;
int *piVar6;
uint uVar7;
int iVar8;
uint uVar9;
uint uVar10;
uint uVar11;
int iVar12;
uint uVar13;
int iVar14;
uint *puVar15;
int *piVar16;
uint uVar17;
int *local_90;
int *local_8c;
uint local_84;
uint local_68 [8];
int local_48;
uint local_44 [9];
piVar16 = (int *)this->field_0x0;
if (((piVar16 != nullptr) && (this->enabled != false)) && (param_2 << 1 != 0)) {
uVar9 = piVar16[0x42e];
local_84 = 0;
local_90 = param_1;
local_8c = param_1 + 1;
do {
piVar6 = piVar16 + uVar9;
iVar8 = 0;
iVar12 = piVar6[0x20a];
iVar14 = piVar6[0x30a];
piVar6[0x20a] = local_8c[-1];
piVar6[0x30a] = local_90[1];
piVar6 = piVar16;
do {
piVar1 = (int *)((int)&DAT_000ce550 + iVar8);
uVar10 = piVar6[0x40a];
iVar8 = iVar8 + 4;
uVar13 = (piVar16 + (uVar9 + *piVar1 & 0xff))[0x20a];
uVar11 = (piVar16 + (uVar9 + *piVar1 & 0xff))[0x30a];
piVar6[0x40a] = uVar10 + uVar13;
piVar6[0x40b] = piVar6[0x40b] + ((int)uVar13 >> 0x1f) + (uint)CARRY4(uVar10,uVar13);
uVar10 = piVar6[0x41c];
piVar6[0x41c] = uVar10 + uVar11;
piVar6[0x41d] = piVar6[0x41d] + ((int)uVar11 >> 0x1f) + (uint)CARRY4(uVar10,uVar11);
piVar6 = piVar6 + 2;
} while (iVar8 != 0x24);
iVar8 = 0;
piVar6 = piVar16;
uVar10 = 0;
do {
puVar15 = (uint *)(piVar6 + 0x40a);
piVar1 = piVar6 + 0x40b;
uVar17 = uVar10 + 1;
puVar2 = (uint *)(piVar6 + 0x41c);
piVar3 = piVar6 + 0x41d;
piVar6 = piVar6 + 2;
uVar11 = *puVar15 >> (uVar17 & 0xff) | *piVar1 << (0x20 - uVar17 & 0xff);
uVar13 = *puVar2 >> (uVar17 & 0xff) | *piVar3 << (0x20 - uVar17 & 0xff);
if (-1 < (int)(uVar10 - 0x1f)) {
uVar11 = uVar11 | *piVar1 >> (uVar10 - 0x1f & 0xff);
}
if (-1 < (int)(uVar10 - 0x1f)) {
uVar13 = uVar13 | *piVar3 >> (uVar10 - 0x1f & 0xff);
}
*(uint *)((int)local_68 + iVar8) = uVar11;
*(uint *)((int)local_44 + iVar8) = uVar13;
iVar8 = iVar8 + 4;
uVar10 = uVar17;
} while (uVar17 != 9);
puVar15 = local_68;
iVar8 = 0;
lVar4 = (longlong)(int)(iVar12 - local_68[0]) * (longlong)*piVar16 + 0x1000000;
uVar13 = (uint)lVar4 >> 0x19 | (int)((ulonglong)lVar4 >> 0x20) << 7;
lVar4 = (longlong)*piVar16 * (longlong)(int)(iVar14 - local_44[0]) + 0x1000000;
uVar17 = (uint)lVar4 >> 0x19 | (int)((ulonglong)lVar4 >> 0x20) << 7;
uVar10 = local_44[0];
uVar11 = local_68[0];
piVar6 = piVar16;
do {
iVar8 = iVar8 + 4;
puVar15 = puVar15 + 1;
uVar7 = *(uint *)((int)local_44 + iVar8);
piVar6 = piVar6 + 1;
lVar4 = (longlong)*piVar6 * (longlong)(int)(uVar10 - uVar7) + 0x1000000;
lVar5 = (longlong)(int)(uVar11 - *puVar15) * (longlong)*piVar6 + 0x1000000;
uVar17 = uVar17 + ((uint)lVar4 >> 0x19 | (int)((ulonglong)lVar4 >> 0x20) << 7);
uVar13 = uVar13 + ((uint)lVar5 >> 0x19 | (int)((ulonglong)lVar5 >> 0x20) << 7);
uVar10 = uVar7;
uVar11 = *puVar15;
} while (iVar8 != 0x20);
iVar8 = 0;
lVar4 = (longlong)local_48 * (longlong)piVar16[9] + 0x1000000;
lVar5 = (longlong)piVar16[9] * (longlong)(int)local_44[8] + 0x1000000;
piVar6 = piVar16;
do {
piVar1 = (int *)((int)&DAT_000ce574 + iVar8);
iVar8 = iVar8 + 4;
uVar7 = (piVar16 + (uVar9 + *piVar1 & 0xff))[10];
uVar10 = (piVar16 + (uVar9 + *piVar1 & 0xff))[0x10a];
uVar11 = piVar6[0x40a];
piVar6[0x40a] = uVar11 - uVar7;
piVar6[0x40b] = piVar6[0x40b] - (((int)uVar7 >> 0x1f) + (uint)(uVar11 < uVar7));
uVar11 = piVar6[0x41c];
piVar6[0x41c] = uVar11 - uVar10;
piVar6[0x41d] = piVar6[0x41d] - (((int)uVar10 >> 0x1f) + (uint)(uVar11 < uVar10));
piVar6 = piVar6 + 2;
} while (iVar8 != 0x24);
local_8c[-1] = uVar13 + ((uint)lVar4 >> 0x19 | (int)((ulonglong)lVar4 >> 0x20) << 7);
local_90[1] = uVar17 + ((uint)lVar5 >> 0x19 | (int)((ulonglong)lVar5 >> 0x20) << 7);
local_84 = local_84 + 2;
iVar8 = piVar16[0x42e];
uVar9 = iVar8 + 1U & 0xff;
(piVar16 + iVar8)[10] = iVar12;
(piVar16 + iVar8)[0x10a] = iVar14;
piVar16[0x42e] = uVar9;
local_90 = local_90 + 2;
local_8c = local_8c + 2;
} while (local_84 < (uint)(param_2 << 1));
}
return;
}

View File

@ -0,0 +1,25 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_FIREQUALIZER_H
#define VIPER_FIREQUALIZER_H
class FIREqualizer {
int* field_0x0;
uint samplerate;
bool enabled;
public:
~FIREqualizer();
void SetBandLevel(uint param_1,float param_2);
void Reset();
undefined4 SetEnable(bool param_1);
void SetSamplingRate(uint param_1);
FIREqualizer();
void Process(int *param_1,int param_2);
};
#endif //VIPER_FIREQUALIZER_H

View File

@ -0,0 +1,250 @@
//
// Created by mart on 2/12/21.
//
#include "PlaybackGain.h"
// PlaybackGain::PlaybackGain()
PlaybackGain::PlaybackGain() {
FixedBiquad::FixedBiquad(&this->field_0x28);
FixedBiquad::FixedBiquad(&this->field_0x4c);
this->field_0x8 = 0;
this->field_0xc = 0x3cd00000;
this->field_0x4 = 0x3ede5bd8;
*(undefined *)&this->field_0x74 = 0;
this->field_0x14 = 0;
this->field_0x18 = 0x2000000;
this->field_0x1c = 0x2000000;
this->field_0x20 = 0x2000000;
this->field_0x24 = 0x2000000;
this->samplerate = 0xac44;
this->field_0x10 = 0x40000000;
this->field_0x0 = 0x3f000000;
FixedBiquad::SetBandPassParameter(&this->field_0x28,0x45098000,0x472c4400,0x3ea8f5c3);
FixedBiquad::SetBandPassParameter
(&this->field_0x4c,0x45098000,(int)(float)(ulonglong)this->samplerate,0x3ea8f5c3);
return this;
}
// PlaybackGain::AnalyseWave(int*, int)
void PlaybackGain::AnalyseWave(int *param_1,int param_2) {
int *piVar1;
longlong lVar2;
int iVar3;
uint uVar4;
uint uVar5;
uint uVar6;
uint uVar7;
int iVar8;
bool bVar9;
if (param_2 * 2 < 1) {
uVar6 = 0;
uVar7 = 0;
}
else {
uVar4 = 0;
uVar5 = 0;
iVar8 = 0;
uVar6 = 0;
uVar7 = 0;
do {
iVar3 = FixedBiquad::ProcessSample(&this->field_0x28,*param_1);
iVar8 = iVar8 + 2;
piVar1 = param_1 + 1;
lVar2 = (longlong)iVar3 * (longlong)iVar3 + CONCAT44(uVar7,uVar6);
uVar6 = (uint)lVar2;
uVar7 = (uint)((ulonglong)lVar2 >> 0x20);
param_1 = param_1 + 2;
iVar3 = FixedBiquad::ProcessSample(&this->field_0x4c,*piVar1);
lVar2 = (longlong)iVar3 * (longlong)iVar3 + CONCAT44(uVar5,uVar4);
uVar4 = (uint)lVar2;
uVar5 = (uint)((ulonglong)lVar2 >> 0x20);
} while (iVar8 + param_2 * -2 < 0 != SBORROW4(iVar8,param_2 * 2));
bVar9 = uVar5 <= uVar7;
if (uVar7 == uVar5) {
bVar9 = uVar4 <= uVar6;
}
if (!bVar9) {
uVar6 = uVar4;
uVar7 = uVar5;
}
}
__aeabi_uldivmod(uVar6,uVar7,param_2,param_2 >> 0x1f);
return;
}
// PlaybackGain::SetRatio(float)
void PlaybackGain::SetRatio(float param_1) {
float in_r1;
this->field_0x10 = in_r1 + 1.0;
this->field_0x0 = 1.0 / (in_r1 + 1.0);
return;
}
// PlaybackGain::SetVolume(float)
void PlaybackGain::SetVolume(float param_1) {
float in_r1;
this->field_0x18 = ROUND(in_r1 * 3.355443e+07 + 0.5);
return;
}
// PlaybackGain::SetMaxGainFactor(float)
void PlaybackGain::SetMaxGainFactor(float param_1) {
float in_r1;
this->field_0x1c = ROUND(in_r1 * 3.355443e+07 + 0.5);
return;
}
// PlaybackGain::Reset()
void PlaybackGain::Reset() {
FixedBiquad::SetBandPassParameter
(&this->field_0x28,0x45098000,(int)(float)(ulonglong)this->samplerate,0x3ea8f5c3);
FixedBiquad::SetBandPassParameter
(&this->field_0x4c,0x45098000,(int)(float)(ulonglong)this->samplerate,0x3ea8f5c3);
this->field_0x14 = 0;
this->field_0x20 = 0x2000000;
this->field_0x24 = 0x2000000;
return;
}
// PlaybackGain::SetEnable(bool)
undefined4 PlaybackGain::SetEnable(bool param_1) {
undefined4 uVar1;
if ((bool)*(char *)&this->field_0x74 == param_1) {
uVar1 = 0;
}
else {
if ((*(char *)&this->field_0x74 == '\0') && (param_1 != false)) {
Reset(this);
}
uVar1 = 1;
*(bool *)&this->field_0x74 = param_1;
}
return uVar1;
}
// PlaybackGain::SetSamplingRate(unsigned int)
void PlaybackGain::SetSamplingRate(uint param_1) {
if (this->samplerate == param_1) {
return;
}
this->samplerate = param_1;
Reset(this);
return;
}
// PlaybackGain::Process(int*, int)
void PlaybackGain::Process(int *param_1,int param_2) {
longlong lVar1;
uint uVar2;
int iVar3;
int iVar4;
int iVar5;
int iVar6;
uint uVar7;
PlaybackGain *pPVar8;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr2;
undefined4 in_cr5;
undefined4 in_cr6;
undefined4 in_cr7;
float fVar9;
float __y;
undefined8 uVar10;
undefined4 in_d18;
undefined4 in_register_00000394;
longlong lVar11;
if (*(char *)&this->field_0x74 == '\0') {
return;
}
AnalyseWave(this,param_1,param_2);
fVar9 = (float)__floatundidf();
coprocessor_function(0xb,6,5,in_cr0,in_cr1,in_cr0);
fVar9 = logf(fVar9);
coprocessor_function(10,2,0,in_cr6,in_cr7,in_cr6);
if ((int)this->field_0x14 < 100) {
this->field_0x14 = this->field_0x14 + 1;
}
coprocessor_function(10,6,5,in_cr7,in_cr5,in_cr7);
coprocessor_function(10,2,0,in_cr7,in_cr7,in_cr7);
powf(fVar9,__y);
coprocessor_function(0xb,6,5,in_cr2,in_cr1,in_cr0);
lVar11 = __fixdfdi(in_d18,in_register_00000394);
uVar2 = this->samplerate / 0x28;
if ((int)uVar2 < param_2) {
uVar2 = param_2;
}
uVar10 = VectorShiftRight(CONCAT44(uVar2,uVar2),0x20);
pPVar8 = this;
do {
uVar7 = pPVar8->field_0x20;
lVar1 = lVar11 * (int)this->field_0x18 + 0x1000000;
iVar3 = (int)((ulonglong)lVar1 >> 0x20);
uVar2 = (uint)lVar1 >> 0x19 | iVar3 * 0x80;
iVar3 = __aeabi_ldivmod(uVar2 - uVar7,
(iVar3 >> 0x19) - (((int)uVar7 >> 0x1f) + (uint)(uVar2 < uVar7)),
(int)uVar10,(int)((ulonglong)uVar10 >> 0x20));
if (0 < iVar3) {
iVar3 = iVar3 >> 4;
}
if (param_2 != 0) {
iVar4 = 0;
while( true ) {
lVar1 = (longlong)*(int *)((int)param_1 + iVar4) * (longlong)(int)uVar7 + 0x1000000;
*(uint *)((int)param_1 + iVar4) = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7
;
iVar6 = this->field_0x1c;
iVar5 = iVar3 + pPVar8->field_0x20;
if (iVar6 < iVar5) {
pPVar8->field_0x20 = iVar6;
}
else {
if (-iVar6 < iVar5) {
pPVar8->field_0x20 = iVar5;
}
else {
pPVar8->field_0x20 = -iVar6;
}
}
iVar4 = iVar4 + 8;
if (iVar4 == param_2 * 8) break;
uVar7 = pPVar8->field_0x20;
}
}
pPVar8 = (PlaybackGain *)&pPVar8->field_0x4;
param_1 = param_1 + 1;
} while (pPVar8 != (PlaybackGain *)&this->field_0x8);
return;
}

View File

@ -0,0 +1,41 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_PLAYBACKGAIN_H
#define VIPER_PLAYBACKGAIN_H
class PlaybackGain {
undefined4 field_0x0;
undefined4 field_0x4;
undefined4 field_0x8;
undefined4 field_0xc;
undefined4 field_0x10;
undefined4 field_0x14;
undefined4 field_0x18;
undefined4 field_0x1c;
undefined4 field_0x20;
undefined4 field_0x24;
struct FixedBiquad field_0x28;
struct FixedBiquad field_0x4c;
uint samplerate;
undefined field_0x74;
undefined field_0x75;
undefined field_0x76;
undefined field_0x77;
public:
PlaybackGain();
void AnalyseWave(int *param_1,int param_2);
void SetRatio(float param_1);
void SetVolume(float param_1);
void SetMaxGainFactor(float param_1);
void Reset();
undefined4 SetEnable(bool param_1);
void SetSamplingRate(uint param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_PLAYBACKGAIN_H

View File

@ -0,0 +1,134 @@
//
// Created by mart on 2/12/21.
//
#include "Reverberation.h"
// Reverberation::Reverberation()
Reverberation::Reverberation() {
CRevModel *this_00;
this_00 = &this->field_0x14;
CRevModel::CRevModel(this_00);
this->roomSize = 0;
this->width = 0.0;
this->damp = 0.0;
this->wet = 0.0;
this->dry = 0.5;
CRevModel::SetRoomSize(this_00,0);
CRevModel::SetWidth(this_00,(int)ROUND(this->width * 3.355443e+07 + 0.5));
CRevModel::SetDamp(this_00,(int)ROUND(this->damp * 3.355443e+07 + 0.5));
CRevModel::SetWet(this_00,(int)ROUND(this->wet * 3.355443e+07 + 0.5));
CRevModel::SetDry(this_00,(int)ROUND(this->dry * 3.355443e+07 + 0.5));
CRevModel::~ZN9CRevModel5ResetEv(this_00);
this->samplerate = 0xac44;
this->enabled = false;
return this;
}
// Reverberation::SetSamplingRate(unsigned int)
void Reverberation::SetSamplingRate(uint param_1) {
if (this->samplerate == param_1) {
return;
}
this->samplerate = param_1;
CRevModel::~ZN9CRevModel5ResetEv(&this->field_0x14);
return;
}
// Reverberation::SetRoomSize(float)
void Reverberation::SetRoomSize(int param_1) {
this->roomSize = param_1;
CRevModel::SetRoomSize(&this->field_0x14,(int)ROUND((float)param_1 * 3.355443e+07 + 0.5));
return;
}
// Reverberation::SetWidth(float)
void Reverberation::SetWidth(int param_1) {
this->width = (float)param_1;
CRevModel::SetWidth(&this->field_0x14,(int)ROUND((float)param_1 * 3.355443e+07 + 0.5));
return;
}
// Reverberation::SetDamp(float)
void Reverberation::SetDamp(int param_1) {
this->damp = (float)param_1;
CRevModel::SetDamp(&this->field_0x14,(int)ROUND((float)param_1 * 3.355443e+07 + 0.5));
return;
}
// Reverberation::SetWet(float)
void Reverberation::SetWet(int param_1) {
this->wet = (float)param_1;
CRevModel::SetWet(&this->field_0x14,(int)ROUND((float)param_1 * 3.355443e+07 + 0.5));
return;
}
// Reverberation::SetDry(float)
void Reverberation::SetDry(int param_1) {
this->dry = (float)param_1;
CRevModel::SetDry(&this->field_0x14,(int)ROUND((float)param_1 * 3.355443e+07 + 0.5));
return;
}
// Reverberation::Reset()
void Reverberation::Reset() {
CRevModel::~ZN9CRevModel5ResetEv(&this->field_0x14);
return;
}
// Reverberation::SetEnable(bool)
undefined4 Reverberation::SetEnable(bool param_1) {
bool cVar1;
cVar1 = this->enabled;
if (cVar1 == false) {
if (param_1 == false) {
return 0;
}
Reset(this);
cVar1 = this->enabled;
}
if (param_1 == cVar1) {
return 0;
}
this->enabled = param_1;
return 1;
}
// Reverberation::Process(int*, int)
void Reverberation::Process(int *param_1,int param_2) {
if (this->enabled == false) {
return;
}
CRevModel::ProcessReplace(&this->field_0x14,param_1,param_1 + 1,param_2);
return;
}

View File

@ -0,0 +1,36 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_REVERBERATION_H
#define VIPER_REVERBERATION_H
class Reverberation {
undefined4 roomSize;
float width;
float damp;
float wet;
float dry;
struct CRevModel field_0x14;
undefined4 samplerate;
bool enabled;
undefined field_0x2e9;
undefined field_0x2ea;
undefined field_0x2eb;
public:
Reverberation();
void SetSamplingRate(uint param_1);
void SetRoomSize(int param_1);
void SetWidth(int param_1);
void SetDamp(int param_1);
void SetWet(int param_1);
void SetDry(int param_1);
void Reset();
undefined4 SetEnable(bool param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_REVERBERATION_H

View File

@ -0,0 +1,123 @@
//
// Created by mart on 2/12/21.
//
#include "SpeakerCorrection.h"
// SpeakerCorrection::Reset()
void SpeakerCorrection::Reset() {
undefined8 uVar1;
undefined8 extraout_d0;
float extraout_s2;
float extraout_s2_00;
float extraout_s2_01;
float extraout_s2_02;
float extraout_s3;
float extraout_s3_00;
FixedBiquad::Reset(&this->field_0x50);
FixedBiquad::Reset(&this->field_0x74);
FixedBiquad::Reset(&this->field_0x98);
uVar1 = FixedBiquad::Reset(&this->field_0xbc);
uVar1 = MultiBiquad::RefreshFilter
(&this->field_0x8,1,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),extraout_s2,
extraout_s3,false);
uVar1 = MultiBiquad::RefreshFilter
(&this->field_0x2c,1,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),
extraout_s2_00,extraout_s3_00,false);
FixedBiquad::SetLowPassParameter
(&this->field_0x50,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),extraout_s2_01);
FixedBiquad::SetLowPassParameter
(&this->field_0x74,(float)extraout_d0,(float)((ulonglong)extraout_d0 >> 0x20),
extraout_s2_02);
FixedBiquad::SetBandPassParameter
(&this->field_0x98,0x43d20000,(int)(float)(ulonglong)this->samplerate,0x407851ec);
FixedBiquad::SetBandPassParameter
(&this->field_0xbc,0x43d20000,(int)(float)(ulonglong)this->samplerate,0x407851ec);
return;
}
// SpeakerCorrection::SpeakerCorrection()
SpeakerCorrection::SpeakerCorrection() {
MultiBiquad::MultiBiquad(&this->field_0x8);
MultiBiquad::MultiBiquad(&this->field_0x2c);
FixedBiquad::FixedBiquad(&this->field_0x50);
FixedBiquad::FixedBiquad(&this->field_0x74);
FixedBiquad::FixedBiquad(&this->field_0x98);
FixedBiquad::FixedBiquad(&this->field_0xbc);
this->samplerate = 0xac44;
this->enabled = false;
Reset(this);
return this;
}
// SpeakerCorrection::SetEnable(bool)
undefined4 SpeakerCorrection::SetEnable(bool param_1) {
bool cVar1;
cVar1 = this->enabled;
if (cVar1 == false) {
if (param_1 == false) {
return 0;
}
Reset(this);
cVar1 = this->enabled;
}
if (param_1 == cVar1) {
return 0;
}
this->enabled = param_1;
return 1;
}
// SpeakerCorrection::SetSamplingRate(unsigned int)
void SpeakerCorrection::SetSamplingRate(uint param_1) {
if (this->samplerate == param_1) {
return;
}
this->samplerate = param_1;
Reset(this);
return;
}
// SpeakerCorrection::Process(int*, int)
void SpeakerCorrection::Process(int *param_1,int param_2) {
longlong lVar1;
int iVar2;
uint uVar3;
int iVar4;
if ((this->enabled != false) && (0 < param_2 * 2)) {
iVar4 = 0;
do {
iVar2 = FixedBiquad::ProcessSample(&this->field_0x50,*param_1);
iVar2 = MultiBiquad::ProcessSample(&this->field_0x8,iVar2);
lVar1 = (longlong)iVar2 * 0x1000000 + 0x1000000;
iVar4 = iVar4 + 2;
uVar3 = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
iVar2 = FixedBiquad::ProcessSample(&this->field_0x98,uVar3);
*param_1 = iVar2 + uVar3;
iVar2 = FixedBiquad::ProcessSample(&this->field_0x74,param_1[1]);
iVar2 = MultiBiquad::ProcessSample(&this->field_0x2c,iVar2);
lVar1 = (longlong)iVar2 * 0x1000000 + 0x1000000;
uVar3 = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
iVar2 = FixedBiquad::ProcessSample(&this->field_0xbc,uVar3);
param_1[1] = iVar2 + uVar3;
param_1 = param_1 + 2;
} while (iVar4 + param_2 * -2 < 0 != SBORROW4(iVar4,param_2 * 2));
}
return;
}

View File

@ -0,0 +1,31 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_SPEAKERCORRECTION_H
#define VIPER_SPEAKERCORRECTION_H
class SpeakerCorrection {
uint samplerate;
bool enabled; // Created by retype action
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
struct MultiBiquad field_0x8;
struct MultiBiquad field_0x2c;
struct FixedBiquad field_0x50;
struct FixedBiquad field_0x74;
struct FixedBiquad field_0x98;
struct FixedBiquad field_0xbc;
public:
void Reset();
SpeakerCorrection();
undefined4 SetEnable(bool param_1);
void SetSamplingRate(uint param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_SPEAKERCORRECTION_H

View File

@ -0,0 +1,174 @@
//
// Created by mart on 2/12/21.
//
#include "SpectrumExtend.h"
// SpectrumExtend::~SpectrumExtend()
SpectrumExtend::~SpectrumExtend() {
Harmonic *this_00;
if (this != (SpectrumExtend *)0xffffff70) {
this_00 = (Harmonic *)&this->field_0x108;
do {
this_00 = this_00 + -1;
Harmonic::~Harmonic(this_00);
} while ((Harmonic *)&this->field_0x90 != this_00);
}
return this;
}
// SpectrumExtend::Reset()
void SpectrumExtend::Reset(void) {
MultiBiquad *in_r0;
float in_s0;
float in_s1;
undefined8 uVar1;
float in_s2;
float extraout_s2;
float extraout_s2_00;
float extraout_s2_01;
float in_s3;
float extraout_s3;
float extraout_s3_00;
float extraout_s3_01;
uVar1 = MultiBiquad::RefreshFilter(in_r0,1,in_s0,in_s1,in_s2,in_s3,false);
uVar1 = MultiBiquad::RefreshFilter
(in_r0 + 1,1,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),extraout_s2,
extraout_s3,false);
uVar1 = MultiBiquad::RefreshFilter
(in_r0 + 2,0,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),extraout_s2_00,
extraout_s3_00,false);
MultiBiquad::RefreshFilter
(in_r0 + 3,0,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),extraout_s2_01,
extraout_s3_01,false);
Harmonic::Reset((Harmonic *)(in_r0 + 4));
Harmonic::Reset((Harmonic *)&in_r0[5].field_0x18);
Harmonic::SetHarmonics((Harmonic *)(in_r0 + 4),(float *)&DAT_000ce848);
Harmonic::SetHarmonics((Harmonic *)&in_r0[5].field_0x18,(float *)&DAT_000ce848);
return;
}
// SpectrumExtend::SpectrumExtend()
SpectrumExtend::SpectrumExtend() {
MultiBiquad::MultiBiquad((MultiBiquad *)this);
MultiBiquad::MultiBiquad((MultiBiquad *)&this->field_0x24);
MultiBiquad::MultiBiquad((MultiBiquad *)&this->field_0x48);
MultiBiquad::MultiBiquad((MultiBiquad *)&this->field_0x6c);
Harmonic::Harmonic((Harmonic *)&this->field_0x90);
Harmonic::Harmonic((Harmonic *)&this->field_0xcc);
*(undefined4 *)&this->field_0x10c = 0xac44;
*(undefined4 *)&this->field_0x110 = 0x1db0;
*(undefined *)&this->field_0x108 = 0;
*(undefined4 *)&this->field_0x114 = 0;
Reset();
return this;
}
// SpectrumExtend::SetEnable(bool)
undefined4 SpectrumExtend::SetEnable(bool param_1) {
char cVar1;
cVar1 = *(char *)&this->field_0x108;
if (cVar1 == '\0') {
if (param_1 == false) {
return 0;
}
Reset();
cVar1 = *(char *)&this->field_0x108;
}
if (param_1 == (bool)cVar1) {
return 0;
}
*(bool *)&this->field_0x108 = param_1;
return 1;
}
// SpectrumExtend::SetSamplingRate(int)
void SpectrumExtend::SetSamplingRate(int param_1) {
if (*(int *)&this->field_0x10c != param_1) {
*(int *)&this->field_0x10c = param_1;
if (param_1 / 2 + -99 <= *(int *)&this->field_0x110) {
*(int *)&this->field_0x110 = param_1 / 2 + -100;
}
Reset();
return;
}
return;
}
// SpectrumExtend::SetReferenceFrequency(int)
void SpectrumExtend::SetReferenceFrequency(int param_1) {
int iVar1;
iVar1 = *(int *)&this->field_0x10c / 2;
if (iVar1 + -99 <= param_1) {
param_1 = iVar1 + -100;
}
*(int *)&this->field_0x110 = param_1;
Reset();
return;
}
// SpectrumExtend::SetExciter(float)
void SpectrumExtend::SetExciter(float param_1) {
float in_r1;
*(float *)&this->field_0x114 = ROUND(in_r1 * 3.355443e+07 + 0.5);
return;
}
// SpectrumExtend::Process(int*, int)
void SpectrumExtend::Process(int *param_1,int param_2) {
ulonglong uVar1;
int iVar2;
int iVar3;
undefined8 uVar4;
int local_40;
if ((*(char *)&this->field_0x108 != '\0') && (0 < param_2 * 2)) {
iVar3 = 0;
do {
iVar2 = MultiBiquad::ProcessSample((MultiBiquad *)this,*param_1);
iVar2 = Harmonic::Process((Harmonic *)&this->field_0x90,iVar2);
iVar3 = iVar3 + 2;
uVar1 = (longlong)iVar2 * (longlong)*(int *)&this->field_0x114 + 0x1000000;
uVar4 = VectorShiftRight((uVar1 & 0xffffffff00000000) + (uVar1 & 0xffffffff),0x19);
local_40 = (int)uVar4;
iVar2 = MultiBiquad::ProcessSample((MultiBiquad *)&this->field_0x48,local_40);
*param_1 = *param_1 + iVar2;
iVar2 = MultiBiquad::ProcessSample((MultiBiquad *)&this->field_0x24,param_1[1]);
iVar2 = Harmonic::Process((Harmonic *)&this->field_0xcc,iVar2);
uVar1 = (longlong)iVar2 * (longlong)*(int *)&this->field_0x114 + 0x1000000;
uVar4 = VectorShiftRight((uVar1 & 0xffffffff00000000) + (uVar1 & 0xffffffff),0x19);
local_40 = (int)uVar4;
iVar2 = MultiBiquad::ProcessSample((MultiBiquad *)&this->field_0x6c,local_40);
param_1[1] = param_1[1] + iVar2;
param_1 = param_1 + 2;
} while (iVar3 + param_2 * -2 < 0 != SBORROW4(iVar3,param_2 * 2));
}
return;
}

View File

@ -0,0 +1,303 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_SPECTRUMEXTEND_H
#define VIPER_SPECTRUMEXTEND_H
class SpectrumExtend {
undefined field_0x0;
undefined field_0x1;
undefined field_0x2;
undefined field_0x3;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
undefined field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined field_0x18;
undefined field_0x19;
undefined field_0x1a;
undefined field_0x1b;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
undefined field_0x20;
undefined field_0x21;
undefined field_0x22;
undefined field_0x23;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
undefined field_0x28;
undefined field_0x29;
undefined field_0x2a;
undefined field_0x2b;
undefined field_0x2c;
undefined field_0x2d;
undefined field_0x2e;
undefined field_0x2f;
undefined field_0x30;
undefined field_0x31;
undefined field_0x32;
undefined field_0x33;
undefined field_0x34;
undefined field_0x35;
undefined field_0x36;
undefined field_0x37;
undefined field_0x38;
undefined field_0x39;
undefined field_0x3a;
undefined field_0x3b;
undefined field_0x3c;
undefined field_0x3d;
undefined field_0x3e;
undefined field_0x3f;
undefined field_0x40;
undefined field_0x41;
undefined field_0x42;
undefined field_0x43;
undefined field_0x44;
undefined field_0x45;
undefined field_0x46;
undefined field_0x47;
undefined field_0x48;
undefined field_0x49;
undefined field_0x4a;
undefined field_0x4b;
undefined field_0x4c;
undefined field_0x4d;
undefined field_0x4e;
undefined field_0x4f;
undefined field_0x50;
undefined field_0x51;
undefined field_0x52;
undefined field_0x53;
undefined field_0x54;
undefined field_0x55;
undefined field_0x56;
undefined field_0x57;
undefined field_0x58;
undefined field_0x59;
undefined field_0x5a;
undefined field_0x5b;
undefined field_0x5c;
undefined field_0x5d;
undefined field_0x5e;
undefined field_0x5f;
undefined field_0x60;
undefined field_0x61;
undefined field_0x62;
undefined field_0x63;
undefined field_0x64;
undefined field_0x65;
undefined field_0x66;
undefined field_0x67;
undefined field_0x68;
undefined field_0x69;
undefined field_0x6a;
undefined field_0x6b;
undefined field_0x6c;
undefined field_0x6d;
undefined field_0x6e;
undefined field_0x6f;
undefined field_0x70;
undefined field_0x71;
undefined field_0x72;
undefined field_0x73;
undefined field_0x74;
undefined field_0x75;
undefined field_0x76;
undefined field_0x77;
undefined field_0x78;
undefined field_0x79;
undefined field_0x7a;
undefined field_0x7b;
undefined field_0x7c;
undefined field_0x7d;
undefined field_0x7e;
undefined field_0x7f;
undefined field_0x80;
undefined field_0x81;
undefined field_0x82;
undefined field_0x83;
undefined field_0x84;
undefined field_0x85;
undefined field_0x86;
undefined field_0x87;
undefined field_0x88;
undefined field_0x89;
undefined field_0x8a;
undefined field_0x8b;
undefined field_0x8c;
undefined field_0x8d;
undefined field_0x8e;
undefined field_0x8f;
undefined field_0x90;
undefined field_0x91;
undefined field_0x92;
undefined field_0x93;
undefined field_0x94;
undefined field_0x95;
undefined field_0x96;
undefined field_0x97;
undefined field_0x98;
undefined field_0x99;
undefined field_0x9a;
undefined field_0x9b;
undefined field_0x9c;
undefined field_0x9d;
undefined field_0x9e;
undefined field_0x9f;
undefined field_0xa0;
undefined field_0xa1;
undefined field_0xa2;
undefined field_0xa3;
undefined field_0xa4;
undefined field_0xa5;
undefined field_0xa6;
undefined field_0xa7;
undefined field_0xa8;
undefined field_0xa9;
undefined field_0xaa;
undefined field_0xab;
undefined field_0xac;
undefined field_0xad;
undefined field_0xae;
undefined field_0xaf;
undefined field_0xb0;
undefined field_0xb1;
undefined field_0xb2;
undefined field_0xb3;
undefined field_0xb4;
undefined field_0xb5;
undefined field_0xb6;
undefined field_0xb7;
undefined field_0xb8;
undefined field_0xb9;
undefined field_0xba;
undefined field_0xbb;
undefined field_0xbc;
undefined field_0xbd;
undefined field_0xbe;
undefined field_0xbf;
undefined field_0xc0;
undefined field_0xc1;
undefined field_0xc2;
undefined field_0xc3;
undefined field_0xc4;
undefined field_0xc5;
undefined field_0xc6;
undefined field_0xc7;
undefined field_0xc8;
undefined field_0xc9;
undefined field_0xca;
undefined field_0xcb;
undefined field_0xcc;
undefined field_0xcd;
undefined field_0xce;
undefined field_0xcf;
undefined field_0xd0;
undefined field_0xd1;
undefined field_0xd2;
undefined field_0xd3;
undefined field_0xd4;
undefined field_0xd5;
undefined field_0xd6;
undefined field_0xd7;
undefined field_0xd8;
undefined field_0xd9;
undefined field_0xda;
undefined field_0xdb;
undefined field_0xdc;
undefined field_0xdd;
undefined field_0xde;
undefined field_0xdf;
undefined field_0xe0;
undefined field_0xe1;
undefined field_0xe2;
undefined field_0xe3;
undefined field_0xe4;
undefined field_0xe5;
undefined field_0xe6;
undefined field_0xe7;
undefined field_0xe8;
undefined field_0xe9;
undefined field_0xea;
undefined field_0xeb;
undefined field_0xec;
undefined field_0xed;
undefined field_0xee;
undefined field_0xef;
undefined field_0xf0;
undefined field_0xf1;
undefined field_0xf2;
undefined field_0xf3;
undefined field_0xf4;
undefined field_0xf5;
undefined field_0xf6;
undefined field_0xf7;
undefined field_0xf8;
undefined field_0xf9;
undefined field_0xfa;
undefined field_0xfb;
undefined field_0xfc;
undefined field_0xfd;
undefined field_0xfe;
undefined field_0xff;
undefined field_0x100;
undefined field_0x101;
undefined field_0x102;
undefined field_0x103;
undefined field_0x104;
undefined field_0x105;
undefined field_0x106;
undefined field_0x107;
undefined field_0x108;
undefined field_0x109;
undefined field_0x10a;
undefined field_0x10b;
undefined field_0x10c;
undefined field_0x10d;
undefined field_0x10e;
undefined field_0x10f;
undefined field_0x110;
undefined field_0x111;
undefined field_0x112;
undefined field_0x113;
undefined field_0x114;
undefined field_0x115;
undefined field_0x116;
undefined field_0x117;
public:
~SpectrumExtend();
void Reset();
SpectrumExtend();
undefined4 SetEnable(bool param_1);
void SetSamplingRate(int param_1);
void SetReferenceFrequency(int param_1);
void SetExciter(float param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_SPECTRUMEXTEND_H

View File

@ -0,0 +1,166 @@
//
// Created by mart on 2/12/21.
//
#include "Stereo3DSurround.h"
// Stereo3DSurround::Stereo3DSurround()
Stereo3DSurround::Stereo3DSurround() {
this->field_0x4 = 0x2000000;
this->field_0x0 = 0.0;
this->field_0x8 = 0x2000000;
this->field_0xc = 0x1000000;
this->field_0x10 = 0x1000000;
this->field_0x14 = 0x1000000;
return;
}
// Stereo3DSurround::SetStereoWiden(float)
float Stereo3DSurround::SetStereoWiden(float param_1) {
uint uVar1;
float in_r1;
int iVar2;
uint uVar3;
uint uVar4;
uint uVar5;
uint uVar6;
float extraout_s0;
float fVar7;
this->field_0x0 = in_r1;
fVar7 = ROUND(in_r1 * 3.355443e+07 + 0.5);
uVar3 = (int)fVar7 + 0x2000000;
this->field_0x8 = uVar3;
if ((int)uVar3 < 0x2000000) {
uVar1 = 0x1000000;
iVar2 = 0;
}
else {
iVar2 = (int)fVar7 + 0x4000000;
uVar1 = __aeabi_ldivmod(0,0x40000,iVar2,iVar2 >> 0x1f);
iVar2 = (int)uVar1 >> 0x1f;
param_1 = extraout_s0;
}
uVar5 = this->field_0x4;
uVar4 = (uint)((ulonglong)uVar1 * (ulonglong)uVar3);
this->field_0xc = uVar1;
uVar6 = (uint)((ulonglong)uVar1 * (ulonglong)uVar5);
this->field_0x10 =
uVar6 + 0x1000000 >> 0x19 |
(uVar1 * ((int)uVar5 >> 0x1f) + uVar5 * iVar2 +
(int)((ulonglong)uVar1 * (ulonglong)uVar5 >> 0x20) + (uint)(0xfeffffff < uVar6)) * 0x80;
this->field_0x14 =
uVar4 + 0x1000000 >> 0x19 |
(uVar1 * ((int)uVar3 >> 0x1f) + uVar3 * iVar2 +
(int)((ulonglong)uVar1 * (ulonglong)uVar3 >> 0x20) + (uint)(0xfeffffff < uVar4)) * 0x80;
return param_1;
}
// Stereo3DSurround::SetMiddleImage(float)
float Stereo3DSurround::SetMiddleImage(float param_1) {
uint uVar1;
float in_r1;
int iVar2;
uint uVar3;
uint uVar4;
uint uVar5;
float extraout_s0;
float fVar6;
float fVar7;
undefined8 uVar8;
int iStack36;
fVar7 = ROUND(this->field_0x0 * 3.355443e+07 + 0.5);
fVar6 = ROUND(in_r1 * 3.355443e+07 + 0.5);
uVar3 = (int)fVar7 + 0x2000000;
this->field_0x4 = (uint)fVar6;
this->field_0x8 = uVar3;
if ((int)uVar3 < 0x2000000) {
uVar1 = 0x1000000;
iVar2 = 0;
}
else {
iVar2 = (int)fVar7 + 0x4000000;
uVar1 = __aeabi_ldivmod(0,0x40000,iVar2,iVar2 >> 0x1f);
iVar2 = (int)uVar1 >> 0x1f;
param_1 = extraout_s0;
}
this->field_0xc = uVar1;
uVar8 = VectorShiftRight(CONCAT44(uVar3,uVar3),0x20);
iStack36 = (int)((ulonglong)uVar8 >> 0x20);
uVar5 = (uint)((ulonglong)uVar1 * (ulonglong)(uint)fVar6);
uVar4 = (uint)((ulonglong)uVar1 * (ulonglong)uVar3);
this->field_0x10 =
uVar5 + 0x1000000 >> 0x19 |
(uVar1 * ((int)fVar6 >> 0x1f) + (int)fVar6 * iVar2 +
(int)((ulonglong)uVar1 * (ulonglong)(uint)fVar6 >> 0x20) + (uint)(0xfeffffff < uVar5)) *
0x80;
this->field_0x14 =
uVar4 + 0x1000000 >> 0x19 |
(uVar1 * iStack36 + uVar3 * iVar2 + (int)((ulonglong)uVar1 * (ulonglong)uVar3 >> 0x20) +
(uint)(0xfeffffff < uVar4)) * 0x80;
return param_1;
}
// Stereo3DSurround::Process(int*, int)
void Stereo3DSurround::Process(int *param_1,int param_2) {
uint uVar1;
longlong lVar2;
longlong lVar3;
uint uVar4;
uint uVar5;
uint uVar6;
int *piVar7;
uint uVar8;
int *piVar9;
uVar1 = param_2 << 1;
uVar4 = uVar1 & 0xfffffffc;
if (uVar4 != 0) {
uVar8 = 0;
piVar7 = param_1 + 1;
piVar9 = param_1;
do {
uVar8 = uVar8 + 4;
lVar2 = (longlong)(int)this->field_0x10 * (longlong)(piVar7[-1] + piVar9[1]) + 0x1000000;
uVar6 = (uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7;
lVar2 = (longlong)(int)this->field_0x14 * (longlong)(piVar9[1] - piVar7[-1]) + 0x1000000;
lVar3 = (longlong)(int)this->field_0x10 * (longlong)(piVar9[2] + piVar9[3]) + 0x1000000;
uVar5 = (uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7;
lVar2 = (longlong)(int)this->field_0x14 * (longlong)(piVar9[3] - piVar9[2]) + 0x1000000;
piVar7[-1] = uVar6 - uVar5;
piVar9[1] = uVar5 + uVar6;
uVar5 = (uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7;
uVar6 = (uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7;
piVar9[2] = uVar6 - uVar5;
piVar9[3] = uVar5 + uVar6;
piVar7 = piVar7 + 4;
piVar9 = piVar9 + 4;
} while (uVar8 < uVar4);
}
if ((uVar1 & 2) != 0) {
while (uVar4 < uVar1) {
lVar2 = (longlong)(int)this->field_0x10 * (longlong)(param_1[uVar4] + param_1[uVar4 + 1]) +
0x1000000;
lVar3 = (longlong)(int)this->field_0x14 * (longlong)(param_1[uVar4 + 1] - param_1[uVar4]) +
0x1000000;
uVar5 = (uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7;
uVar8 = (uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7;
param_1[uVar4] = uVar5 - uVar8;
param_1[uVar4 + 1] = uVar8 + uVar5;
uVar4 = uVar4 + 2;
}
}
return;
}

View File

@ -0,0 +1,27 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_STEREOSURROUND_H
#define VIPER_STEREOSURROUND_H
#include "../libv4a_fx.so.h"
class Stereo3DSurround {
float field_0x0;
uint field_0x4;
uint field_0x8;
uint field_0xc;
uint field_0x10;
uint field_0x14;
public:
Stereo3DSurround();
float SetStereoWiden(float param_1);
float SetMiddleImage(float param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_STEREOSURROUND_H

158
src/effects/Subwoofer.cpp Normal file
View File

@ -0,0 +1,158 @@
//
// Created by mart on 2/12/21.
//
#include "Subwoofer.h"
// Subwoofer::Subwoofer()
Subwoofer::Subwoofer() {
undefined8 uVar1;
float extraout_s2;
float extraout_s2_00;
float extraout_s2_01;
float extraout_s2_02;
float extraout_s2_03;
float extraout_s2_04;
float extraout_s3;
float extraout_s3_00;
float extraout_s3_01;
float extraout_s3_02;
float extraout_s3_03;
float extraout_s3_04;
MultiBiquad::MultiBiquad((MultiBiquad *)this);
MultiBiquad::MultiBiquad((MultiBiquad *)(this + 0x24));
MultiBiquad::MultiBiquad((MultiBiquad *)(this + 0x48));
MultiBiquad::MultiBiquad((MultiBiquad *)(this + 0x6c));
MultiBiquad::MultiBiquad((MultiBiquad *)(this + 0x90));
uVar1 = MultiBiquad::MultiBiquad((MultiBiquad *)(this + 0xb4));
uVar1 = MultiBiquad::RefreshFilter
((MultiBiquad *)this,5,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),
extraout_s2,extraout_s3,false);
uVar1 = MultiBiquad::RefreshFilter
((MultiBiquad *)(this + 0x24),5,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),
extraout_s2_00,extraout_s3_00,false);
uVar1 = MultiBiquad::RefreshFilter
((MultiBiquad *)(this + 0x48),5,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),
extraout_s2_01,extraout_s3_01,false);
uVar1 = MultiBiquad::RefreshFilter
((MultiBiquad *)(this + 0x6c),5,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),
extraout_s2_02,extraout_s3_02,false);
uVar1 = MultiBiquad::RefreshFilter
((MultiBiquad *)(this + 0x90),0,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),
extraout_s2_03,extraout_s3_03,false);
MultiBiquad::RefreshFilter
((MultiBiquad *)(this + 0xb4),0,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),
extraout_s2_04,extraout_s3_04,false);
return this;
}
// WARNING: Unknown calling convention yet parameter storage is locked
// Subwoofer::SetBassGain(int, float)
void Subwoofer::SetBassGain(int param_1,float param_2) {
float in_r2;
char in_NG;
bool in_ZR;
char in_OV;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr7;
undefined4 in_cr8;
undefined4 in_cr9;
undefined4 in_s1;
undefined8 uVar1;
double dVar2;
float in_s2;
float extraout_s2;
float extraout_s2_00;
float extraout_s2_01;
float extraout_s2_02;
float extraout_s2_03;
float extraout_s2_04;
float in_s3;
float extraout_s3;
float extraout_s3_00;
float extraout_s3_01;
float extraout_s3_02;
float extraout_s3_03;
float extraout_s3_04;
undefined uVar3;
double dVar4;
undefined4 in_stack_ffffffc8;
undefined4 in_stack_ffffffcc;
dVar2 = (double)CONCAT44(in_s1,param_2);
dVar4 = (double)in_r2;
if (in_ZR || in_NG != in_OV) {
uVar3 = false;
}
else {
log10((double)CONCAT44(in_stack_ffffffcc,in_stack_ffffffc8));
coprocessor_function(0xb,6,4,in_cr0,in_cr1,in_cr8);
coprocessor_function(10,6,1,in_cr7,in_cr9,in_cr7);
uVar3 = SUB41((float)dVar4,0);
dVar2 = log10((double)CONCAT44(in_stack_ffffffcc,in_stack_ffffffc8));
coprocessor_function(0xb,2,4,in_cr8,in_cr1,in_cr8);
in_s2 = extraout_s2_04;
in_s3 = extraout_s3_04;
}
uVar1 = MultiBiquad::RefreshFilter
((MultiBiquad *)param_1,5,SUB84(dVar2,0),(float)((ulonglong)dVar2 >> 0x20),in_s2(in_s3,(bool)uVar3);
uVar1 = MultiBiquad::RefreshFilter
((MultiBiquad *)(param_1 + 0x24),5,(float)uVar1,
(float)((ulonglong)uVar1 >> 0x20),extraout_s2,extraout_s3,(bool)uVar3);
uVar1 = MultiBiquad::RefreshFilter
((MultiBiquad *)(param_1 + 0x48),5,(float)uVar1,
(float)((ulonglong)uVar1 >> 0x20),extraout_s2_00,extraout_s3_00,false);
uVar1 = MultiBiquad::RefreshFilter
((MultiBiquad *)(param_1 + 0x6c),5,(float)uVar1,
(float)((ulonglong)uVar1 >> 0x20),extraout_s2_01,extraout_s3_01,false);
uVar1 = MultiBiquad::RefreshFilter
((MultiBiquad *)(param_1 + 0x90),0,(float)uVar1,
(float)((ulonglong)uVar1 >> 0x20),extraout_s2_02,extraout_s3_02,false);
MultiBiquad::RefreshFilter
((MultiBiquad *)(param_1 + 0xb4),0,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20),
extraout_s2_03,extraout_s3_03,false);
return;
}
// Subwoofer::Process(int*, int)
void Subwoofer::Process(int *param_1,int param_2) {
longlong lVar1;
longlong lVar2;
longlong lVar3;
longlong lVar4;
int iVar5;
int iVar6;
int iVar7;
if (0 < param_2) {
iVar7 = param_2 + -1;
do {
iVar7 = iVar7 + -1;
iVar5 = MultiBiquad::ProcessSample((MultiBiquad *)this,*param_1);
iVar5 = MultiBiquad::ProcessSample((MultiBiquad *)(this + 0x48),iVar5);
iVar5 = MultiBiquad::ProcessSample((MultiBiquad *)(this + 0x90),iVar5 - *param_1);
iVar6 = MultiBiquad::ProcessSample((MultiBiquad *)(this + 0x24),param_1[1]);
iVar6 = MultiBiquad::ProcessSample((MultiBiquad *)(this + 0x6c),iVar6);
iVar6 = MultiBiquad::ProcessSample((MultiBiquad *)(this + 0xb4),iVar6 - param_1[1]);
lVar1 = (longlong)iVar6 * 0x1333334 + 0x1000000;
lVar2 = (longlong)iVar5 * 0x1333334 + 0x1000000;
lVar3 = (longlong)param_1[1] * 0x1000000 + 0x1000000;
lVar4 = (longlong)*param_1 * 0x1000000 + 0x1000000;
param_1[1] = ((uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7) +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
*param_1 = ((uint)lVar4 >> 0x19 | (int)((ulonglong)lVar4 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
param_1 = param_1 + 2;
} while (iVar7 != -1);
}
return;
}

32
src/effects/Subwoofer.h Normal file
View File

@ -0,0 +1,32 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_SUBWOOFER_H
#define VIPER_SUBWOOFER_H
class Subwoofer {
int field_0x0;
int field_0x4;
int field_0x8;
int field_0xc;
int field_0x10;
undefined4 field_0x14;
undefined4 field_0x18;
undefined4 field_0x1c;
undefined4 field_0x20;
struct MultiBiquad field_0x24;
struct MultiBiquad field_0x48;
struct MultiBiquad field_0x6c;
struct MultiBiquad field_0x90;
struct MultiBiquad field_0xb4;
public:
Subwoofer();
void SetBassGain(int param_1,float param_2);
void Process(int *param_1,int param_2);
};
#endif //VIPER_SUBWOOFER_H

View File

@ -0,0 +1,56 @@
//
// Created by mart on 2/12/21.
//
#include "TubeSimulator.h"
// TubeSimulator::TubeSimulator()
TubeSimulator::TubeSimulator() {
*(undefined4 *)this = 0;
*(undefined4 *)&this->field_0x4 = 0;
this->field_0x8 = false;
return;
}
// TubeSimulator::TubeProcess(int*, int)
void TubeSimulator::TubeProcess(int *param_1,int param_2) {
int iVar1;
int iVar2;
int *piVar3;
int iVar4;
int *piVar5;
if ((this->field_0x8 != false) && (0 < param_2)) {
iVar2 = param_2 + -1;
piVar3 = param_1 + 2;
piVar5 = param_1 + 2;
do {
iVar4 = param_1[1];
iVar2 = iVar2 + -1;
iVar1 = *(int *)this + piVar3[-2] >> 1;
*(int *)this = iVar1;
*(int *)&this->field_0x4 = iVar4 + *(int *)&this->field_0x4 >> 1;
piVar3[-2] = iVar1;
param_1[1] = *(int *)&this->field_0x4;
param_1 = piVar5;
piVar3 = piVar3 + 2;
piVar5 = piVar5 + 2;
} while (iVar2 != -1);
}
return;
}
// TubeSimulator::Reset()
void TubeSimulator::Reset() {
*(undefined4 *)this = 0;
*(undefined4 *)&this->field_0x4 = 0;
this->field_0x8 = false;
return;
}

View File

@ -0,0 +1,30 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_TUBESIMULATOR_H
#define VIPER_TUBESIMULATOR_H
class TubeSimulator {
undefined field_0x0;
undefined field_0x1;
undefined field_0x2;
undefined field_0x3;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
bool field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
public:
TubeSimulator();
void TubeProcess(int *param_1,int param_2);
void Reset();
};
#endif //VIPER_TUBESIMULATOR_H

308
src/effects/VHE.cpp Normal file
View File

@ -0,0 +1,308 @@
//
// Created by mart on 2/12/21.
//
#include "VHE.h"
// VHE::~VHE()
VHE::~VHE() {
WaveBuffer_R32 *pWVar1;
VHE *this_00;
pWVar1 = *(WaveBuffer_R32 **)&this->field_0x20;
if (pWVar1 != nullptr) {
WaveBuffer_R32::~WaveBuffer_R32(pWVar1);
operator_delete(pWVar1);
}
pWVar1 = *(WaveBuffer_R32 **)&this->field_0x24;
if (pWVar1 != nullptr) {
WaveBuffer_R32::~WaveBuffer_R32(pWVar1);
operator_delete(pWVar1);
}
this_00 = (VHE *)&this->field_0x20;
do {
this_00 = (VHE *)&this_00[-1].field_0x28;
PConvSingle_F32::~PConvSingle_F32((PConvSingle_F32 *)this_00);
} while (this != this_00);
return this;
}
// VHE::GetEnabled()
undefined VHE::GetEnabled() {
return *(undefined *)&this->field_0x2c;
}
// VHE::Reset()
void VHE::Reset() {
float *pfVar1;
int iVar2;
PConvSingle_F32 *this_00;
int iVar3;
int iVar4;
float *pfVar5;
int iVar6;
float fVar7;
if (*(WaveBuffer_R32 **)&this->field_0x20 != nullptr) {
WaveBuffer_R32::Reset(*(WaveBuffer_R32 **)&this->field_0x20);
}
if (*(WaveBuffer_R32 **)&this->field_0x24 != nullptr) {
WaveBuffer_R32::Reset(*(WaveBuffer_R32 **)&this->field_0x24);
}
this_00 = (PConvSingle_F32 *)&this->field_0x10;
PConvSingle_F32::Reset((PConvSingle_F32 *)this);
PConvSingle_F32::UnloadKernel((PConvSingle_F32 *)this);
PConvSingle_F32::Reset(this_00);
fVar7 = (float)PConvSingle_F32::UnloadKernel(this_00);
iVar6 = *(int *)&this->field_0x30;
iVar2 = *(int *)&this->field_0x28;
switch(iVar6) {
case 0:
if (iVar2 == 0xac44) {
pfVar1 = (float *)&UNK_000ca550;
}
else {
if (iVar2 != 48000) {
return;
}
pfVar1 = (float *)&UNK_000c6550;
}
iVar4 = 0x1000;
iVar3 = 0x403c8a72;
if (iVar2 != 0xac44) {
pfVar5 = (float *)&UNK_00092560;
goto joined_r0x00065304;
}
pfVar5 = (float *)&UNK_0008a560;
goto LAB_000651f4;
case 1:
if (iVar2 == 0xac44) {
iVar4 = 0x7ff;
iVar3 = 0x3f71adfb;
pfVar1 = (float *)&UNK_000c0554;
}
else {
if (iVar2 != 48000) {
return;
}
iVar4 = 0x7ff;
iVar3 = 0x3f71adfb;
pfVar1 = (float *)&UNK_000ba558;
}
break;
case 2:
if (iVar2 == 0xac44) {
iVar4 = 0x1000;
iVar3 = 0x3fc5b4dd;
pfVar1 = (float *)&UNK_000b2558;
}
else {
if (iVar2 != 48000) {
return;
}
iVar4 = 0x1000;
iVar3 = 0x3fc408b7;
pfVar1 = (float *)&UNK_000aa558;
}
break;
case 3:
if (iVar2 == 0xac44) {
iVar4 = 0x1000;
iVar3 = 0x3fcac8ef;
pfVar1 = (float *)&UNK_000b6558;
}
else {
if (iVar2 != 48000) {
return;
}
iVar4 = 0x1000;
iVar3 = 0x3fc8ad4f;
pfVar1 = (float *)&UNK_000c2550;
}
break;
case 4:
if (iVar2 == 0xac44) {
iVar4 = 0x1000;
iVar3 = 0x3fbbbc34;
pfVar1 = (float *)&DAT_000ae558;
}
else {
if (iVar2 != 48000) {
return;
}
iVar4 = 0x1000;
iVar3 = 0x3fbe5d74;
pfVar1 = (float *)&UNK_000bc554;
}
break;
default:
goto switchD_00065170_caseD_5;
}
if (iVar6 == 1) {
if (iVar2 == 0xac44) {
pfVar5 = (float *)&UNK_0009a560;
}
else {
pfVar5 = (float *)&UNK_000a055c;
joined_r0x00065304:
if (iVar2 != 48000) {
return;
}
}
}
else {
if (iVar6 == 2) {
if (iVar2 != 0xac44) {
pfVar5 = (float *)&UNK_00096560;
goto joined_r0x00065304;
}
pfVar5 = (float *)&UNK_000a6558;
}
else {
if (iVar6 == 3) {
if (iVar2 != 0xac44) {
pfVar5 = (float *)&UNK_00086560;
goto joined_r0x00065304;
}
pfVar5 = (float *)&UNK_000a2558;
}
else {
if (iVar6 != 4) {
return;
}
if (iVar2 == 0xac44) {
pfVar5 = (float *)&UNK_0009c55c;
}
else {
if (iVar2 != 48000) {
return;
}
pfVar5 = (float *)&DAT_0008e560;
}
}
}
}
LAB_000651f4:
if (pfVar1 != nullptr) {
fVar7 = (float)PConvSingle_F32::LoadKernel((PConvSingle_F32 *)this,pfVar1,fVar7,iVar3,iVar4);
PConvSingle_F32::LoadKernel(this_00,pfVar5,fVar7,iVar3,iVar4);
*(undefined4 *)&this->field_0x34 = 0x1000;
}
switchD_00065170_caseD_5:
return;
}
// VHE::VHE()
VHE::VHE() {
WaveBuffer_R32 *pWVar1;
PConvSingle_F32::PConvSingle_F32((PConvSingle_F32 *)this);
PConvSingle_F32::PConvSingle_F32((PConvSingle_F32 *)&this->field_0x10);
*(undefined *)&this->field_0x2c = 0;
*(undefined4 *)&this->field_0x30 = 0;
*(undefined4 *)&this->field_0x34 = 0;
*(undefined4 *)&this->field_0x28 = 0xac44;
pWVar1 = (WaveBuffer_R32 *)operator_new(0x20);
WaveBuffer_R32::WaveBuffer_R32(pWVar1,2,0x1000);
*(WaveBuffer_R32 **)&this->field_0x20 = pWVar1;
pWVar1 = (WaveBuffer_R32 *)operator_new(0x20);
WaveBuffer_R32::WaveBuffer_R32(pWVar1,2,0x1000);
*(WaveBuffer_R32 **)&this->field_0x24 = pWVar1;
Reset(this);
return this;
}
// VHE::SetEnable(bool)
undefined4 VHE::SetEnable(bool param_1) {
char cVar1;
cVar1 = *(char *)&this->field_0x2c;
if (cVar1 == '\0') {
if (param_1 == false) {
return 0;
}
Reset(this);
cVar1 = *(char *)&this->field_0x2c;
}
if (param_1 == (bool)cVar1) {
return 0;
}
*(bool *)&this->field_0x2c = param_1;
return 1;
}
// VHE::SetSamplingRate(unsigned int)
void VHE::SetSamplingRate(uint param_1) {
if (*(uint *)&this->field_0x28 == param_1) {
return;
}
*(uint *)&this->field_0x28 = param_1;
Reset(this);
return;
}
// VHE::SetEffectLevel(int)
void VHE::SetEffectLevel(int param_1) {
if (*(int *)&this->field_0x30 == param_1) {
return;
}
if (4 < (uint)param_1) {
return;
}
*(int *)&this->field_0x30 = param_1;
Reset(this);
return;
}
// VHE::Process(float*, float*, int)
int VHE::Process(float *param_1,float *param_2,int param_3) {
int iVar1;
float *pfVar2;
uint uVar3;
if ((((*(char *)&this->field_0x2c != '\0') && (*(int *)&this->field_0x20 != 0)) &&
(*(int *)&this->field_0x24 != 0)) &&
(iVar1 = PConvSingle_F32::InstanceUsable((PConvSingle_F32 *)this), iVar1 != 0)) {
iVar1 = PConvSingle_F32::InstanceUsable((PConvSingle_F32 *)&this->field_0x10);
if ((iVar1 != 0) &&
(iVar1 = WaveBuffer_R32::PushSamples(*(WaveBuffer_R32 **)&this->field_0x20,param_1,param_3),
iVar1 != 0)) {
while (uVar3 = WaveBuffer_R32::GetBufferOffset(), *(uint *)&this->field_0x34 <= uVar3) {
pfVar2 = (float *)WaveBuffer_R32::GetCurrentBufferR32Ptr
(*(WaveBuffer_R32 **)&this->field_0x20);
PConvSingle_F32::ConvolveInterleaved((PConvSingle_F32 *)this,pfVar2,0);
PConvSingle_F32::ConvolveInterleaved((PConvSingle_F32 *)&this->field_0x10,pfVar2,1);
WaveBuffer_R32::PushSamples
(*(WaveBuffer_R32 **)&this->field_0x24,pfVar2,*(uint *)&this->field_0x34);
WaveBuffer_R32::PopSamples
(*(WaveBuffer_R32 **)&this->field_0x20,*(uint *)&this->field_0x34,true);
}
iVar1 = WaveBuffer_R32::PopSamples
(*(WaveBuffer_R32 **)&this->field_0x24,param_2,param_3,false);
return iVar1;
}
}
return param_3;
}

78
src/effects/VHE.h Normal file
View File

@ -0,0 +1,78 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_VHE_H
#define VIPER_VHE_H
class VHE {
undefined field_0x0;
undefined field_0x1;
undefined field_0x2;
undefined field_0x3;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
undefined field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined field_0x18;
undefined field_0x19;
undefined field_0x1a;
undefined field_0x1b;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
undefined field_0x20;
undefined field_0x21;
undefined field_0x22;
undefined field_0x23;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
undefined field_0x28;
undefined field_0x29;
undefined field_0x2a;
undefined field_0x2b;
undefined field_0x2c;
undefined field_0x2d;
undefined field_0x2e;
undefined field_0x2f;
undefined field_0x30;
undefined field_0x31;
undefined field_0x32;
undefined field_0x33;
undefined field_0x34;
undefined field_0x35;
undefined field_0x36;
undefined field_0x37;
public:
~VHE();
undefined GetEnabled();
void Reset();
VHE();
undefined4 SetEnable(bool param_1);
void SetSamplingRate(uint param_1);
void SetEffectLevel(int param_1);
int Process(float *param_1,float *param_2,int param_3);
};
#endif //VIPER_VHE_H

370
src/effects/ViPERBass.cpp Normal file
View File

@ -0,0 +1,370 @@
//
// Created by mart on 2/12/21.
//
#include "ViPERBass.h"
// ViPERBass::~ViPERBass()
ViPERBass::~ViPERBass() {
Polyphase *this_00;
WaveBuffer_I32 *this_01;
this_00 = *(Polyphase **)this;
if (this_00 != nullptr) {
Polyphase::~Polyphase(this_00);
operator_delete(this_00);
}
if (*(void **)&this->field_0x4 != nullptr) {
operator_delete(*(void **)&this->field_0x4);
}
if (*(void **)&this->field_0x8 != nullptr) {
operator_delete(*(void **)&this->field_0x8);
}
this_01 = *(WaveBuffer_I32 **)&this->field_0xc;
if (this_01 != nullptr) {
WaveBuffer_I32::~WaveBuffer_I32(this_01);
operator_delete(this_01);
}
return this;
}
// ViPERBass::Reset()
void ViPERBass::Reset(void) {
Polyphase **in_r0;
uint uVar1;
Polyphase *pPVar2;
WaveBuffer_I32 *this;
undefined4 in_cr7;
undefined4 in_s0;
undefined4 in_s1;
undefined8 uVar3;
float in_s2;
float extraout_s2;
float extraout_s2_00;
float extraout_s2_01;
uVar3 = CONCAT44(in_s1,in_s0);
if (*in_r0 != nullptr) {
Polyphase::SetSamplingRate(*in_r0,(int)in_r0[6]);
uVar3 = Polyphase::Reset(*in_r0);
in_s2 = extraout_s2;
}
if ((WaveBuffer_I32 *)in_r0[3] != nullptr) {
WaveBuffer_I32::Reset((WaveBuffer_I32 *)in_r0[3]);
this = (WaveBuffer_I32 *)in_r0[3];
uVar1 = Polyphase::GetLatency();
uVar3 = WaveBuffer_I32::PushZeros(this,uVar1);
in_s2 = extraout_s2_00;
}
if (in_r0[2] != nullptr) {
FixedToFP(in_r0[10],0x20,0x20,0x19,0,0);
coprocessor_function(10,6,1,in_cr7,in_cr7,in_cr7);
uVar3 = Subwoofer::SetBassGain((int)in_r0[2],(float)uVar3);
in_s2 = extraout_s2_01;
}
if ((FixedBiquad *)in_r0[1] != nullptr) {
FixedBiquad::SetLowPassParameter
((FixedBiquad *)in_r0[1],(float)uVar3,(float)((ulonglong)uVar3 >> 0x20),in_s2);
}
pPVar2 = (Polyphase *)__divsi3(0x2000000,in_r0[6]);
in_r0[7] = pPVar2;
in_r0[8] = nullptr;
return;
}
// ViPERBass::ViPERBass()
ViPERBass::ViPERBass() {
Polyphase *this_00;
FixedBiquad *this_01;
Subwoofer *this_02;
WaveBuffer_I32 *this_03;
float fVar1;
float extraout_s0;
undefined8 uVar2;
float extraout_s2;
*(undefined4 *)&this->field_0x24 = 0x3c;
*(undefined *)&this->field_0x10 = 0;
*(undefined *)&this->field_0x11 = 0;
*(undefined4 *)&this->field_0x14 = 0;
*(undefined4 *)&this->field_0x20 = 0;
*(undefined4 *)&this->field_0x28 = 0;
*(undefined4 *)&this->field_0x18 = 0xac44;
*(undefined4 *)&this->field_0x1c = 0x2f8;
this_00 = (Polyphase *)operator_new(0x1c);
Polyphase::Polyphase(this_00,2);
*(Polyphase **)this = this_00;
this_01 = (FixedBiquad *)operator_new(0x24);
FixedBiquad::FixedBiquad(this_01);
*(FixedBiquad **)&this->field_0x4 = this_01;
this_02 = (Subwoofer *)operator_new(0xd8);
Subwoofer::Subwoofer(this_02);
*(Subwoofer **)&this->field_0x8 = this_02;
this_03 = (WaveBuffer_I32 *)operator_new(0x20);
fVar1 = (float)WaveBuffer_I32::WaveBuffer_I32(this_03,1,0x1000);
*(WaveBuffer_I32 **)&this->field_0xc = this_03;
if (*(FixedBiquad **)&this->field_0x4 != nullptr) {
uVar2 = FixedBiquad::Reset(*(FixedBiquad **)&this->field_0x4);
FixedBiquad::SetLowPassParameter
(*(FixedBiquad **)&this->field_0x4,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),
extraout_s2);
fVar1 = extraout_s0;
}
if (*(int *)&this->field_0x8 != 0) {
Subwoofer::SetBassGain(*(int *)&this->field_0x8,fVar1);
}
if ((((*(int *)this != 0) && (*(int *)&this->field_0x4 != 0)) && (*(int *)&this->field_0x8 != 0))
&& (*(int *)&this->field_0xc != 0)) {
*(undefined *)&this->field_0x11 = 1;
}
Reset();
return this;
}
// ViPERBass::SetEnable(bool)
undefined4 ViPERBass::SetEnable(bool param_1) {
char cVar1;
cVar1 = *(char *)&this->field_0x10;
if (cVar1 == '\0') {
if (param_1 == false) {
return 0;
}
Reset();
cVar1 = *(char *)&this->field_0x10;
}
if (param_1 == (bool)cVar1) {
return 0;
}
*(bool *)&this->field_0x10 = param_1;
return 1;
}
// ViPERBass::SetSamplingRate(int)
void ViPERBass::SetSamplingRate(int param_1) {
undefined4 uVar1;
undefined4 in_cr7;
undefined8 extraout_d0;
undefined8 uVar2;
undefined8 extraout_d0_00;
float extraout_s2;
float extraout_s2_00;
float fVar3;
if (*(int *)&this->field_0x18 == param_1) {
return;
}
*(int *)&this->field_0x18 = param_1;
uVar1 = __divsi3(0x2000000);
*(undefined4 *)&this->field_0x1c = uVar1;
fVar3 = extraout_s2;
uVar2 = extraout_d0;
if (*(Polyphase **)this != nullptr) {
uVar2 = Polyphase::SetSamplingRate(*(Polyphase **)this,param_1);
fVar3 = extraout_s2_00;
}
if (*(FixedBiquad **)&this->field_0x4 != nullptr) {
FixedBiquad::SetLowPassParameter
(*(FixedBiquad **)&this->field_0x4,(float)uVar2,(float)((ulonglong)uVar2 >> 0x20),
fVar3);
uVar2 = extraout_d0_00;
}
if (*(int *)&this->field_0x8 == 0) {
return;
}
FixedToFP(*(undefined4 *)&this->field_0x28,0x20,0x20,0x19,0,0);
coprocessor_function(10,6,1,in_cr7,in_cr7,in_cr7);
Subwoofer::SetBassGain(*(int *)&this->field_0x8,(float)uVar2);
return;
}
// ViPERBass::SetProcessMode(int)
void ViPERBass::SetProcessMode(int param_1) {
if (2 < (uint)param_1) {
return;
}
if (*(int *)&this->field_0x14 == param_1) {
return;
}
*(int *)&this->field_0x14 = param_1;
Reset();
return;
}
// ViPERBass::SetSpeaker(int)
void ViPERBass::SetSpeaker(int param_1) {
int in_r1;
float in_s0;
float in_s1;
float in_s2;
if (*(int *)(param_1 + 0x24) == in_r1) {
return;
}
*(int *)(param_1 + 0x24) = in_r1;
if (*(FixedBiquad **)(param_1 + 4) == nullptr) {
return;
}
FixedBiquad::SetLowPassParameter(*(FixedBiquad **)(param_1 + 4),in_s0,in_s1,in_s2);
return;
}
// ViPERBass::SetBassFactor(float)
void ViPERBass::SetBassFactor(float param_1) {
int in_r0;
float in_r1;
char in_NG;
bool in_ZR;
char in_OV;
undefined4 in_cr6;
undefined4 in_cr7;
if (in_ZR || in_NG != in_OV) {
return;
}
*(float *)(in_r0 + 0x28) = ROUND(in_r1 * 3.355443e+07 + 0.5);
if (*(int *)(in_r0 + 8) == 0) {
return;
}
coprocessor_function(10,2,4,in_cr7,in_cr6,in_cr7);
coprocessor_function(10,6,1,in_cr7,in_cr7,in_cr7);
Subwoofer::SetBassGain(*(int *)(in_r0 + 8),param_1);
return;
}
// ViPERBass::Process(int*, int)
int ViPERBass::Process(int *param_1,int param_2) {
longlong lVar1;
ulonglong uVar2;
int iVar3;
int iVar4;
undefined4 uVar5;
int *piVar6;
int *piVar7;
int iVar8;
uint uVar9;
int iVar10;
undefined4 *puVar11;
int *piVar12;
int *piVar13;
undefined8 uVar14;
int local_30;
if ((*(char *)&this->field_0x10 != '\0') && (*(char *)&this->field_0x11 != '\0')) {
iVar8 = *(int *)&this->field_0x20;
if ((iVar8 != 0x2000000) && (0 < param_2 * 2)) {
piVar6 = param_1 + 1;
piVar7 = param_1;
do {
piVar12 = piVar7 + 2;
lVar1 = (longlong)piVar6[-1] * (longlong)iVar8 + 0x1000000;
piVar6[-1] = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
lVar1 = (longlong)piVar7[1] * (longlong)*(int *)&this->field_0x20 + 0x1000000;
piVar7[1] = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
iVar8 = *(int *)&this->field_0x20 + *(int *)&this->field_0x1c;
if (0x2000000 < iVar8) {
iVar8 = 0x2000000;
}
*(int *)&this->field_0x20 = iVar8;
piVar6 = piVar6 + 2;
piVar7 = piVar12;
} while (piVar12 != param_1 + param_2 * 2);
}
iVar8 = *(int *)&this->field_0x14;
if (iVar8 == 0) {
if (0 < param_2 * 2) {
piVar6 = param_1 + 1;
do {
iVar8 = iVar8 + 2;
uVar2 = (longlong)(piVar6[-1] + param_1[1]) * 0x1000000 + 0x1000000;
uVar14 = VectorShiftRight((uVar2 & 0xffffffff00000000) + (uVar2 & 0xffffffff),0x19);
local_30 = (int)uVar14;
iVar3 = FixedBiquad::ProcessSample(*(FixedBiquad **)&this->field_0x4,local_30);
lVar1 = (longlong)iVar3 * (longlong)*(int *)&this->field_0x28 + 0x1000000;
uVar9 = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
piVar6[-1] = piVar6[-1] + uVar9;
param_1[1] = param_1[1] + uVar9;
piVar6 = piVar6 + 2;
param_1 = param_1 + 2;
} while (iVar8 + param_2 * -2 < 0 != SBORROW4(iVar8,param_2 * 2));
}
}
else {
if (iVar8 != 1) {
Subwoofer::Process(*(Subwoofer **)&this->field_0x8,param_1,param_2);
return param_2;
}
iVar8 = WaveBuffer_I32::PushSamples(*(WaveBuffer_I32 **)&this->field_0xc,param_1,param_2);
if (iVar8 != 0) {
iVar8 = param_2 * 2;
iVar3 = WaveBuffer_I32::GetCurrentBufferI32Ptr(*(WaveBuffer_I32 **)&this->field_0xc);
iVar4 = WaveBuffer_I32::GetBufferOffset();
if (0 < iVar8) {
iVar10 = 0;
puVar11 = (undefined4 *)(iVar3 + (iVar4 - param_2) * 4 + -4);
piVar6 = param_1;
do {
iVar3 = *piVar6;
piVar7 = piVar6 + 1;
iVar10 = iVar10 + 2;
piVar6 = piVar6 + 2;
lVar1 = (longlong)(iVar3 + *piVar7) * 0x1000000 + 0x1000000;
uVar5 = FixedBiquad::ProcessSample
(*(FixedBiquad **)&this->field_0x4,
(uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
puVar11 = puVar11 + 1;
*puVar11 = uVar5;
} while (iVar10 + param_2 * -2 < 0 != SBORROW4(iVar10,iVar8));
}
iVar3 = Polyphase::Process(*(Polyphase **)this,param_1,param_2);
if (iVar3 == param_2) {
piVar6 = (int *)WaveBuffer_I32::GetCurrentBufferI32Ptr
(*(WaveBuffer_I32 **)&this->field_0xc);
if (0 < iVar8) {
piVar7 = param_1 + 1;
piVar12 = param_1;
do {
piVar13 = piVar12 + 2;
lVar1 = (longlong)*piVar6 * (longlong)*(int *)&this->field_0x28 + 0x1000000;
piVar7[-1] = piVar7[-1] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)
;
lVar1 = (longlong)*piVar6 * (longlong)*(int *)&this->field_0x28 + 0x1000000;
piVar12[1] = piVar12[1] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)
;
piVar6 = piVar6 + 1;
piVar7 = piVar7 + 2;
piVar12 = piVar13;
} while (piVar13 != param_1 + param_2 * 2);
}
WaveBuffer_I32::PopSamples(*(WaveBuffer_I32 **)&this->field_0xc,param_2,true);
}
}
}
}
return param_2;
}

68
src/effects/ViPERBass.h Normal file
View File

@ -0,0 +1,68 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_VIPERBASS_H
#define VIPER_VIPERBASS_H
class ViPERBass {
undefined field_0x0;
undefined field_0x1;
undefined field_0x2;
undefined field_0x3;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
undefined field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined field_0x18;
undefined field_0x19;
undefined field_0x1a;
undefined field_0x1b;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
undefined field_0x20;
undefined field_0x21;
undefined field_0x22;
undefined field_0x23;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
undefined field_0x28;
undefined field_0x29;
undefined field_0x2a;
undefined field_0x2b;
public:
~ViPERBass();
void Reset();
ViPERBass();
undefined4 SetEnable(bool param_1);
void SetSamplingRate(int param_1);
void SetProcessMode(int param_1);
void SetSpeaker(int param_1);
void SetBassFactor(float param_1);
int Process(int *param_1,int param_2);
};
#endif //VIPER_VIPERBASS_H

View File

@ -0,0 +1,183 @@
//
// Created by mart on 2/13/21.
//
#include "ViPERClarity.h"
// ViPERClarity::~ViPERClarity()
ViPERClarity::~ViPERClarity() {
HiFi::~HiFi((HiFi *)&this->field_0xa8);
return this;
}
// ViPERClarity::SetClarityToFilter()
void ViPERClarity::SetClarityToFilter(void) {
NoiseSharpening *in_r0;
float in_s0;
float fVar1;
fVar1 = (float)NoiseSharpening::SetGain(in_r0,in_s0);
fVar1 = (float)HighShelf::SetGain(fVar1);
fVar1 = (float)HighShelf::SetGain(fVar1);
HiFi::SetClarity((HiFi *)(in_r0 + 0xa8),fVar1);
return;
}
// ViPERClarity::Reset()
void ViPERClarity::Reset() {
HighShelf *this_00;
HighShelf *this_01;
float fVar1;
this_01 = (HighShelf *)&this->field_0x30;
NoiseSharpening::SetSamplingRate((NoiseSharpening *)this,*(int *)&this->field_0xd8);
NoiseSharpening::Reset();
this_00 = (HighShelf *)&this->field_0x6c;
fVar1 = (float)SetClarityToFilter();
fVar1 = (float)HighShelf::SetFrequency(this_01,fVar1);
HighShelf::SetQuality(this_01,fVar1);
fVar1 = (float)HighShelf::SetSamplingRate(this_01,*(int *)&this->field_0xd8);
fVar1 = (float)HighShelf::SetFrequency(this_00,fVar1);
HighShelf::SetQuality(this_00,fVar1);
HighShelf::SetSamplingRate(this_00,*(int *)&this->field_0xd8);
HiFi::SetSamplingRate((HiFi *)&this->field_0xa8,*(int *)&this->field_0xd8);
HiFi::Reset();
return;
}
// ViPERClarity::ViPERClarity()
ViPERClarity::ViPERClarity() {
HighShelf *this_00;
HiFi *this_01;
float fVar1;
fVar1 = (float)NoiseSharpening::NoiseSharpening((NoiseSharpening *)this);
this_00 = (HighShelf *)&this->field_0x30;
do {
fVar1 = (float)HighShelf::SetFrequency(this_00,fVar1);
fVar1 = (float)HighShelf::SetQuality(this_00,fVar1);
HighShelf::SetGain(fVar1);
this_01 = (HiFi *)(this_00 + 0x3c);
fVar1 = (float)HighShelf::SetSamplingRate(this_00,0xac44);
this_00 = (HighShelf *)this_01;
} while (this_01 != (HiFi *)&this->field_0xa8);
HiFi::HiFi(this_01);
*(undefined *)&this->field_0xd0 = 0;
*(undefined4 *)&this->field_0xd4 = 0;
*(undefined4 *)&this->field_0xdc = 0;
*(undefined4 *)&this->field_0xd8 = 0xac44;
Reset(this);
return this;
}
// ViPERClarity::SetEnable(bool)
undefined4 ViPERClarity::SetEnable(bool param_1) {
char cVar1;
cVar1 = *(char *)&this->field_0xd0;
if (cVar1 == '\0') {
if (param_1 == false) {
return 0;
}
Reset(this);
cVar1 = *(char *)&this->field_0xd0;
}
if (param_1 == (bool)cVar1) {
return 0;
}
*(bool *)&this->field_0xd0 = param_1;
return 1;
}
// ViPERClarity::SetSamplingRate(int)
void ViPERClarity::SetSamplingRate(int param_1) {
if (*(int *)&this->field_0xd8 == param_1) {
return;
}
*(int *)&this->field_0xd8 = param_1;
Reset(this);
return;
}
// ViPERClarity::SetProcessMode(int)
void ViPERClarity::SetProcessMode(int param_1) {
if (2 < (uint)param_1) {
return;
}
if (*(int *)&this->field_0xd4 == param_1) {
return;
}
*(int *)&this->field_0xd4 = param_1;
Reset(this);
return;
}
// ViPERClarity::SetClarity(float)
void ViPERClarity::SetClarity(float param_1) {
undefined4 in_r1;
*(undefined4 *)&this->field_0xdc = in_r1;
if (*(int *)&this->field_0xd4 != 1) {
SetClarityToFilter();
return;
}
Reset(this);
return;
}
// ViPERClarity::Process(int*, int)
int ViPERClarity::Process(int *param_1,int param_2) {
int iVar1;
int *piVar2;
int iVar3;
if (*(char *)&this->field_0xd0 != '\0') {
if (*(int *)&this->field_0xd4 == 0) {
NoiseSharpening::Process((NoiseSharpening *)this,param_1,param_2);
return param_2;
}
if (*(int *)&this->field_0xd4 != 1) {
iVar3 = HiFi::Process((HiFi *)&this->field_0xa8,param_1,param_2);
return iVar3;
}
if (0 < param_2 * 2) {
piVar2 = param_1 + 1;
iVar3 = 0;
do {
iVar1 = HighShelf::Process((HighShelf *)&this->field_0x30,piVar2[-1]);
iVar3 = iVar3 + 2;
piVar2[-1] = iVar1;
iVar1 = HighShelf::Process((HighShelf *)&this->field_0x6c,param_1[1]);
param_1[1] = iVar1;
piVar2 = piVar2 + 2;
param_1 = param_1 + 2;
} while (iVar3 < param_2 * 2);
}
}
return param_2;
}

248
src/effects/ViPERClarity.h Normal file
View File

@ -0,0 +1,248 @@
//
// Created by mart on 2/13/21.
//
#ifndef VIPER_VIPERCLARITY_H
#define VIPER_VIPERCLARITY_H
class ViPERClarity {
undefined field_0x0;
undefined field_0x1;
undefined field_0x2;
undefined field_0x3;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
undefined field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined field_0x18;
undefined field_0x19;
undefined field_0x1a;
undefined field_0x1b;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
undefined field_0x20;
undefined field_0x21;
undefined field_0x22;
undefined field_0x23;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
undefined field_0x28;
undefined field_0x29;
undefined field_0x2a;
undefined field_0x2b;
undefined field_0x2c;
undefined field_0x2d;
undefined field_0x2e;
undefined field_0x2f;
undefined field_0x30;
undefined field_0x31;
undefined field_0x32;
undefined field_0x33;
undefined field_0x34;
undefined field_0x35;
undefined field_0x36;
undefined field_0x37;
undefined field_0x38;
undefined field_0x39;
undefined field_0x3a;
undefined field_0x3b;
undefined field_0x3c;
undefined field_0x3d;
undefined field_0x3e;
undefined field_0x3f;
undefined field_0x40;
undefined field_0x41;
undefined field_0x42;
undefined field_0x43;
undefined field_0x44;
undefined field_0x45;
undefined field_0x46;
undefined field_0x47;
undefined field_0x48;
undefined field_0x49;
undefined field_0x4a;
undefined field_0x4b;
undefined field_0x4c;
undefined field_0x4d;
undefined field_0x4e;
undefined field_0x4f;
undefined field_0x50;
undefined field_0x51;
undefined field_0x52;
undefined field_0x53;
undefined field_0x54;
undefined field_0x55;
undefined field_0x56;
undefined field_0x57;
undefined field_0x58;
undefined field_0x59;
undefined field_0x5a;
undefined field_0x5b;
undefined field_0x5c;
undefined field_0x5d;
undefined field_0x5e;
undefined field_0x5f;
undefined field_0x60;
undefined field_0x61;
undefined field_0x62;
undefined field_0x63;
undefined field_0x64;
undefined field_0x65;
undefined field_0x66;
undefined field_0x67;
undefined field_0x68;
undefined field_0x69;
undefined field_0x6a;
undefined field_0x6b;
undefined field_0x6c;
undefined field_0x6d;
undefined field_0x6e;
undefined field_0x6f;
undefined field_0x70;
undefined field_0x71;
undefined field_0x72;
undefined field_0x73;
undefined field_0x74;
undefined field_0x75;
undefined field_0x76;
undefined field_0x77;
undefined field_0x78;
undefined field_0x79;
undefined field_0x7a;
undefined field_0x7b;
undefined field_0x7c;
undefined field_0x7d;
undefined field_0x7e;
undefined field_0x7f;
undefined field_0x80;
undefined field_0x81;
undefined field_0x82;
undefined field_0x83;
undefined field_0x84;
undefined field_0x85;
undefined field_0x86;
undefined field_0x87;
undefined field_0x88;
undefined field_0x89;
undefined field_0x8a;
undefined field_0x8b;
undefined field_0x8c;
undefined field_0x8d;
undefined field_0x8e;
undefined field_0x8f;
undefined field_0x90;
undefined field_0x91;
undefined field_0x92;
undefined field_0x93;
undefined field_0x94;
undefined field_0x95;
undefined field_0x96;
undefined field_0x97;
undefined field_0x98;
undefined field_0x99;
undefined field_0x9a;
undefined field_0x9b;
undefined field_0x9c;
undefined field_0x9d;
undefined field_0x9e;
undefined field_0x9f;
undefined field_0xa0;
undefined field_0xa1;
undefined field_0xa2;
undefined field_0xa3;
undefined field_0xa4;
undefined field_0xa5;
undefined field_0xa6;
undefined field_0xa7;
undefined field_0xa8;
undefined field_0xa9;
undefined field_0xaa;
undefined field_0xab;
undefined field_0xac;
undefined field_0xad;
undefined field_0xae;
undefined field_0xaf;
undefined field_0xb0;
undefined field_0xb1;
undefined field_0xb2;
undefined field_0xb3;
undefined field_0xb4;
undefined field_0xb5;
undefined field_0xb6;
undefined field_0xb7;
undefined field_0xb8;
undefined field_0xb9;
undefined field_0xba;
undefined field_0xbb;
undefined field_0xbc;
undefined field_0xbd;
undefined field_0xbe;
undefined field_0xbf;
undefined field_0xc0;
undefined field_0xc1;
undefined field_0xc2;
undefined field_0xc3;
undefined field_0xc4;
undefined field_0xc5;
undefined field_0xc6;
undefined field_0xc7;
undefined field_0xc8;
undefined field_0xc9;
undefined field_0xca;
undefined field_0xcb;
undefined field_0xcc;
undefined field_0xcd;
undefined field_0xce;
undefined field_0xcf;
undefined field_0xd0;
undefined field_0xd1;
undefined field_0xd2;
undefined field_0xd3;
undefined field_0xd4;
undefined field_0xd5;
undefined field_0xd6;
undefined field_0xd7;
undefined field_0xd8;
undefined field_0xd9;
undefined field_0xda;
undefined field_0xdb;
undefined field_0xdc;
undefined field_0xdd;
undefined field_0xde;
undefined field_0xdf;
public:
~ViPERClarity();
void SetClarityToFilter();
void Reset();
ViPERClarity();
undefined4 SetEnable(bool param_1);
void SetSamplingRate(int param_1);
void SetProcessMode(int param_1);
void SetClarity(float param_1);
int Process(int *param_1,int param_2);
};
#endif //VIPER_VIPERCLARITY_H

562
src/effects/ViPERDDC.cpp Normal file
View File

@ -0,0 +1,562 @@
//
// Created by mart on 2/13/21.
//
#include "ViPERDDC.h"
// ViPERDDC::ViPERDDC()
ViPERDDC::ViPERDDC() {
*(undefined4 *)&this->field_0x4 = 0xac44;
*(undefined *)this = 0;
*(undefined *)&this->field_0x1 = 0;
*(undefined4 *)&this->field_0x8 = 0;
*(undefined4 *)&this->field_0xc = 0;
*(undefined4 *)&this->field_0x10 = 0;
*(undefined4 *)&this->field_0x20 = 0;
*(undefined4 *)&this->field_0x1c = 0;
*(undefined4 *)&this->field_0x18 = 0;
*(undefined4 *)&this->field_0x14 = 0;
*(undefined4 *)&this->field_0x30 = 0;
*(undefined4 *)&this->field_0x2c = 0;
*(undefined4 *)&this->field_0x28 = 0;
*(undefined4 *)&this->field_0x24 = 0;
return;
}
// ViPERDDC::ReleaseResources()
void ViPERDDC::ReleaseResources() {
void *pvVar1;
void *pvVar2;
int iVar3;
int iVar4;
pvVar1 = *(void **)&this->field_0xc;
if (pvVar1 != nullptr) {
iVar3 = *(int *)&this->field_0x8;
if (iVar3 < 1) {
LAB_0006da6c:
operator_delete__(pvVar1);
}
else {
iVar4 = 0;
do {
pvVar2 = *(void **)((int)pvVar1 + iVar4 * 4);
iVar4 = iVar4 + 1;
if (pvVar2 != nullptr) {
operator_delete__(pvVar2);
pvVar1 = *(void **)&this->field_0xc;
iVar3 = *(int *)&this->field_0x8;
}
} while (iVar4 < iVar3);
if (pvVar1 != nullptr) goto LAB_0006da6c;
}
*(undefined4 *)&this->field_0xc = 0;
}
pvVar1 = *(void **)&this->field_0x10;
if (pvVar1 == nullptr) goto LAB_0006dad4;
iVar3 = *(int *)&this->field_0x8;
if (iVar3 < 1) {
LAB_0006dac4:
operator_delete__(pvVar1);
}
else {
iVar4 = 0;
do {
pvVar2 = *(void **)((int)pvVar1 + iVar4 * 4);
iVar4 = iVar4 + 1;
if (pvVar2 != nullptr) {
operator_delete__(pvVar2);
pvVar1 = *(void **)&this->field_0x10;
iVar3 = *(int *)&this->field_0x8;
}
} while (iVar4 < iVar3);
if (pvVar1 != nullptr) goto LAB_0006dac4;
}
*(undefined4 *)&this->field_0x10 = 0;
LAB_0006dad4:
if (*(void **)&this->field_0x14 != nullptr) {
operator_delete__(*(void **)&this->field_0x14);
}
*(undefined4 *)&this->field_0x14 = 0;
if (*(void **)&this->field_0x18 != nullptr) {
operator_delete__(*(void **)&this->field_0x18);
}
*(undefined4 *)&this->field_0x18 = 0;
if (*(void **)&this->field_0x1c != nullptr) {
operator_delete__(*(void **)&this->field_0x1c);
}
*(undefined4 *)&this->field_0x1c = 0;
if (*(void **)&this->field_0x20 != nullptr) {
operator_delete__(*(void **)&this->field_0x20);
}
*(undefined4 *)&this->field_0x20 = 0;
if (*(void **)&this->field_0x24 != nullptr) {
operator_delete__(*(void **)&this->field_0x24);
}
*(undefined4 *)&this->field_0x24 = 0;
if (*(void **)&this->field_0x28 != nullptr) {
operator_delete__(*(void **)&this->field_0x28);
}
*(undefined4 *)&this->field_0x28 = 0;
if (*(void **)&this->field_0x2c != nullptr) {
operator_delete__(*(void **)&this->field_0x2c);
}
*(undefined4 *)&this->field_0x2c = 0;
if (*(void **)&this->field_0x30 != nullptr) {
operator_delete__(*(void **)&this->field_0x30);
}
*(undefined4 *)&this->field_0x30 = 0;
*(undefined *)&this->field_0x1 = 0;
return;
}
// ViPERDDC::~ViPERDDC()
ViPERDDC::~ViPERDDC() {
ReleaseResources(this);
return this;
}
// ViPERDDC::Reset()
void ViPERDDC::Reset() {
int iVar1;
int iVar2;
int iVar3;
int iVar4;
if ((*(char *)&this->field_0x1 != '\0') && (0 < *(int *)&this->field_0x8)) {
iVar4 = *(int *)&this->field_0x14;
iVar2 = 0;
iVar3 = *(int *)&this->field_0x18;
iVar1 = 0;
do {
*(undefined4 *)(iVar4 + iVar2) = 0;
iVar1 = iVar1 + 1;
*(undefined4 *)(iVar3 + iVar2) = 0;
iVar2 = iVar2 + 4;
} while (iVar1 < *(int *)&this->field_0x8);
}
return;
}
// ViPERDDC::SetEnable(bool)
undefined4 ViPERDDC::SetEnable(bool param_1) {
char cVar1;
cVar1 = *(char *)this;
if (cVar1 == '\0') {
if (param_1 == false) {
return 0;
}
Reset(this);
cVar1 = *(char *)this;
}
if (param_1 == (bool)cVar1) {
return 0;
}
*(bool *)this = param_1;
return 1;
}
// ViPERDDC::SetSamplingRate(int)
void ViPERDDC::SetSamplingRate(int param_1) {
if (*(int *)&this->field_0x4 == param_1) {
return;
}
*(int *)&this->field_0x4 = param_1;
Reset(this);
return;
}
// ViPERDDC::SetCoeffs(int, float*, float*)
void ViPERDDC::SetCoeffs(int param_1,float *param_2,float *param_3) {
uint uVar1;
void *pvVar2;
int iVar3;
int iVar4;
int iVar5;
int iVar6;
int iVar7;
float *pfVar8;
float *pfVar9;
float fVar10;
float fVar11;
ReleaseResources(this);
uVar1 = param_1 / 5;
*(uint *)&this->field_0x8 = uVar1;
if (uVar1 < 0x1fc00001) {
uVar1 = uVar1 * 4;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
*(void **)&this->field_0xc = pvVar2;
if (*(uint *)&this->field_0x8 < 0x1fc00001) {
uVar1 = *(uint *)&this->field_0x8 << 2;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
*(void **)&this->field_0x10 = pvVar2;
if ((*(void **)&this->field_0xc != nullptr) && (pvVar2 != nullptr)) {
memset(*(void **)&this->field_0xc,0,*(int *)&this->field_0x8 << 2);
memset(*(void **)&this->field_0x10,0,*(int *)&this->field_0x8 << 2);
uVar1 = *(uint *)&this->field_0x8;
if (0 < (int)uVar1) {
iVar7 = *(int *)&this->field_0xc;
iVar4 = 0;
do {
pvVar2 = operator_new__(0x14);
*(void **)(iVar7 + iVar4 * 4) = pvVar2;
iVar7 = *(int *)&this->field_0x10;
pvVar2 = operator_new__(0x14);
*(void **)(iVar7 + iVar4 * 4) = pvVar2;
iVar7 = *(int *)&this->field_0xc;
iVar5 = *(int *)(iVar7 + iVar4 * 4);
if (iVar5 == 0) {
return;
}
iVar6 = *(int *)(*(int *)&this->field_0x10 + iVar4 * 4);
if (iVar6 == 0) {
return;
}
iVar3 = 0;
pfVar8 = param_2;
pfVar9 = param_3;
do {
fVar10 = *pfVar8;
pfVar8 = pfVar8 + 1;
fVar11 = *pfVar9;
pfVar9 = pfVar9 + 1;
*(float *)(iVar5 + iVar3) = ROUND(fVar10 * 3.355443e+07 + 0.5);
*(float *)(iVar6 + iVar3) = ROUND(fVar11 * 3.355443e+07 + 0.5);
iVar3 = iVar3 + 4;
} while (iVar3 != 0x14);
uVar1 = *(uint *)&this->field_0x8;
iVar4 = iVar4 + 1;
param_2 = param_2 + 5;
param_3 = param_3 + 5;
} while (iVar4 < (int)uVar1);
}
if (uVar1 < 0x1fc00001) {
uVar1 = uVar1 << 2;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
*(void **)&this->field_0x14 = pvVar2;
if (*(uint *)&this->field_0x8 < 0x1fc00001) {
uVar1 = *(uint *)&this->field_0x8 << 2;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
*(void **)&this->field_0x18 = pvVar2;
if (*(uint *)&this->field_0x8 < 0x1fc00001) {
uVar1 = *(uint *)&this->field_0x8 << 2;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
*(void **)&this->field_0x1c = pvVar2;
if (*(uint *)&this->field_0x8 < 0x1fc00001) {
uVar1 = *(uint *)&this->field_0x8 << 2;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
*(void **)&this->field_0x20 = pvVar2;
if (*(uint *)&this->field_0x8 < 0x1fc00001) {
uVar1 = *(uint *)&this->field_0x8 << 2;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
*(void **)&this->field_0x24 = pvVar2;
if (*(uint *)&this->field_0x8 < 0x1fc00001) {
uVar1 = *(uint *)&this->field_0x8 << 2;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
*(void **)&this->field_0x28 = pvVar2;
if (*(uint *)&this->field_0x8 < 0x1fc00001) {
uVar1 = *(uint *)&this->field_0x8 << 2;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
*(void **)&this->field_0x2c = pvVar2;
if (*(uint *)&this->field_0x8 < 0x1fc00001) {
uVar1 = *(uint *)&this->field_0x8 << 2;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
*(void **)&this->field_0x30 = pvVar2;
if (((((*(void **)&this->field_0x14 != nullptr) && (*(int *)&this->field_0x18 != 0)) &&
(*(int *)&this->field_0x1c != 0)) &&
((*(int *)&this->field_0x20 != 0 && (*(int *)&this->field_0x24 != 0)))) &&
((*(int *)&this->field_0x28 != 0 && ((*(int *)&this->field_0x2c != 0 && (pvVar2 != nullptr))))))
{
memset(*(void **)&this->field_0x14,0,*(int *)&this->field_0x8 << 2);
memset(*(void **)&this->field_0x18,0,*(int *)&this->field_0x8 << 2);
memset(*(void **)&this->field_0x1c,0,*(int *)&this->field_0x8 << 2);
memset(*(void **)&this->field_0x20,0,*(int *)&this->field_0x8 << 2);
memset(*(void **)&this->field_0x24,0,*(int *)&this->field_0x8 << 2);
memset(*(void **)&this->field_0x28,0,*(int *)&this->field_0x8 << 2);
memset(*(void **)&this->field_0x2c,0,*(int *)&this->field_0x8 << 2);
memset(*(void **)&this->field_0x30,0,*(int *)&this->field_0x8 << 2);
*(undefined *)&this->field_0x1 = 1;
}
}
return;
}
// ViPERDDC::Process(int*, int)
void ViPERDDC::Process(int *param_1,int param_2) {
longlong lVar1;
int iVar2;
int iVar3;
uint uVar4;
int iVar5;
uint uVar6;
int iVar7;
int *piVar8;
int iVar9;
int iVar10;
uint uVar11;
int iVar12;
int iVar13;
int iVar14;
int iVar15;
int iVar16;
int iVar17;
int iVar18;
int iVar19;
int iVar20;
int iVar21;
int *local_34;
int *local_30;
uint local_2c;
if ((*(char *)&this->field_0x1 != '\0') && (*(char *)this != '\0')) {
if (*(int *)&this->field_0x4 == 0xac44) {
if (0 < param_2 * 2) {
local_34 = param_1;
local_30 = param_1 + 1;
do {
uVar11 = local_34[1];
if (*(int *)&this->field_0x8 < 1) {
local_2c = 0;
uVar6 = 0;
}
else {
iVar12 = *(int *)&this->field_0x1c;
iVar2 = 0;
iVar17 = *(int *)&this->field_0x24;
iVar21 = 0;
iVar16 = *(int *)&this->field_0xc;
iVar7 = *(int *)&this->field_0x14;
iVar15 = *(int *)&this->field_0x2c;
uVar6 = local_30[-1];
do {
piVar8 = *(int **)(iVar16 + iVar2);
iVar21 = iVar21 + 1;
iVar5 = *(int *)(iVar7 + iVar2);
iVar13 = *(int *)(iVar12 + iVar2);
iVar3 = piVar8[1];
iVar19 = piVar8[2];
iVar14 = *piVar8;
iVar20 = piVar8[3];
iVar9 = piVar8[4];
iVar18 = *(int *)(iVar15 + iVar2);
iVar10 = *(int *)(iVar17 + iVar2);
*(int *)(iVar15 + iVar2) = iVar10;
lVar1 = (longlong)iVar9 * (longlong)iVar18 +
(longlong)iVar20 * (longlong)iVar10 +
(longlong)iVar19 * (longlong)iVar13 +
(longlong)iVar14 * (longlong)(int)uVar6 + (longlong)iVar3 * (longlong)iVar5;
uVar4 = (uint)lVar1;
local_2c = uVar4 + 0x1000000 >> 0x19 |
((int)((ulonglong)lVar1 >> 0x20) + (uint)(0xfeffffff < uVar4)) * 0x80;
*(uint *)(iVar17 + iVar2) = local_2c;
*(undefined4 *)(iVar12 + iVar2) = *(undefined4 *)(iVar7 + iVar2);
*(uint *)(iVar7 + iVar2) = uVar6;
iVar2 = iVar2 + 4;
uVar6 = local_2c;
} while (iVar21 < *(int *)&this->field_0x8);
if (*(int *)&this->field_0x8 < 1) {
uVar6 = 0;
}
else {
iVar17 = *(int *)&this->field_0x30;
iVar7 = 0;
iVar15 = *(int *)&this->field_0x20;
iVar2 = 0;
iVar12 = *(int *)&this->field_0x28;
iVar21 = *(int *)&this->field_0x18;
do {
iVar2 = iVar2 + 1;
iVar13 = *(int *)(iVar21 + iVar7);
iVar18 = *(int *)(iVar15 + iVar7);
piVar8 = *(int **)(iVar16 + iVar7);
iVar3 = piVar8[1];
iVar5 = piVar8[2];
iVar19 = *piVar8;
iVar14 = piVar8[3];
iVar9 = piVar8[4];
iVar20 = *(int *)(iVar17 + iVar7);
iVar10 = *(int *)(iVar12 + iVar7);
*(int *)(iVar17 + iVar7) = iVar10;
lVar1 = (longlong)iVar9 * (longlong)iVar20 +
(longlong)iVar14 * (longlong)iVar10 +
(longlong)iVar5 * (longlong)iVar18 +
(longlong)iVar19 * (longlong)(int)uVar11 +
(longlong)iVar3 * (longlong)iVar13;
uVar6 = (uint)lVar1;
uVar6 = uVar6 + 0x1000000 >> 0x19 |
((int)((ulonglong)lVar1 >> 0x20) + (uint)(0xfeffffff < uVar6)) * 0x80;
*(uint *)(iVar12 + iVar7) = uVar6;
*(undefined4 *)(iVar15 + iVar7) = *(undefined4 *)(iVar21 + iVar7);
*(uint *)(iVar21 + iVar7) = uVar11;
iVar7 = iVar7 + 4;
uVar11 = uVar6;
} while (iVar2 < *(int *)&this->field_0x8);
}
}
piVar8 = local_34 + 2;
local_30[-1] = local_2c;
local_34[1] = uVar6;
local_34 = piVar8;
local_30 = local_30 + 2;
} while (piVar8 != param_1 + param_2 * 2);
}
}
else {
if ((*(int *)&this->field_0x4 == 48000) && (0 < param_2 * 2)) {
local_34 = param_1;
local_30 = param_1 + 1;
do {
uVar11 = local_34[1];
if (*(int *)&this->field_0x8 < 1) {
local_2c = 0;
uVar6 = 0;
}
else {
iVar12 = *(int *)&this->field_0x1c;
iVar2 = 0;
iVar17 = *(int *)&this->field_0x24;
iVar21 = 0;
iVar16 = *(int *)&this->field_0x10;
iVar7 = *(int *)&this->field_0x14;
iVar15 = *(int *)&this->field_0x2c;
uVar6 = local_30[-1];
do {
piVar8 = *(int **)(iVar16 + iVar2);
iVar21 = iVar21 + 1;
iVar5 = *(int *)(iVar7 + iVar2);
iVar18 = *(int *)(iVar12 + iVar2);
iVar3 = piVar8[1];
iVar13 = *piVar8;
iVar19 = piVar8[2];
iVar20 = piVar8[3];
iVar9 = piVar8[4];
iVar14 = *(int *)(iVar15 + iVar2);
iVar10 = *(int *)(iVar17 + iVar2);
*(int *)(iVar15 + iVar2) = iVar10;
lVar1 = (longlong)iVar9 * (longlong)iVar14 +
(longlong)iVar20 * (longlong)iVar10 +
(longlong)iVar19 * (longlong)iVar18 +
(longlong)iVar13 * (longlong)(int)uVar6 + (longlong)iVar3 * (longlong)iVar5;
uVar4 = (uint)lVar1;
local_2c = uVar4 + 0x1000000 >> 0x19 |
((int)((ulonglong)lVar1 >> 0x20) + (uint)(0xfeffffff < uVar4)) * 0x80;
*(uint *)(iVar17 + iVar2) = local_2c;
*(undefined4 *)(iVar12 + iVar2) = *(undefined4 *)(iVar7 + iVar2);
*(uint *)(iVar7 + iVar2) = uVar6;
iVar2 = iVar2 + 4;
uVar6 = local_2c;
} while (iVar21 < *(int *)&this->field_0x8);
if (*(int *)&this->field_0x8 < 1) {
uVar6 = 0;
}
else {
iVar17 = *(int *)&this->field_0x30;
iVar7 = 0;
iVar15 = *(int *)&this->field_0x20;
iVar2 = 0;
iVar12 = *(int *)&this->field_0x28;
iVar21 = *(int *)&this->field_0x18;
do {
iVar2 = iVar2 + 1;
iVar13 = *(int *)(iVar21 + iVar7);
iVar18 = *(int *)(iVar15 + iVar7);
piVar8 = *(int **)(iVar16 + iVar7);
iVar3 = piVar8[1];
iVar5 = piVar8[2];
iVar19 = *piVar8;
iVar14 = piVar8[3];
iVar9 = piVar8[4];
iVar20 = *(int *)(iVar17 + iVar7);
iVar10 = *(int *)(iVar12 + iVar7);
*(int *)(iVar17 + iVar7) = iVar10;
lVar1 = (longlong)iVar9 * (longlong)iVar20 +
(longlong)iVar14 * (longlong)iVar10 +
(longlong)iVar5 * (longlong)iVar18 +
(longlong)iVar19 * (longlong)(int)uVar11 +
(longlong)iVar3 * (longlong)iVar13;
uVar6 = (uint)lVar1;
uVar6 = uVar6 + 0x1000000 >> 0x19 |
((int)((ulonglong)lVar1 >> 0x20) + (uint)(0xfeffffff < uVar6)) * 0x80;
*(uint *)(iVar12 + iVar7) = uVar6;
*(undefined4 *)(iVar15 + iVar7) = *(undefined4 *)(iVar21 + iVar7);
*(uint *)(iVar21 + iVar7) = uVar11;
iVar7 = iVar7 + 4;
uVar11 = uVar6;
} while (iVar2 < *(int *)&this->field_0x8);
}
}
piVar8 = local_34 + 2;
local_30[-1] = local_2c;
local_34[1] = uVar6;
local_34 = piVar8;
local_30 = local_30 + 2;
} while (piVar8 != param_1 + param_2 * 2);
}
}
}
return;
}

75
src/effects/ViPERDDC.h Normal file
View File

@ -0,0 +1,75 @@
//
// Created by mart on 2/13/21.
//
#ifndef VIPER_VIPERDDC_H
#define VIPER_VIPERDDC_H
class ViPERDDC {
undefined field_0x0;
undefined field_0x1;
undefined field_0x2;
undefined field_0x3;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
undefined field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined field_0x18;
undefined field_0x19;
undefined field_0x1a;
undefined field_0x1b;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
undefined field_0x20;
undefined field_0x21;
undefined field_0x22;
undefined field_0x23;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
undefined field_0x28;
undefined field_0x29;
undefined field_0x2a;
undefined field_0x2b;
undefined field_0x2c;
undefined field_0x2d;
undefined field_0x2e;
undefined field_0x2f;
undefined field_0x30;
undefined field_0x31;
undefined field_0x32;
undefined field_0x33;
public:
ViPERDDC();
void ReleaseResources();
~ViPERDDC();
void Reset();
undefined4 SetEnable(bool param_1);
void SetSamplingRate(int param_1);
void SetCoeffs(int param_1,float *param_2,float *param_3);
void Process(int *param_1,int param_2);
};
#endif //VIPER_VIPERDDC_H

175
src/main.cpp Normal file
View File

@ -0,0 +1,175 @@
//
// Created by mart on 2/12/21.
//
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include "main.h"
#include "effects/Effect.h"
#include "util/misc.h"
#include "ProcessUnit_FX.h"
#include "data.h"
int EffectRelease(handle *param_1) {
Effect *this_;
if (param_1 != nullptr) {
__android_log_print(4,"ViPER4Android_v2","EffectRelease(), Deconstructing ProcessUnit");
this_ = param_1->field_0x4;
delete this_;
free(param_1);
return OK;
}
return EINVAL;
}
// uuidToString(effect_uuid_s const*, char*)
int uuidToString(effect_uuid_s *param_1,char *param_2) {
sprintf(param_2,"%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
param_1->field_0x0,
(uint)param_1->field_0x4,
(uint)param_1->field_0x6,
(uint)param_1->field_0x8,
(uint)param_1->field_0xa,
(uint)param_1->field_0xb,
(uint)param_1->field_0xc,
(uint)param_1->field_0xd,
(uint)param_1->field_0xe,
(uint)param_1->field_0xf);
return OK;
}
int EffectCreate(effect_uuid_s *uuid, int sessionId, int ioId, handle *pHandle) {
int iVar1;
handle* ptr;
ProcessUnit_FX *this_;
char acStack164 [128];
int local_24;
local_24 = __stack_chk_guard;
__android_log_print(4,"ViPER4Android_v2","Enter EffectCreate()");
if (uuid == nullptr) {
__android_log_print(4,"ViPER4Android_v2","EffectCreate(), Error [uuid = nullptr]");
iVar1 = -0x16;
}
else {
if (pHandle == nullptr) {
__android_log_print(4,"ViPER4Android_v2","EffectCreate(), Error [pEffect = nullptr]");
iVar1 = -0x16;
}
else {
uuidToString(uuid, acStack164);
__android_log_print(4,"ViPER4Android_v2","EffectCreate(), uuid = %s",acStack164);
iVar1 = memcmp(uuid, &DAT_000d127c, 0x10);
if (iVar1 == 0) {
ptr = (handle*)calloc(1,0xc);
if (ptr == nullptr) {
__android_log_print(4,"ViPER4Android_v2",
"EffectCreate(), v4a standard effect, Error [calloc() return nullptr]");
iVar1 = -0x16;
}
else {
__android_log_print(4,"ViPER4Android_v2",
"EffectCreate(), v4a standard effect (normal), Constructing ProcessUnit_FX"
);
ptr->interface = (intf *)&PTR_LAB_000d0cb0;
this_ = new ProcessUnit_FX();
ptr->core = this_;
if (this_ == nullptr) {
__android_log_print(4,"ViPER4Android_v2",
"EffectCreate(), v4a standard effect, Error [new ProcessUnit_FX() return nullptr]"
);
__android_log_print(4,"ViPER4Android_v2",
"EffectCreate(), v4a standard effect, Error [ProcessUnit_FX construct failed]"
);
free(ptr);
iVar1 = -0x16;
}
else {
ptr->descriptor = &DAT_000d126c;
__android_log_print(4,"ViPER4Android_v2","Creating %s",
s_ViPER4Android__2_5_0_4__000d1298);
*&pHandle = ptr;
}
}
}
else {
__android_log_print(4,"ViPER4Android_v2","EffectCreate(), Error [effect not found]");
iVar1 = -2;
}
}
}
if (local_24 == __stack_chk_guard) {
return iVar1;
}
// WARNING: Subroutine does not return
__stack_chk_fail();
}
int EffectGetDescriptor(effect_uuid_s *uuid, effect_descriptor_t *pDescriptor) {
int iVar1;
char uuidAsString [128];
int local_24;
__android_log_print(4, "ViPER4Android_v2", "Enter EffectGetDescriptor()");
if (uuid == nullptr) {
__android_log_print(4, "ViPER4Android_v2", "EffectGetDescriptor(), uuid = nullptr");
return -EINVAL;
}
if (pDescriptor == nullptr) {
__android_log_print(4, "ViPER4Android_v2", "EffectGetDescriptor(), pDescriptor = nullptr");
return -EINVAL;
}
uuidToString(uuid, uuidAsString);
__android_log_print(4, "ViPER4Android_v2", "EffectGetDescriptor(), uuid = %s", uuidAsString);
iVar1 = memcmp(uuid, &DAT_000d126c.uuid, 0x10);
if (iVar1 == 0) {
memcpy(pDescriptor, &DAT_000d126c, 0xac);
return OK;
}
__android_log_print(4,"ViPER4Android_v2","EffectGetDescriptor(), Error [uuid not found]");
return -ENOENT;
}
int GetLibraryVersionMain() {
return 2;
}
int GetLibraryVersionSub() {
return 5;
}
int GetLibraryVersionExt() {
return 0;
}
int GetLibraryVersionBuild() {
return 4;
}
char * GetLibraryVersionCodename() {
return (char*)"Beautiful";
}

43
src/main.h Normal file
View File

@ -0,0 +1,43 @@
#ifndef VIPER_MAIN
#define VIPER_MAIN
#include "util/misc.h"
#include "ProcessUnit_FX.h"
typedef struct intf {
int32_t (*process)(effect_handle_t self,
audio_buffer_t *inBuffer,
audio_buffer_t *outBuffer);
int32_t (*command)(effect_handle_t self,
uint32_t cmdCode,
uint32_t cmdSize,
void *pCmdData,
uint32_t *replySize,
void *pReplyData);
int32_t (*get_descriptor)(effect_handle_t self,
effect_descriptor_t *pDescriptor);
int32_t (*process_reverse)(effect_handle_t self,
audio_buffer_t *inBuffer,
audio_buffer_t *outBuffer);
} intf;
typedef struct handle {
intf* interface;
ProcessUnit_FX* core;
void* descriptor;
} handle;
extern "C" {
int EffectRelease(handle *param_1);
int uuidToString(effect_uuid_s *param_1,char *param_2);
int EffectCreate(effect_uuid_s *uuid, int sessionId, int ioId, handle *pHandle);
int EffectGetDescriptor(effect_uuid_s *uuid, effect_descriptor_t *pDescriptor);
int GetLibraryVersionMain();
int GetLibraryVersionSub();
int GetLibraryVersionExt();
int GetLibraryVersionBuild();
char * GetLibraryVersionCodename();
};
#endif

View File

@ -0,0 +1,541 @@
//
// Created by mart on 2/12/21.
//
#include "AdaptiveBuffer_FPI32.h"
// AdaptiveBuffer_FPI32::AdaptiveBuffer_FPI32(unsigned int, unsigned int)
AdaptiveBuffer_FPI32::AdaptiveBuffer_FPI32(uint param_1,uint param_2) {
void *pvVar1;
this->channels = param_1;
this->bufferPointer = nullptr;
this->bufferLength = 0;
this->bufferOffset = 0;
if (param_1 != 0) {
pvVar1 = valloc(param_1 * param_2 * 4);
this->bufferPointer = pvVar1;
if (pvVar1 != nullptr) {
this->bufferLength = param_2;
}
}
return this;
}
// AdaptiveBuffer_FPI32::~AdaptiveBuffer_FPI32()
AdaptiveBuffer_FPI32::~AdaptiveBuffer_FPI32() {
if (this->bufferPointer != nullptr) {
free(this->bufferPointer);
}
this->bufferPointer = nullptr;
return this;
}
// AdaptiveBuffer_FPI32::FlushBuffer()
void AdaptiveBuffer_FPI32::FlushBuffer() {
this->bufferOffset = 0;
return;
}
// AdaptiveBuffer_FPI32::PushZero(unsigned int)
undefined4 AdaptiveBuffer_FPI32::PushZero(uint param_1) {
int iVar1;
int iVar2;
void *__dest;
__dest = this->bufferPointer;
if (__dest == nullptr) {
return 0;
}
iVar2 = this->bufferOffset;
if (this->bufferLength < param_1 + iVar2) {
__dest = valloc((param_1 + iVar2) * this->channels * 4);
if (__dest == nullptr) {
return 0;
}
memcpy(__dest,this->bufferPointer,this->channels * this->bufferOffset * 4);
free(this->bufferPointer);
iVar2 = this->bufferOffset;
this->bufferPointer = __dest;
this->bufferLength = param_1 + iVar2;
}
iVar1 = this->channels * 4;
memset((void *)(iVar2 * iVar1 + (int)__dest),0,iVar1 * param_1);
this->bufferOffset = this->bufferOffset + param_1;
return 1;
}
// AdaptiveBuffer_FPI32::PushFrames(short*, unsigned int)
undefined4 AdaptiveBuffer_FPI32::PushFrames(short *param_1,uint param_2) {
undefined4 uVar1;
undefined4 uVar2;
int iVar3;
undefined8 *puVar4;
int *piVar5;
short *psVar6;
int iVar7;
short *psVar8;
void *__dest;
undefined8 *puVar9;
short *psVar10;
uint uVar11;
uint uVar12;
short *psVar13;
undefined auVar14 [16];
undefined auVar15 [16];
undefined auVar16 [16];
undefined auVar17 [16];
__dest = this->bufferPointer;
if (__dest == nullptr) {
return 0;
}
if (param_2 == 0) {
return 1;
}
iVar7 = this->bufferOffset;
if (this->bufferLength < param_2 + iVar7) {
__dest = valloc((param_2 + iVar7) * this->channels * 4);
if (__dest == nullptr) {
return 0;
}
memcpy(__dest,this->bufferPointer,this->channels * this->bufferOffset * 4);
free(this->bufferPointer);
iVar7 = this->bufferOffset;
this->bufferPointer = __dest;
this->bufferLength = param_2 + iVar7;
}
uVar12 = this->channels * param_2;
puVar4 = (undefined8 *)(iVar7 * this->channels * 4 + (int)__dest);
if ((int)uVar12 < 0x10) {
if (0 < (int)uVar12) {
piVar5 = (int *)((int)puVar4 + -4);
iVar7 = 0;
do {
psVar13 = (short *)((int)param_1 + iVar7);
iVar7 = iVar7 + 2;
piVar5 = piVar5 + 1;
*piVar5 = (int)*psVar13 << 10;
} while (iVar7 != uVar12 * 2);
iVar7 = this->bufferOffset;
}
this->bufferOffset = iVar7 + param_2;
return 1;
}
uVar11 = uVar12 & 0xfffffff0;
if (uVar11 != 0) {
iVar7 = 0;
puVar9 = puVar4;
psVar13 = param_1;
do {
psVar8 = psVar13 + 8;
psVar6 = psVar13 + 0xc;
iVar7 = iVar7 + 0x10;
uVar1 = CONCAT22(*psVar13,*psVar13);
psVar10 = psVar13 + 4;
psVar13 = psVar13 + 0x10;
uVar2 = CONCAT22(*psVar10,*psVar10);
auVar17 = VectorShiftLongLeft(CONCAT44(uVar1,uVar1),10);
uVar1 = CONCAT22(*psVar8,*psVar8);
auVar16 = VectorShiftLongLeft(CONCAT44(uVar2,uVar2),10);
uVar2 = CONCAT22(*psVar6,*psVar6);
auVar15 = VectorShiftLongLeft(CONCAT44(uVar1,uVar1),10);
auVar14 = VectorShiftLongLeft(CONCAT44(uVar2,uVar2),10);
*puVar9 = CONCAT44(SUB164(auVar17,0),SUB164(auVar17,0));
uVar1 = SUB164(auVar17 >> 0x40,0);
*(ulonglong *)((int)puVar9 + 4) = CONCAT44(uVar1,uVar1);
puVar9[2] = CONCAT44(SUB164(auVar16,0),SUB164(auVar16,0));
uVar1 = SUB164(auVar16 >> 0x40,0);
*(ulonglong *)((int)puVar9 + 0x14) = CONCAT44(uVar1,uVar1);
puVar9[4] = CONCAT44(SUB164(auVar15,0),SUB164(auVar15,0));
uVar1 = SUB164(auVar15 >> 0x40,0);
*(ulonglong *)((int)puVar9 + 0x24) = CONCAT44(uVar1,uVar1);
puVar9[6] = CONCAT44(SUB164(auVar14,0),SUB164(auVar14,0));
uVar1 = SUB164(auVar14 >> 0x40,0);
*(ulonglong *)((int)puVar9 + 0x34) = CONCAT44(uVar1,uVar1);
puVar9 = puVar9 + 8;
} while (iVar7 < (int)uVar11);
}
if (uVar12 - uVar11 != 0 && (int)uVar11 <= (int)uVar12) {
puVar4 = (undefined8 *)((int)puVar4 + (uVar11 + 0x3fffffff) * 4);
iVar7 = 0;
do {
iVar3 = iVar7 + uVar11 * 2;
iVar7 = iVar7 + 2;
puVar4 = (undefined8 *)((int)puVar4 + 4);
*(int *)puVar4 = (int)*(short *)((int)param_1 + iVar3) << 10;
} while (iVar7 != (uVar12 - uVar11) * 2);
}
this->bufferOffset = this->bufferOffset + param_2;
return 1;
}
// AdaptiveBuffer_FPI32::PushFrames(int*, unsigned int)
undefined4 AdaptiveBuffer_FPI32::PushFrames(int *param_1,uint param_2) {
int iVar1;
int iVar2;
void *__dest;
__dest = this->bufferPointer;
if (__dest == nullptr) {
return 0;
}
if (param_2 != 0) {
iVar2 = this->bufferOffset;
if (this->bufferLength < param_2 + iVar2) {
__dest = valloc((param_2 + iVar2) * this->channels * 4);
if (__dest == nullptr) {
return 0;
}
memcpy(__dest,this->bufferPointer,this->channels * this->bufferOffset * 4);
free(this->bufferPointer);
iVar2 = this->bufferOffset;
this->bufferPointer = __dest;
this->bufferLength = param_2 + iVar2;
}
iVar1 = this->channels * 4;
memcpy((void *)(iVar2 * iVar1 + (int)__dest),param_1,iVar1 * param_2);
this->bufferOffset = this->bufferOffset + param_2;
return 1;
}
return 1;
}
// AdaptiveBuffer_FPI32::PopFrames(short*, unsigned int)
undefined4 AdaptiveBuffer_FPI32::PopFrames(short *param_1,uint param_2) {
undefined auVar1 [16];
int *piVar2;
ulonglong *puVar3;
uint uVar4;
int iVar5;
uint uVar6;
uint uVar7;
void *__dest;
undefined4 *puVar8;
int iVar9;
ulonglong uVar10;
undefined auVar11 [16];
ulonglong uVar12;
undefined auVar13 [16];
ulonglong uVar14;
undefined auVar15 [16];
undefined8 uVar16;
undefined auVar18 [16];
ulonglong uVar17;
__dest = this->bufferPointer;
if ((__dest == nullptr) || (uVar4 = this->bufferOffset, uVar4 < param_2)) {
return 0;
}
if (param_2 != 0) {
uVar7 = this->channels;
uVar6 = uVar7 * param_2;
if ((int)uVar6 < 0x10) {
if (0 < (int)uVar6) {
piVar2 = (int *)((int)__dest + -4);
iVar5 = 0;
do {
piVar2 = piVar2 + 1;
iVar9 = *piVar2 + 0x200;
if (iVar9 < -0x2000000) {
iVar9 = -0x2000000;
}
if (0x1fffffe < iVar9) {
iVar9 = 0x1ffffff;
}
*(short *)((int)param_1 + iVar5) = (short)(iVar9 >> 10);
iVar5 = iVar5 + 2;
} while (iVar5 != uVar6 * 2);
}
iVar5 = uVar4 - param_2;
this->bufferOffset = iVar5;
if (iVar5 != 0) {
memmove(__dest,(void *)((int)__dest + uVar6 * 4),iVar5 * uVar7 * 4);
}
}
else {
uVar7 = uVar6 & 0xfffffff0;
if (uVar7 != 0) {
auVar1 = SIMDExpandImmediate(0,2,2);
iVar5 = 0;
puVar3 = (ulonglong *)(param_1 + 4);
while( true ) {
puVar8 = (undefined4 *)((int)__dest + iVar5);
auVar18 = VectorAdd(CONCAT88(CONCAT44(puVar8[1],puVar8[1]),CONCAT44(*puVar8,*puVar8)),
auVar1,4);
iVar5 = iVar5 + 0x40;
auVar15 = VectorAdd(CONCAT88(CONCAT44(puVar8[5],puVar8[5]),CONCAT44(puVar8[4],puVar8[4])),
auVar1,4);
auVar13 = VectorAdd(CONCAT88(CONCAT44(puVar8[9],puVar8[9]),CONCAT44(puVar8[8],puVar8[8])),
auVar1,4);
auVar11 = VectorAdd(CONCAT88(CONCAT44(puVar8[0xd],puVar8[0xd]),
CONCAT44(puVar8[0xc],puVar8[0xc])),auVar1,4);
uVar16 = VectorShiftRightNarrow(auVar18,10,2,0);
uVar17 = SatQ(uVar16,2,0);
uVar16 = VectorShiftRightNarrow(auVar15,10,2,0);
uVar14 = SatQ(uVar16,2,0);
uVar16 = VectorShiftRightNarrow(auVar13,10,2,0);
uVar12 = SatQ(uVar16,2,0);
uVar16 = VectorShiftRightNarrow(auVar11,10,2,0);
uVar10 = SatQ(uVar16,2,0);
uVar17 = uVar17 & 0xffff | (uVar17 & 0xffff) << 0x10;
puVar3[-1] = uVar17 | uVar17 << 0x20;
uVar17 = uVar14 & 0xffff | (uVar14 & 0xffff) << 0x10;
*puVar3 = uVar17 | uVar17 << 0x20;
uVar17 = uVar12 & 0xffff | (uVar12 & 0xffff) << 0x10;
puVar3[1] = uVar17 | uVar17 << 0x20;
uVar17 = uVar10 & 0xffff | (uVar10 & 0xffff) << 0x10;
puVar3[2] = uVar17 | uVar17 << 0x20;
if (puVar3 == (ulonglong *)((int)(param_1 + 4) + uVar7 * 2 + -0x20)) break;
__dest = this->bufferPointer;
puVar3 = puVar3 + 4;
}
uVar4 = this->bufferOffset;
}
if (uVar6 - uVar7 != 0 && (int)uVar7 <= (int)uVar6) {
iVar5 = 0;
piVar2 = (int *)((int)this->bufferPointer + (uVar7 + 0x3fffffff) * 4);
do {
piVar2 = piVar2 + 1;
iVar9 = *piVar2 + 0x200;
if (iVar9 < -0x2000000) {
iVar9 = -0x2000000;
}
if (0x1fffffe < iVar9) {
iVar9 = 0x1ffffff;
}
*(short *)((int)param_1 + iVar5 + uVar7 * 2) = (short)(iVar9 >> 10);
iVar5 = iVar5 + 2;
} while (iVar5 != (uVar6 - uVar7) * 2);
}
iVar5 = uVar4 - param_2;
this->bufferOffset = iVar5;
if (iVar5 != 0) {
iVar9 = this->channels * 4;
memmove(this->bufferPointer,(void *)(iVar9 * param_2 + (int)this->bufferPointer),
iVar9 * iVar5);
return 1;
}
}
}
return 1;
}
// AdaptiveBuffer_FPI32::ScaleFrames(int)
void AdaptiveBuffer_FPI32::ScaleFrames(int param_1) {
undefined4 uVar1;
longlong lVar2;
ulonglong *puVar3;
int iVar4;
int iVar5;
uint *puVar6;
uint *puVar7;
uint *puVar8;
uint uVar9;
uint uVar10;
ulonglong uVar11;
undefined auVar12 [16];
undefined8 uVar13;
undefined auVar15 [16];
ulonglong uVar14;
puVar6 = (uint *)this->bufferPointer;
if (puVar6 != nullptr) {
uVar9 = this->bufferOffset * this->channels;
if ((int)uVar9 < 4) {
if (0 < (int)uVar9) {
puVar7 = puVar6;
do {
lVar2 = (longlong)(int)*puVar7 * (longlong)param_1 + 0x1000000;
puVar8 = puVar7 + 1;
*puVar7 = (uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7;
puVar7 = puVar8;
} while (puVar8 != puVar6 + uVar9);
}
}
else {
uVar10 = uVar9 & 0xfffffffc;
if (uVar10 != 0) {
iVar4 = 8;
iVar5 = 0;
while( true ) {
puVar3 = (ulonglong *)(puVar6 + iVar5);
iVar5 = iVar5 + 4;
uVar1 = *(undefined4 *)puVar3;
auVar15 = VectorMultiply(CONCAT44(*(undefined4 *)((int)puVar6 + iVar4),
*(undefined4 *)((int)puVar6 + iVar4)),
CONCAT44(param_1,param_1),4,0);
auVar12 = VectorMultiply(CONCAT44(uVar1,uVar1),CONCAT44(param_1,param_1),4,0);
auVar15 = VectorAdd(auVar15,CONCAT88(0x1000000,0x1000000),8);
auVar12 = VectorAdd(auVar12,CONCAT88(0x1000000,0x1000000),8);
uVar13 = VectorShiftRightNarrow(auVar15,0x19,4,0);
uVar14 = SatQ(uVar13,4,0);
uVar13 = VectorShiftRightNarrow(auVar12,0x19,4,0);
uVar11 = SatQ(uVar13,4,0);
*puVar3 = uVar11 & 0xffffffff | (uVar11 & 0xffffffff) << 0x20;
puVar3 = (ulonglong *)((int)this->bufferPointer + iVar4);
iVar4 = iVar4 + 0x10;
*puVar3 = uVar14 & 0xffffffff | (uVar14 & 0xffffffff) << 0x20;
if ((int)uVar10 <= iVar5) break;
puVar6 = (uint *)this->bufferPointer;
}
}
if (uVar9 - uVar10 != 0 && (int)uVar10 <= (int)uVar9) {
puVar6 = (uint *)((int)this->bufferPointer + uVar10 * 4);
do {
uVar10 = uVar10 + 1;
lVar2 = (longlong)(int)*puVar6 * (longlong)param_1 + 0x1000000;
*puVar6 = (uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7;
puVar6 = puVar6 + 1;
} while (uVar9 - uVar10 != 0);
return;
}
}
}
return;
}
// AdaptiveBuffer_FPI32::PanFrames(int, int)
void AdaptiveBuffer_FPI32::PanFrames(int param_1,int param_2) {
uint uVar1;
undefined4 uVar2;
longlong lVar3;
ulonglong *puVar4;
int iVar5;
int iVar6;
uint uVar7;
uint uVar8;
uint *puVar9;
ulonglong uVar10;
undefined auVar11 [16];
undefined8 uVar12;
undefined auVar14 [16];
int local_20 [2];
ulonglong uVar13;
puVar9 = (uint *)this->bufferPointer;
if ((puVar9 != nullptr) && (this->channels == 2)) {
local_20[0] = param_1;
local_20[1] = param_2;
uVar1 = this->bufferOffset * 2;
if ((int)uVar1 < 4) {
if (0 < (int)uVar1) {
uVar8 = 0;
while( true ) {
uVar8 = uVar8 + 1;
lVar3 = (longlong)(int)*puVar9 * (longlong)param_1 + 0x1000000;
*puVar9 = (uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7;
if (uVar1 == uVar8) break;
param_1 = local_20[uVar8 & 1];
puVar9 = puVar9 + 1;
}
return;
}
}
else {
uVar8 = uVar1 & 0xfffffffc;
if (uVar8 != 0) {
iVar5 = 8;
iVar6 = 0;
while( true ) {
puVar4 = (ulonglong *)(puVar9 + iVar6);
iVar6 = iVar6 + 4;
uVar2 = *(undefined4 *)puVar4;
auVar14 = VectorMultiply(CONCAT44(*(undefined4 *)((int)puVar9 + iVar5),
*(undefined4 *)((int)puVar9 + iVar5)),
CONCAT44(param_1,param_1),4,0);
auVar11 = VectorMultiply(CONCAT44(uVar2,uVar2),CONCAT44(param_1,param_1),4,0);
auVar14 = VectorAdd(auVar14,CONCAT88(0x1000000,0x1000000),8);
auVar11 = VectorAdd(auVar11,CONCAT88(0x1000000,0x1000000),8);
uVar12 = VectorShiftRightNarrow(auVar14,0x19,4,0);
uVar13 = SatQ(uVar12,4,0);
uVar12 = VectorShiftRightNarrow(auVar11,0x19,4,0);
uVar10 = SatQ(uVar12,4,0);
*puVar4 = uVar10 & 0xffffffff | (uVar10 & 0xffffffff) << 0x20;
puVar4 = (ulonglong *)((int)this->bufferPointer + iVar5);
iVar5 = iVar5 + 0x10;
*puVar4 = uVar13 & 0xffffffff | (uVar13 & 0xffffffff) << 0x20;
if ((int)uVar8 <= iVar6) break;
puVar9 = (uint *)this->bufferPointer;
}
}
if ((int)uVar8 < (int)uVar1) {
puVar9 = (uint *)((int)this->bufferPointer + uVar8 * 4);
do {
uVar7 = uVar8 & 1;
uVar8 = uVar8 + 1;
lVar3 = (longlong)(int)*puVar9 * (longlong)local_20[uVar7] + 0x1000000;
*puVar9 = (uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7;
puVar9 = puVar9 + 1;
} while (uVar1 != uVar8);
}
}
}
return;
}
// AdaptiveBuffer_FPI32::SetBufferOffset(unsigned int)
void AdaptiveBuffer_FPI32::SetBufferOffset(uint param_1) {
this->bufferOffset = param_1;
return;
}
// AdaptiveBuffer_FPI32::GetBufferPointer()
void * AdaptiveBuffer_FPI32::GetBufferPointer() {
return this->bufferPointer;
}
// AdaptiveBuffer_FPI32::GetBufferLength()
uint AdaptiveBuffer_FPI32::GetBufferLength() {
return this->bufferLength;
}
// AdaptiveBuffer_FPI32::GetBufferOffset()
undefined4 AdaptiveBuffer_FPI32::GetBufferOffset() {
return this->bufferOffset;
}
// AdaptiveBuffer_FPI32::GetChannels()
uint AdaptiveBuffer_FPI32::GetChannels() {
return this->channels;
}

View File

@ -0,0 +1,50 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_ADAPTIVEBUFFER_FPI32_H
#define VIPER_ADAPTIVEBUFFER_FPI32_H
#include "../libv4a_fx.so.h"
class AdaptiveBuffer_FPI32 {
void * bufferPointer;
uint bufferLength;
undefined4 bufferOffset;
uint channels;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined field_0x18;
undefined field_0x19;
undefined field_0x1a;
undefined field_0x1b;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
public:
AdaptiveBuffer_FPI32(uint param_1,uint param_2);
~AdaptiveBuffer_FPI32();
void FlushBuffer();
undefined4 PushZero(uint param_1);
undefined4 PushFrames(short *param_1,uint param_2);
undefined4 PushFrames(int *param_1,uint param_2);
undefined4 PopFrames(short *param_1,uint param_2);
void ScaleFrames(int param_1);
void PanFrames(int param_1,int param_2);
void SetBufferOffset(uint param_1);
void * GetBufferPointer();
uint GetBufferLength();
undefined4 GetBufferOffset();
uint GetChannels();
};
#endif //VIPER_ADAPTIVEBUFFER_FPI32_H

View File

@ -0,0 +1,541 @@
//
// Created by mart on 2/12/21.
//
#include "AdaptiveBuffer_R32.h"
// AdaptiveBuffer_R32::AdaptiveBuffer_R32(unsigned int, unsigned int)
AdaptiveBuffer_R32::AdaptiveBuffer_R32(uint param_1,uint param_2) {
void *pvVar1;
this->channels = param_1;
this->bufferPointer = nullptr;
this->bufferLength = 0;
this->bufferOffset = 0;
if (param_1 != 0) {
pvVar1 = valloc(param_1 * param_2 * 4);
this->bufferPointer = pvVar1;
if (pvVar1 != nullptr) {
this->bufferLength = param_2;
}
}
return this;
}
// AdaptiveBuffer_R32::~AdaptiveBuffer_R32()
AdaptiveBuffer_R32::~AdaptiveBuffer_R32() {
if (this->bufferPointer != nullptr) {
free(this->bufferPointer);
}
this->bufferPointer = nullptr;
return this;
}
// AdaptiveBuffer_R32::Short2Float(short*, float*, unsigned int)
void AdaptiveBuffer_R32::Short2Float(short *param_1,float *param_2,uint param_3) {
bool bVar1;
undefined4 uVar2;
int iVar3;
undefined8 *puVar4;
short *psVar5;
float *pfVar6;
uint uVar7;
uint uVar8;
uint uVar9;
undefined4 in_cr7;
undefined auVar10 [16];
uVar7 = this->channels * param_3;
if (uVar7 < 4) {
iVar3 = uVar7 - 1;
if (uVar7 != 0) {
psVar5 = param_1 + uVar7;
pfVar6 = param_2 + uVar7;
do {
psVar5 = psVar5 + -1;
iVar3 = iVar3 + -1;
coprocessor_function(10,6,4,in_cr7,in_cr7,in_cr7);
pfVar6 = pfVar6 + -1;
*pfVar6 = (float)(longlong)(int)*psVar5;
} while (iVar3 != -1);
}
}
else {
uVar9 = uVar7 & 3;
if (uVar7 >> 2 != 0) {
puVar4 = (undefined8 *)param_2;
uVar7 = uVar7 >> 2;
psVar5 = param_1;
do {
uVar2 = CONCAT22(*psVar5,*psVar5);
psVar5 = psVar5 + 4;
auVar10 = VectorCopyLong(CONCAT44(uVar2,uVar2),2,0);
auVar10 = FixedToFP(auVar10,0x20,0x20,0,0,0);
auVar10 = FloatVectorMult(auVar10,ZEXT816(0x3800010038000100) &
ZEXT816(0x3800010038000100) << 0x40,2,0x20);
uVar8 = uVar7 - 1;
*puVar4 = CONCAT44(SUB164(auVar10,0),SUB164(auVar10,0));
uVar2 = SUB164(auVar10 >> 0x40,0);
*(ulonglong *)((int)puVar4 + 4) = CONCAT44(uVar2,uVar2);
puVar4 = puVar4 + 2;
bVar1 = 0 < (int)uVar7;
uVar7 = uVar8;
} while (uVar8 != 0 && bVar1);
}
if (uVar9 != 0) {
psVar5 = param_1 + uVar9;
pfVar6 = param_2 + uVar9;
iVar3 = uVar9 - 1;
do {
psVar5 = psVar5 + -1;
iVar3 = iVar3 + -1;
coprocessor_function(10,6,4,in_cr7,in_cr7,in_cr7);
pfVar6 = pfVar6 + -1;
*pfVar6 = (float)(longlong)(int)*psVar5;
} while (iVar3 != -1);
return;
}
}
return;
}
// AdaptiveBuffer_R32::Float2Short(float*, short*, unsigned int)
void AdaptiveBuffer_R32::Float2Short(float *param_1,short *param_2,uint param_3) {
bool bVar1;
undefined auVar2 [16];
float fVar3;
int iVar4;
ulonglong *puVar5;
float *pfVar6;
short *psVar7;
uint uVar8;
uint uVar9;
uint uVar10;
float *pfVar11;
undefined4 in_cr7;
ulonglong uVar12;
undefined auVar13 [16];
undefined auVar14 [16];
uVar8 = this->channels * param_3;
if (uVar8 < 4) {
iVar4 = uVar8 - 1;
if (uVar8 != 0) {
pfVar6 = param_1 + uVar8;
psVar7 = param_2 + uVar8;
do {
pfVar6 = pfVar6 + -1;
iVar4 = iVar4 + -1;
coprocessor_function(10,6,4,in_cr7,in_cr7,in_cr7);
psVar7 = psVar7 + -1;
*psVar7 = SUB42(ROUND(*pfVar6),0);
} while (iVar4 != -1);
}
}
else {
uVar10 = uVar8 & 3;
if (uVar8 >> 2 != 0) {
auVar2 = ZEXT816(0x3f8000003f800000) & ZEXT816(0x3f8000003f800000) << 0x40;
auVar14 = FloatVectorNeg(auVar2,2,0x20);
puVar5 = (ulonglong *)param_2;
uVar8 = uVar8 >> 2;
pfVar6 = param_1;
do {
fVar3 = *pfVar6;
pfVar11 = pfVar6 + 1;
pfVar6 = pfVar6 + 4;
auVar13 = FloatVectorMin(CONCAT88(CONCAT44(*pfVar11,*pfVar11),CONCAT44(fVar3,fVar3)),auVar2,
2,0x20);
auVar13 = FloatVectorMax(auVar13,auVar14,2,0x20);
auVar13 = FloatVectorMult(auVar13,ZEXT816(0x46fffe0046fffe00) &
ZEXT816(0x46fffe0046fffe00) << 0x40,2,0x20);
auVar13 = FPToFixed(auVar13,0x20,0x20,0x10,0,3);
uVar12 = VectorRoundShiftRightNarrow(auVar13,0x10);
uVar9 = uVar8 - 1;
uVar12 = uVar12 & 0xffff | (uVar12 & 0xffff) << 0x10;
*puVar5 = uVar12 | uVar12 << 0x20;
puVar5 = puVar5 + 1;
bVar1 = 0 < (int)uVar8;
uVar8 = uVar9;
} while (uVar9 != 0 && bVar1);
}
if (uVar10 != 0) {
pfVar6 = param_1 + uVar10;
psVar7 = param_2 + uVar10;
iVar4 = uVar10 - 1;
do {
pfVar6 = pfVar6 + -1;
iVar4 = iVar4 + -1;
coprocessor_function(10,6,4,in_cr7,in_cr7,in_cr7);
psVar7 = psVar7 + -1;
*psVar7 = SUB42(ROUND(*pfVar6),0);
} while (iVar4 != -1);
return;
}
}
return;
}
// AdaptiveBuffer_R32::FlushBuffer()
void AdaptiveBuffer_R32::FlushBuffer() {
this->bufferOffset = 0;
return;
}
// AdaptiveBuffer_R32::PushZero(unsigned int)
undefined4 AdaptiveBuffer_R32::PushZero(uint param_1) {
int iVar1;
int iVar2;
void *__dest;
__dest = this->bufferPointer;
if (__dest == nullptr) {
return 0;
}
iVar2 = this->bufferOffset;
if (this->bufferLength < param_1 + iVar2) {
__dest = valloc((param_1 + iVar2) * this->channels * 4);
if (__dest == nullptr) {
return 0;
}
memcpy(__dest,this->bufferPointer,this->channels * this->bufferOffset * 4);
free(this->bufferPointer);
iVar2 = this->bufferOffset;
this->bufferPointer = __dest;
this->bufferLength = param_1 + iVar2;
}
iVar1 = this->channels * 4;
memset((void *)(iVar2 * iVar1 + (int)__dest),0,iVar1 * param_1);
this->bufferOffset = this->bufferOffset + param_1;
return 1;
}
// AdaptiveBuffer_R32::PushFrames(short*, unsigned int)
undefined4 AdaptiveBuffer_R32::PushFrames(short *param_1,uint param_2) {
int iVar1;
void *__dest;
__dest = this->bufferPointer;
if (__dest == nullptr) {
return 0;
}
if (param_2 != 0) {
iVar1 = this->bufferOffset;
if (this->bufferLength < param_2 + iVar1) {
__dest = valloc((param_2 + iVar1) * this->channels * 4);
if (__dest == nullptr) {
return 0;
}
memcpy(__dest,this->bufferPointer,this->channels * this->bufferOffset * 4);
free(this->bufferPointer);
iVar1 = this->bufferOffset;
this->bufferPointer = __dest;
this->bufferLength = param_2 + iVar1;
}
Short2Float(this,param_1,(float *)(iVar1 * this->channels * 4 + (int)__dest),param_2);
this->bufferOffset = this->bufferOffset + param_2;
return 1;
}
return 1;
}
// AdaptiveBuffer_R32::PopFrames(short*, unsigned int)
undefined4 AdaptiveBuffer_R32::PopFrames(short *param_1,uint param_2) {
int iVar1;
int iVar2;
if (((float *)this->bufferPointer != nullptr) && (param_2 <= (uint)this->bufferOffset)) {
if (param_2 != 0) {
Float2Short(this,(float *)this->bufferPointer,param_1,param_2);
iVar2 = this->bufferOffset - param_2;
this->bufferOffset = iVar2;
if (iVar2 != 0) {
iVar1 = this->channels * 4;
memmove(this->bufferPointer,(void *)(iVar1 * param_2 + (int)this->bufferPointer),
iVar1 * iVar2);
}
}
return 1;
}
return 0;
}
// WARNING: Restarted to delay deadcode elimination for space: register
// AdaptiveBuffer_R32::ScaleFrames(float)
void AdaptiveBuffer_R32::ScaleFrames(float param_1) {
undefined auVar1 [16];
undefined4 uVar2;
undefined4 uVar4;
undefined4 in_r1;
uint uVar6;
undefined4 *puVar7;
undefined8 *puVar8;
int iVar9;
uint uVar10;
int iVar11;
int iVar12;
undefined4 *puVar13;
int iVar14;
undefined4 in_cr7;
undefined auVar15 [16];
undefined auVar16 [16];
undefined auVar17 [16];
undefined4 uVar3;
undefined4 uVar5;
puVar7 = (undefined4 *)this->bufferPointer;
if ((puVar7 != nullptr) && (-1 < (int)puVar7)) {
uVar6 = this->bufferOffset * this->channels;
if ((int)uVar6 < 0x10) {
if (0 < (int)uVar6) {
iVar9 = 0;
do {
iVar9 = iVar9 + 1;
coprocessor_function(10,2,1,in_cr7,in_cr7,in_cr7);
*puVar7 = *puVar7;
puVar7 = puVar7 + 1;
} while (uVar6 - iVar9 != 0);
}
}
else {
uVar10 = uVar6 & 0xfffffff0;
auVar1 = ZEXT816(CONCAT44(in_r1,in_r1)) & ZEXT816(CONCAT44(in_r1,in_r1)) << 0x40;
if (uVar10 != 0) {
iVar9 = 0x10;
iVar14 = 0;
while( true ) {
puVar8 = (undefined8 *)(puVar7 + iVar14);
iVar12 = iVar9 + 0x10;
iVar11 = iVar9 + 0x20;
uVar2 = *(undefined4 *)((int)puVar7 + iVar9);
uVar3 = ((undefined4 *)((int)puVar7 + iVar9))[1];
puVar13 = (undefined4 *)((int)puVar7 + iVar12);
puVar7 = (undefined4 *)((int)puVar7 + iVar11);
iVar14 = iVar14 + 0x10;
auVar17 = FloatVectorMult(CONCAT88(CONCAT44(*(undefined4 *)((int)puVar8 + 4),
*(undefined4 *)((int)puVar8 + 4)),
CONCAT44(*(undefined4 *)puVar8,*(undefined4 *)puVar8)),
auVar1,2,0x20);
auVar16 = FloatVectorMult(CONCAT88(CONCAT44(uVar3,uVar3),CONCAT44(uVar2,uVar2)),auVar1,2,
0x20);
uVar2 = *puVar7;
uVar3 = puVar7[1];
uVar4 = *puVar13;
uVar5 = puVar13[1];
auVar15 = FloatVectorMult(CONCAT88(CONCAT44(uVar5,uVar5),CONCAT44(uVar4,uVar4)),auVar1,2,
0x20);
*puVar8 = CONCAT44(SUB164(auVar17,0),SUB164(auVar17,0));
uVar4 = SUB164(auVar17 >> 0x40,0);
*(ulonglong *)((int)puVar8 + 4) = CONCAT44(uVar4,uVar4);
auVar17 = FloatVectorMult(CONCAT88(CONCAT44(uVar3,uVar3),CONCAT44(uVar2,uVar2)),auVar1,2,
0x20);
puVar8 = (undefined8 *)((int)this->bufferPointer + iVar9);
iVar9 = iVar9 + 0x40;
*puVar8 = CONCAT44(SUB164(auVar16,0),SUB164(auVar16,0));
uVar2 = SUB164(auVar16 >> 0x40,0);
*(ulonglong *)((int)puVar8 + 4) = CONCAT44(uVar2,uVar2);
puVar8 = (undefined8 *)((int)this->bufferPointer + iVar12);
*puVar8 = CONCAT44(SUB164(auVar15,0),SUB164(auVar15,0));
uVar2 = SUB164(auVar15 >> 0x40,0);
*(ulonglong *)((int)puVar8 + 4) = CONCAT44(uVar2,uVar2);
puVar8 = (undefined8 *)((int)this->bufferPointer + iVar11);
*puVar8 = CONCAT44(SUB164(auVar17,0),SUB164(auVar17,0));
uVar2 = SUB164(auVar17 >> 0x40,0);
*(ulonglong *)((int)puVar8 + 4) = CONCAT44(uVar2,uVar2);
if ((int)uVar10 <= iVar14) break;
puVar7 = (undefined4 *)this->bufferPointer;
}
}
if (uVar6 - uVar10 != 0 && (int)uVar10 <= (int)uVar6) {
puVar7 = (undefined4 *)((int)this->bufferPointer + uVar10 * 4);
do {
uVar10 = uVar10 + 1;
coprocessor_function(10,2,1,in_cr7,in_cr7,in_cr7);
*puVar7 = *puVar7;
puVar7 = puVar7 + 1;
} while (uVar6 - uVar10 != 0);
}
}
}
return;
}
// AdaptiveBuffer_R32::PanFrames(float, float)
void AdaptiveBuffer_R32::PanFrames(float param_1,float param_2) {
uint uVar1;
undefined4 uVar2;
undefined4 uVar4;
undefined4 in_r1;
int iVar6;
undefined4 in_r2;
int iVar7;
uint uVar8;
undefined4 *puVar9;
uint uVar10;
undefined8 *puVar11;
int iVar12;
int iVar13;
undefined4 *puVar14;
bool bVar15;
undefined4 in_cr7;
undefined8 uVar16;
undefined8 uVar17;
undefined auVar18 [16];
undefined auVar19 [16];
undefined auVar20 [16];
undefined4 local_28 [4];
undefined4 uVar3;
undefined4 uVar5;
puVar9 = (undefined4 *)this->bufferPointer;
if (((puVar9 != nullptr) && (bVar15 = -1 < (int)(this->channels - 2), this->channels == 2)) &&
((bVar15 || (bVar15)))) {
uVar1 = this->bufferOffset * 2;
if ((int)uVar1 < 0x10) {
if (0 < (int)uVar1) {
uVar10 = 0;
while( true ) {
uVar10 = uVar10 + 1;
coprocessor_function(10,6,1,in_cr7,in_cr7,in_cr7);
*puVar9 = in_r1;
puVar9 = puVar9 + 1;
if (uVar1 == uVar10) break;
in_r1 = local_28[uVar10 & 3];
}
return;
}
}
else {
uVar10 = uVar1 & 0xfffffff0;
uVar16 = CONCAT44(in_r1,in_r1);
uVar17 = CONCAT44(in_r2,in_r2);
if (uVar10 != 0) {
iVar7 = 0x10;
iVar6 = 0;
while( true ) {
puVar11 = (undefined8 *)(puVar9 + iVar6);
iVar13 = iVar7 + 0x10;
iVar12 = iVar7 + 0x20;
uVar2 = *(undefined4 *)((int)puVar9 + iVar7);
uVar3 = ((undefined4 *)((int)puVar9 + iVar7))[1];
puVar14 = (undefined4 *)((int)puVar9 + iVar13);
puVar9 = (undefined4 *)((int)puVar9 + iVar12);
iVar6 = iVar6 + 0x10;
auVar20 = FloatVectorMult(CONCAT88(CONCAT44(*(undefined4 *)((int)puVar11 + 4),
*(undefined4 *)((int)puVar11 + 4)),
CONCAT44(*(undefined4 *)puVar11,*(undefined4 *)puVar11)
),CONCAT88(uVar17,uVar16),2,0x20);
auVar19 = FloatVectorMult(CONCAT88(CONCAT44(uVar3,uVar3),CONCAT44(uVar2,uVar2)),
CONCAT88(uVar17,uVar16),2,0x20);
uVar2 = *puVar9;
uVar3 = puVar9[1];
uVar4 = *puVar14;
uVar5 = puVar14[1];
auVar18 = FloatVectorMult(CONCAT88(CONCAT44(uVar5,uVar5),CONCAT44(uVar4,uVar4)),
CONCAT88(uVar17,uVar16),2,0x20);
*puVar11 = CONCAT44(SUB164(auVar20,0),SUB164(auVar20,0));
uVar4 = SUB164(auVar20 >> 0x40,0);
*(ulonglong *)((int)puVar11 + 4) = CONCAT44(uVar4,uVar4);
auVar20 = FloatVectorMult(CONCAT88(CONCAT44(uVar3,uVar3),CONCAT44(uVar2,uVar2)),
CONCAT88(uVar17,uVar16),2,0x20);
puVar11 = (undefined8 *)((int)this->bufferPointer + iVar7);
iVar7 = iVar7 + 0x40;
*puVar11 = CONCAT44(SUB164(auVar19,0),SUB164(auVar19,0));
uVar2 = SUB164(auVar19 >> 0x40,0);
*(ulonglong *)((int)puVar11 + 4) = CONCAT44(uVar2,uVar2);
puVar11 = (undefined8 *)((int)this->bufferPointer + iVar13);
*puVar11 = CONCAT44(SUB164(auVar18,0),SUB164(auVar18,0));
uVar2 = SUB164(auVar18 >> 0x40,0);
*(ulonglong *)((int)puVar11 + 4) = CONCAT44(uVar2,uVar2);
puVar11 = (undefined8 *)((int)this->bufferPointer + iVar12);
*puVar11 = CONCAT44(SUB164(auVar20,0),SUB164(auVar20,0));
uVar2 = SUB164(auVar20 >> 0x40,0);
*(ulonglong *)((int)puVar11 + 4) = CONCAT44(uVar2,uVar2);
if ((int)uVar10 <= iVar6) break;
puVar9 = (undefined4 *)this->bufferPointer;
}
}
if ((int)uVar10 < (int)uVar1) {
puVar9 = (undefined4 *)((int)this->bufferPointer + uVar10 * 4);
do {
uVar8 = uVar10 & 3;
uVar10 = uVar10 + 1;
coprocessor_function(10,6,1,in_cr7,in_cr7,in_cr7);
*puVar9 = local_28[uVar8];
puVar9 = puVar9 + 1;
} while (uVar1 != uVar10);
}
}
}
return;
}
// AdaptiveBuffer_R32::SetBufferOffset(unsigned int)
void AdaptiveBuffer_R32::SetBufferOffset(uint param_1) {
this->bufferOffset = param_1;
return;
}
// AdaptiveBuffer_R32::GetBufferPointer()
void * AdaptiveBuffer_R32::GetBufferPointer() {
return this->bufferPointer;
}
// AdaptiveBuffer_R32::GetBufferLength()
uint AdaptiveBuffer_R32::GetBufferLength() {
return this->bufferLength;
}
// AdaptiveBuffer_R32::GetBufferOffset()
undefined4 AdaptiveBuffer_R32::GetBufferOffset() {
return this->bufferOffset;
}
// AdaptiveBuffer_R32::GetChannels()
uint AdaptiveBuffer_R32::GetChannels() {
return this->channels;
}

View File

@ -0,0 +1,36 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_ADAPTIVEBUFFER_R32_H
#define VIPER_ADAPTIVEBUFFER_R32_H
#include "AdaptiveBuffer_FPI32.h"
class AdaptiveBuffer_R32 {
void * bufferPointer;
uint bufferLength;
undefined4 bufferOffset;
uint channels;
public:
AdaptiveBuffer_R32(uint param_1,uint param_2);
~AdaptiveBuffer_R32();
void Short2Float(short *param_1,float *param_2,uint param_3);
void Float2Short(float *param_1,short *param_2,uint param_3);
void FlushBuffer();
undefined4 PushZero(uint param_1);
undefined4 PushFrames(short *param_1,uint param_2);
undefined4 PopFrames(short *param_1,uint param_2);
void ScaleFrames(float param_1);
void PanFrames(float param_1,float param_2);
void SetBufferOffset(uint param_1);
void * GetBufferPointer();
uint GetBufferLength();
undefined4 GetBufferOffset();
uint GetChannels();
};
#endif //VIPER_ADAPTIVEBUFFER_R32_H

View File

@ -0,0 +1,85 @@
//
// Created by mart on 2/12/21.
//
#include "CAllpassFilter.h"
// CAllpassFilter::CAllpassFilter()
CAllpassFilter::CAllpassFilter() {
this->field_0x4 = 0;
this->field_0x8 = 0;
this->field_0xc = 0;
this->feedback = 0;
return;
}
// CAllpassFilter::SetBuffer(int*, int)
void CAllpassFilter::SetBuffer(int *param_1,int param_2) {
this->field_0x4 = param_1;
this->field_0x8 = param_2;
return;
}
// CAllpassFilter::Process(int)
int CAllpassFilter::Process(int param_1) {
longlong lVar1;
int iVar2;
int iVar3;
iVar3 = *(int *)(this->field_0x4 + this->field_0xc * 4);
lVar1 = (longlong)iVar3 * (longlong)(int)this->feedback + 0x1000000;
*(uint *)(this->field_0x4 + this->field_0xc * 4) =
param_1 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
iVar2 = this->field_0xc + 1;
this->field_0xc = iVar2;
if ((int)this->field_0x8 <= iVar2) {
this->field_0xc = 0;
}
return iVar3 - param_1;
}
// CAllpassFilter::Mute()
void CAllpassFilter::Mute() {
undefined4 *puVar1;
int iVar2;
if ((int)this->field_0x8 < 1) {
return;
}
iVar2 = 0;
puVar1 = (undefined4 *)(this->field_0x4 + -4);
do {
puVar1 = puVar1 + 1;
*puVar1 = 0;
iVar2 = iVar2 + 1;
} while (iVar2 < (int)this->field_0x8);
return;
}
// CAllpassFilter::SetFeedback(int)
void CAllpassFilter::SetFeedback(int param_1) {
this->feedback = param_1;
return;
}
// CAllpassFilter::GetFeedback()
undefined4 CAllpassFilter::GetFeedback() {
return this->feedback;
}

27
src/util/CAllpassFilter.h Normal file
View File

@ -0,0 +1,27 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_CALLPASSFILTER_H
#define VIPER_CALLPASSFILTER_H
#include "AdaptiveBuffer_FPI32.h"
class CAllpassFilter {
undefined4 feedback;
undefined4 field_0x4;
undefined4 field_0x8;
undefined4 field_0xc;
public:
CAllpassFilter();
void SetBuffer(int *param_1,int param_2);
int Process(int param_1);
void Mute();
void SetFeedback(int param_1);
undefined4 GetFeedback();
};
#endif //VIPER_CALLPASSFILTER_H

113
src/util/CCombFilter.cpp Normal file
View File

@ -0,0 +1,113 @@
//
// Created by mart on 2/12/21.
//
#include "CCombFilter.h"
// CCombFilter::CCombFilter()
CCombFilter::CCombFilter() {
this->field_0x10 = 0;
this->field_0x14 = 0;
this->field_0x18 = 0;
this->feedback = 0;
this->field_0x4 = 0;
this->damp = 0;
this->field_0xc = 0;
return;
}
// CCombFilter::SetBuffer(int*, int)
void CCombFilter::SetBuffer(int *param_1,int param_2) {
this->field_0x10 = (int)param_1;
this->field_0x14 = param_2;
return;
}
// CCombFilter::Process(int)
int CCombFilter::Process(int param_1) {
longlong lVar1;
longlong lVar2;
int iVar3;
int iVar4;
iVar4 = *(int *)(this->field_0x10 + this->field_0x18 * 4);
lVar1 = (longlong)iVar4 * (longlong)(int)this->field_0xc + 0x1000000;
lVar2 = (longlong)(int)this->field_0x4 * (longlong)(int)this->damp + 0x1000000;
iVar3 = ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
this->field_0x4 = iVar3;
lVar1 = (longlong)iVar3 * (longlong)(int)this->feedback + 0x1000000;
*(uint *)(this->field_0x10 + this->field_0x18 * 4) =
param_1 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
iVar3 = this->field_0x18 + 1;
this->field_0x18 = iVar3;
if (this->field_0x14 <= iVar3) {
this->field_0x18 = 0;
}
return iVar4;
}
// CCombFilter::Mute()
void CCombFilter::Mute() {
undefined4 *puVar1;
int iVar2;
if (this->field_0x14 < 1) {
return;
}
iVar2 = 0;
puVar1 = (undefined4 *)(this->field_0x10 + -4);
do {
puVar1 = puVar1 + 1;
*puVar1 = 0;
iVar2 = iVar2 + 1;
} while (iVar2 < this->field_0x14);
return;
}
// CCombFilter::SetDamp(int)
void CCombFilter::SetDamp(int param_1) {
this->damp = param_1;
this->field_0xc = 0x2000000 - param_1;
return;
}
// CCombFilter::GetDamp()
undefined4 CCombFilter::GetDamp() {
return this->damp;
}
// CCombFilter::SetFeedback(int)
void CCombFilter::SetFeedback(int param_1) {
this->feedback = param_1;
return;
}
// CCombFilter::GetFeedback()
undefined4 CCombFilter::GetFeedback() {
return this->feedback;
}

30
src/util/CCombFilter.h Normal file
View File

@ -0,0 +1,30 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_CCOMBFILTER_H
#define VIPER_CCOMBFILTER_H
class CCombFilter {
undefined4 feedback;
undefined4 field_0x4;
undefined4 damp;
undefined4 field_0xc;
int field_0x10;
int field_0x14;
undefined4 field_0x18;
public:
CCombFilter();
void SetBuffer(int *param_1,int param_2);
int Process(int param_1);
void Mute();
void SetDamp(int param_1);
undefined4 GetDamp();
void SetFeedback(int param_1);
undefined4 GetFeedback();
};
#endif //VIPER_CCOMBFILTER_H

617
src/util/CRevModel.cpp Normal file
View File

@ -0,0 +1,617 @@
//
// Created by mart on 2/12/21.
//
#include "CRevModel.h"
// CRevModel::~CRevModel()
CRevModel::~CRevModel() {
if (this->field_0x270 != nullptr) {
operator_delete__(this->field_0x270);
}
if (this->field_0x274 != nullptr) {
operator_delete__(this->field_0x274);
}
if (this->field_0x278 != nullptr) {
operator_delete__(this->field_0x278);
}
if (this->field_0x27c != nullptr) {
operator_delete__(this->field_0x27c);
}
if (this->field_0x280 != nullptr) {
operator_delete__(this->field_0x280);
}
if (this->field_0x284 != nullptr) {
operator_delete__(this->field_0x284);
}
if (this->field_0x288 != nullptr) {
operator_delete__(this->field_0x288);
}
if (this->field_0x28c != nullptr) {
operator_delete__(this->field_0x28c);
}
if (this->field_0x290 != nullptr) {
operator_delete__(this->field_0x290);
}
if (this->field_0x294 != nullptr) {
operator_delete__(this->field_0x294);
}
if (this->field_0x298 != nullptr) {
operator_delete__(this->field_0x298);
}
if (this->field_0x29c != nullptr) {
operator_delete__(this->field_0x29c);
}
if (this->field_0x2a0 != nullptr) {
operator_delete__(this->field_0x2a0);
}
if (this->field_0x2a4 != nullptr) {
operator_delete__(this->field_0x2a4);
}
if (this->field_0x2a8 != nullptr) {
operator_delete__(this->field_0x2a8);
}
if (this->field_0x2ac != nullptr) {
operator_delete__(this->field_0x2ac);
}
if (this->field_0x2b0 != nullptr) {
operator_delete__(this->field_0x2b0);
}
if (this->field_0x2b4 != nullptr) {
operator_delete__(this->field_0x2b4);
}
if (this->field_0x2b8 != nullptr) {
operator_delete__(this->field_0x2b8);
}
if (this->field_0x2bc != nullptr) {
operator_delete__(this->field_0x2bc);
}
if (this->field_0x2c0 != nullptr) {
operator_delete__(this->field_0x2c0);
}
if (this->field_0x2c4 != nullptr) {
operator_delete__(this->field_0x2c4);
}
if (this->field_0x2c8 != nullptr) {
operator_delete__(this->field_0x2c8);
}
if (this->field_0x2cc != nullptr) {
operator_delete__(this->field_0x2cc);
}
return this;
}
// CRevModel::ProcessReplace(int*, int*, int)
void CRevModel::ProcessReplace(int *param_1,int *param_2,int param_3) {
longlong lVar1;
longlong lVar2;
longlong lVar3;
longlong lVar4;
longlong lVar5;
longlong lVar6;
int iVar7;
CCombFilter *this_00;
CAllpassFilter *this_01;
uint uVar8;
int iVar9;
int iVar10;
CAllpassFilter *this_02;
int iVar11;
int iVar12;
int iVar13;
int *piVar14;
int *local_40;
int local_3c;
if ((this->field_0x0 != 0) && (local_3c = param_3 + -1, 0 < param_3)) {
piVar14 = param_2 + 2;
local_40 = param_1 + 2;
do {
iVar10 = piVar14[-2];
iVar11 = 0;
iVar9 = local_40[-2];
iVar13 = 0;
iVar12 = 0;
lVar1 = (longlong)(iVar9 + iVar10) * (longlong)*(int *)&this->field_0x4 + 0x1000000;
uVar8 = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
do {
iVar7 = CCombFilter::Process
((CCombFilter *)((int)&this->field_0x30[0].feedback + iVar11),uVar8);
iVar12 = iVar12 + iVar7;
this_00 = (CCombFilter *)((int)&this->field_0x110[0].feedback + iVar11);
iVar11 = iVar11 + 0x1c;
iVar7 = CCombFilter::Process(this_00,uVar8);
iVar13 = iVar13 + iVar7;
} while (iVar11 != 0xe0);
iVar11 = 4;
this_02 = this->field_0x1f0;
do {
iVar12 = CAllpassFilter::Process(this_02,iVar12);
this_01 = this_02 + 4;
this_02 = this_02 + 1;
iVar13 = CAllpassFilter::Process(this_01,iVar13);
iVar11 = iVar11 + -1;
} while (iVar11 != 0);
local_3c = local_3c + -1;
lVar1 = (longlong)iVar13 * (longlong)*(int *)&this->field_0x20 + 0x1000000;
lVar2 = (longlong)*(int *)&this->field_0x1c * (longlong)iVar13 + 0x1000000;
lVar3 = (longlong)iVar12 * (longlong)*(int *)&this->field_0x1c + 0x1000000;
lVar4 = (longlong)iVar12 * (longlong)*(int *)&this->field_0x20 + 0x1000000;
lVar5 = (longlong)iVar9 * (longlong)this->field_0x24 + 0x1000000;
lVar6 = (longlong)this->field_0x24 * (longlong)iVar10 + 0x1000000;
local_40[-2] = ((uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7) +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar5 >> 0x19 | (int)((ulonglong)lVar5 >> 0x20) << 7);
piVar14[-2] = ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7) +
((uint)lVar4 >> 0x19 | (int)((ulonglong)lVar4 >> 0x20) << 7) +
((uint)lVar6 >> 0x19 | (int)((ulonglong)lVar6 >> 0x20) << 7);
piVar14 = piVar14 + 2;
local_40 = local_40 + 2;
} while (local_3c != -1);
}
return;
}
// CRevModel::UpdateCoeffs()
void CRevModel::UpdateCoeffs() {
int iVar1;
longlong lVar2;
longlong lVar3;
uint uVar4;
CCombFilter *this_00;
uint uVar5;
int iVar6;
CCombFilter *this_01;
CCombFilter *pCVar7;
undefined8 uVar8;
undefined8 uVar9;
ulonglong uVar10;
ulonglong uVar11;
if (this->field_0x0 == 0) {
return;
}
iVar6 = this->field_0x28;
uVar4 = this->field_0x18;
uVar8 = VectorShiftRight(CONCAT44(iVar6,iVar6),0x20);
uVar8 = VectorShiftLeft(uVar8,0x19,0x40,0);
uVar9 = VectorShiftRight(CONCAT44(0x2000000 - iVar6,0x2000000 - iVar6),0x20);
uVar9 = VectorShiftLeft(uVar9,0x19,0x40,0);
iVar6 = (int)((longlong)uVar8 >> 0x3f);
iVar1 = (int)((longlong)uVar9 >> 0x3f);
uVar10 = VectorShiftRight(CONCAT44(iVar6,iVar6),0x20);
uVar11 = VectorShiftRight(CONCAT44(iVar1,iVar1),0x20);
uVar8 = VectorAdd(uVar10 & 0x3ffffff,uVar8,8);
uVar9 = VectorAdd(uVar11 & 0x3ffffff,uVar9,8);
uVar8 = VectorShiftRight(uVar8,0x1a);
uVar10 = VectorShiftRight(uVar9,0x1a);
lVar2 = (longlong)(int)uVar4 * (longlong)((int)uVar8 + 0x1000000) + 0x1000000;
lVar3 = (uVar10 & 0xffffffff) * (ulonglong)uVar4;
uVar5 = (uint)lVar3;
*(uint *)&this->field_0x1c = (uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7;
*(uint *)&this->field_0x20 =
uVar5 + 0x1000000 >> 0x19 |
((int)uVar10 * ((int)uVar4 >> 0x1f) + uVar4 * (int)(uVar10 >> 0x20) +
(int)((ulonglong)lVar3 >> 0x20) + (uint)(0xfeffffff < uVar5)) * 0x80;
if (this->field_0x2c < 0x1000000) {
uVar4 = this->field_0x8;
*(undefined **)&this->field_0x4 = &DAT_0007ae14;
*(uint *)&this->field_0xc = uVar4;
*(uint *)&this->field_0x14 = this->field_0x10;
}
else {
uVar4 = 0x2000000;
*(undefined4 *)&this->field_0xc = 0x2000000;
*(undefined4 *)&this->field_0x14 = 0;
*(undefined4 *)&this->field_0x4 = 0;
}
this_01 = this->field_0x30;
pCVar7 = this_01;
while( true ) {
CCombFilter::SetFeedback(pCVar7,uVar4);
this_00 = pCVar7 + 8;
pCVar7 = pCVar7 + 1;
CCombFilter::SetFeedback(this_00,*(int *)&this->field_0xc);
if (pCVar7 == this->field_0x110) break;
uVar4 = *(uint *)&this->field_0xc;
}
do {
CCombFilter::SetDamp(this_01,*(int *)&this->field_0x14);
pCVar7 = this_01 + 8;
this_01 = this_01 + 1;
CCombFilter::SetDamp(pCVar7,*(int *)&this->field_0x14);
} while (this_01 != this->field_0x110);
return;
}
// CRevModel::SetRoomSize(int)
void CRevModel::SetRoomSize(int param_1) {
longlong lVar1;
if (this->field_0x0 == 0) {
return;
}
lVar1 = (longlong)param_1 * 0x8f5c2a + 0x1000000;
this->field_0x8 = ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) + 0x1666666;
UpdateCoeffs(this);
return;
}
// CRevModel::GetRoomSize()
void CRevModel::GetRoomSize(void) {
int in_r0;
uint uVar1;
uVar1 = *(int *)(in_r0 + 8) + 0xfe99999a;
__aeabi_ldivmod(uVar1 * 0x2000000,((int)uVar1 >> 0x1f) << 0x19 | uVar1 >> 7,0x8f5c2a,0);
return;
}
// CRevModel::SetDamp(int)
void CRevModel::SetDamp(int param_1) {
longlong lVar1;
if (this->field_0x0 == 0) {
return;
}
lVar1 = (longlong)param_1 * 0xccccce + 0x1000000;
this->field_0x10 = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
UpdateCoeffs(this);
return;
}
// CRevModel::GetDamp()
void CRevModel::GetDamp(void) {
int in_r0;
uint uVar1;
uVar1 = *(uint *)(in_r0 + 0x10);
__aeabi_ldivmod(uVar1 << 0x19,((int)uVar1 >> 0x1f) << 0x19 | uVar1 >> 7,0xccccce,0);
return;
}
// CRevModel::SetWet(int)
void CRevModel::SetWet(int param_1) {
longlong lVar1;
if (this->field_0x0 == 0) {
return;
}
lVar1 = (longlong)param_1 * 0x6000000 + 0x1000000;
this->field_0x18 = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
UpdateCoeffs(this);
return;
}
// CRevModel::GetWet()
void CRevModel::GetWet(void) {
int in_r0;
uint uVar1;
uVar1 = *(uint *)(in_r0 + 0x18);
__aeabi_ldivmod(uVar1 << 0x19,((int)uVar1 >> 0x1f) << 0x19 | uVar1 >> 7,0x6000000,0);
return;
}
// CRevModel::SetDry(int)
void CRevModel::SetDry(int param_1) {
if (this->field_0x0 == 0) {
return;
}
this->field_0x24 = param_1 << 1;
return;
}
// CRevModel::GetDry()
undefined8 CRevModel::GetDry() {
int iVar1;
undefined8 uVar2;
ulonglong uVar3;
uVar2 = VectorShiftRight(CONCAT44(this->field_0x24,this->field_0x24),0x20);
uVar2 = VectorShiftLeft(uVar2,0x19,0x40,0);
iVar1 = (int)((longlong)uVar2 >> 0x3f);
uVar3 = VectorShiftRight(CONCAT44(iVar1,iVar1),0x20);
uVar2 = VectorAdd(uVar3 & 0x3ffffff,uVar2,8);
uVar2 = VectorShiftRight(uVar2,0x1a);
return uVar2;
}
// CRevModel::SetWidth(int)
void CRevModel::SetWidth(int param_1) {
if (this->field_0x0 == 0) {
return;
}
this->field_0x28 = param_1;
UpdateCoeffs(this);
return;
}
// CRevModel::GetWidth()
int CRevModel::GetWidth() {
return this->field_0x28;
}
// CRevModel::SetMode(int)
void CRevModel::SetMode(int param_1) {
if (this->field_0x0 == 0) {
return;
}
this->field_0x2c = param_1;
UpdateCoeffs(this);
return;
}
// CRevModel::GetMode()
undefined4 CRevModel::GetMode() {
undefined4 uVar1;
if (this->field_0x2c < 0x1000000) {
uVar1 = 0;
}
else {
uVar1 = 0x2000000;
}
return uVar1;
}
// CRevModel::Mute()
void CRevModel::Mute() {
int iVar1;
CCombFilter *this_00;
CAllpassFilter *this_01;
CAllpassFilter *this_02;
if (this->field_0x0 == 0) {
return;
}
iVar1 = GetMode(this);
if (0xffffff < iVar1) {
return;
}
iVar1 = 0;
do {
CCombFilter::Mute((CCombFilter *)((int)&this->field_0x30[0].feedback + iVar1));
this_00 = (CCombFilter *)((int)&this->field_0x110[0].feedback + iVar1);
iVar1 = iVar1 + 0x1c;
CCombFilter::Mute(this_00);
} while (iVar1 != 0xe0);
this_02 = this->field_0x1f0;
iVar1 = 4;
do {
CAllpassFilter::Mute(this_02);
this_01 = this_02 + 4;
this_02 = this_02 + 1;
CAllpassFilter::Mute(this_01);
iVar1 = iVar1 + -1;
} while (iVar1 != 0);
return;
}
void CRevModel::~ZN9CRevModel5ResetEv() {
int iVar1;
CCombFilter *this_00;
CAllpassFilter *this_01;
CAllpassFilter *this_02;
if (this->field_0x0 == 0) {
return;
}
iVar1 = GetMode(this);
if (0xffffff < iVar1) {
return;
}
iVar1 = 0;
do {
CCombFilter::Mute((CCombFilter *)((int)&this->field_0x30[0].feedback + iVar1));
this_00 = (CCombFilter *)((int)&this->field_0x110[0].feedback + iVar1);
iVar1 = iVar1 + 0x1c;
CCombFilter::Mute(this_00);
} while (iVar1 != 0xe0);
this_02 = this->field_0x1f0;
iVar1 = 4;
do {
CAllpassFilter::Mute(this_02);
this_01 = this_02 + 4;
this_02 = this_02 + 1;
CAllpassFilter::Mute(this_01);
iVar1 = iVar1 + -1;
} while (iVar1 != 0);
return;
}
// CRevModel::CRevModel()
CRevModel::CRevModel() {
void *pvVar1;
CCombFilter *pCVar2;
CCombFilter *pCVar3;
CAllpassFilter *pCVar4;
CAllpassFilter *pCVar5;
CAllpassFilter *pCVar6;
CCombFilter *this_00;
CAllpassFilter *this_01;
this_00 = this->field_0x110;
pCVar3 = this->field_0x30;
do {
pCVar2 = pCVar3 + 1;
CCombFilter::CCombFilter(pCVar3);
pCVar3 = pCVar2;
} while (pCVar2 != this_00);
pCVar6 = this->field_0x1f0;
pCVar3 = this_00;
do {
pCVar2 = pCVar3 + 1;
CCombFilter::CCombFilter(pCVar3);
pCVar3 = pCVar2;
} while (pCVar2 != (CCombFilter *)pCVar6);
this_01 = this->field_0x1f0 + 4;
pCVar5 = pCVar6;
do {
pCVar4 = pCVar5 + 1;
CAllpassFilter::CAllpassFilter(pCVar5);
pCVar5 = pCVar4;
} while (pCVar4 != this_01);
pCVar5 = this_01;
do {
pCVar4 = pCVar5 + 1;
CAllpassFilter::CAllpassFilter(pCVar5);
pCVar5 = pCVar4;
} while (pCVar4 != (CAllpassFilter *)&this->field_0x270);
this->field_0x0 = 0;
pvVar1 = operator_new__(0x1170);
this->field_0x270 = pvVar1;
pvVar1 = operator_new__(0x11cc);
this->field_0x274 = pvVar1;
pvVar1 = operator_new__(0x1290);
this->field_0x278 = pvVar1;
pvVar1 = operator_new__(0x12ec);
this->field_0x27c = pvVar1;
pvVar1 = operator_new__(0x13f4);
this->field_0x280 = pvVar1;
pvVar1 = operator_new__(0x1450);
this->field_0x284 = pvVar1;
pvVar1 = operator_new__(0x1530);
this->field_0x288 = pvVar1;
pvVar1 = operator_new__(0x158c);
this->field_0x28c = pvVar1;
pvVar1 = operator_new__(0x1638);
this->field_0x290 = pvVar1;
pvVar1 = operator_new__(0x1694);
this->field_0x294 = pvVar1;
pvVar1 = operator_new__(0x174c);
this->field_0x298 = pvVar1;
pvVar1 = operator_new__(0x17a8);
this->field_0x29c = pvVar1;
pvVar1 = operator_new__(0x1854);
this->field_0x2a0 = pvVar1;
pvVar1 = operator_new__(0x18b0);
this->field_0x2a4 = pvVar1;
pvVar1 = operator_new__(0x1944);
this->field_0x2a8 = pvVar1;
pvVar1 = operator_new__(0x19a0);
this->field_0x2ac = pvVar1;
pvVar1 = operator_new__(0x8b0);
this->field_0x2b0 = pvVar1;
pvVar1 = operator_new__(0x90c);
this->field_0x2b4 = pvVar1;
pvVar1 = operator_new__(0x6e4);
this->field_0x2b8 = pvVar1;
pvVar1 = operator_new__(0x740);
this->field_0x2bc = pvVar1;
pvVar1 = operator_new__(0x554);
this->field_0x2c0 = pvVar1;
pvVar1 = operator_new__(0x5b0);
this->field_0x2c4 = pvVar1;
pvVar1 = operator_new__(900);
this->field_0x2c8 = pvVar1;
pvVar1 = operator_new__(0x3e0);
this->field_0x2cc = pvVar1;
if (((((((int *)this->field_0x270 != nullptr) && (this->field_0x274 != nullptr)) &&
(this->field_0x278 != nullptr)) &&
(((this->field_0x27c != nullptr && (this->field_0x280 != nullptr)) &&
((this->field_0x284 != nullptr && ((this->field_0x288 != nullptr && (this->field_0x28c != nullptr))))
)))) && (((this->field_0x290 != nullptr &&
((((((this->field_0x294 != nullptr && (this->field_0x298 != nullptr)) &&
(this->field_0x29c != nullptr)) &&
((this->field_0x2a0 != nullptr && (this->field_0x2a4 != nullptr)))) &&
((this->field_0x2a8 != nullptr &&
((this->field_0x2ac != nullptr && (this->field_0x2b0 != nullptr)))))) &&
(this->field_0x2b4 != nullptr)))) &&
(((this->field_0x2b8 != nullptr && (this->field_0x2bc != nullptr)) &&
(this->field_0x2c0 != nullptr)))))) &&
(((this->field_0x2c4 != nullptr && (this->field_0x2c8 != nullptr)) && (pvVar1 != nullptr)))) {
this->field_0x0 = 1;
CCombFilter::SetBuffer(this->field_0x30,(int *)this->field_0x270,0x45c);
CCombFilter::SetBuffer(this_00,(int *)this->field_0x274,0x473);
CCombFilter::SetBuffer(this->field_0x30 + 1,(int *)this->field_0x278,0x4a4);
CCombFilter::SetBuffer(this->field_0x110 + 1,(int *)this->field_0x27c,0x4bb);
CCombFilter::SetBuffer(this->field_0x30 + 2,(int *)this->field_0x280,0x4fd);
CCombFilter::SetBuffer(this->field_0x110 + 2,(int *)this->field_0x284,0x514);
CCombFilter::SetBuffer(this->field_0x30 + 3,(int *)this->field_0x288,0x54c);
CCombFilter::SetBuffer(this->field_0x110 + 3,(int *)this->field_0x28c,0x563);
CCombFilter::SetBuffer(this->field_0x30 + 4,(int *)this->field_0x290,0x58e);
CCombFilter::SetBuffer(this->field_0x110 + 4,(int *)this->field_0x294,0x5a5);
CCombFilter::SetBuffer(this->field_0x30 + 5,(int *)this->field_0x298,0x5d3);
CCombFilter::SetBuffer(this->field_0x110 + 5,(int *)this->field_0x29c,0x5ea);
CCombFilter::SetBuffer(this->field_0x30 + 6,(int *)this->field_0x2a0,0x615);
CCombFilter::SetBuffer(this->field_0x110 + 6,(int *)this->field_0x2a4,0x62c);
CCombFilter::SetBuffer(this->field_0x30 + 7,(int *)this->field_0x2a8,0x651);
CCombFilter::SetBuffer(this->field_0x110 + 7,(int *)this->field_0x2ac,0x668);
CAllpassFilter::SetBuffer(pCVar6,(int *)this->field_0x2b0,0x22c);
CAllpassFilter::SetBuffer(this_01,(int *)this->field_0x2b4,0x243);
CAllpassFilter::SetBuffer(this->field_0x1f0 + 1,(int *)this->field_0x2b8,0x1b9);
CAllpassFilter::SetBuffer(this->field_0x1f0 + 5,(int *)this->field_0x2bc,0x1d0);
CAllpassFilter::SetBuffer(this->field_0x1f0 + 2,(int *)this->field_0x2c0,0x155);
CAllpassFilter::SetBuffer(this->field_0x1f0 + 6,(int *)this->field_0x2c4,0x16c);
CAllpassFilter::SetBuffer(this->field_0x1f0 + 3,(int *)this->field_0x2c8,0xe1);
CAllpassFilter::SetBuffer(this->field_0x1f0 + 7,(int *)this->field_0x2cc,0xf8);
CAllpassFilter::SetFeedback(pCVar6,0x1000000);
CAllpassFilter::SetFeedback(this_01,0x1000000);
CAllpassFilter::SetFeedback(this->field_0x1f0 + 1,0x1000000);
CAllpassFilter::SetFeedback(this->field_0x1f0 + 5,0x1000000);
CAllpassFilter::SetFeedback(this->field_0x1f0 + 2,0x1000000);
CAllpassFilter::SetFeedback(this->field_0x1f0 + 6,0x1000000);
CAllpassFilter::SetFeedback(this->field_0x1f0 + 3,0x1000000);
CAllpassFilter::SetFeedback(this->field_0x1f0 + 7,0x1000000);
SetWet(this,0x558106);
SetRoomSize(this,0x1000000);
SetDry(this,0x800000);
SetDamp(this,0x1000000);
SetWidth(this,0x2000000);
SetMode(this,0);
_ZN9CRevModel5ResetEv(this);
}
return this;
}

87
src/util/CRevModel.h Normal file
View File

@ -0,0 +1,87 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_CREVMODEL_H
#define VIPER_CREVMODEL_H
class CRevModel {
int field_0x0;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
uint field_0x8;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
uint field_0x10;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
uint field_0x18;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
undefined field_0x20;
undefined field_0x21;
undefined field_0x22;
undefined field_0x23;
int field_0x24;
int field_0x28;
int field_0x2c;
struct CCombFilter field_0x30[8];
struct CCombFilter field_0x110[8];
struct CAllpassFilter field_0x1f0[8];
void * field_0x270;
void * field_0x274;
void * field_0x278;
void * field_0x27c;
void * field_0x280;
void * field_0x284;
void * field_0x288;
void * field_0x28c;
void * field_0x290;
void * field_0x294;
void * field_0x298;
void * field_0x29c;
void * field_0x2a0;
void * field_0x2a4;
void * field_0x2a8;
void * field_0x2ac;
void * field_0x2b0;
void * field_0x2b4;
void * field_0x2b8;
void * field_0x2bc;
void * field_0x2c0;
void * field_0x2c4;
void * field_0x2c8;
void * field_0x2cc;
public:
~CRevModel();
void ProcessReplace(int *param_1,int *param_2,int param_3);
void UpdateCoeffs();
void SetRoomSize(int param_1);
void GetRoomSize();
void SetDamp(int param_1);
void GetDamp();
void SetWet(int param_1);
void GetWet();
void SetDry(int param_1);
undefined8 GetDry();
void SetWidth(int param_1);
int GetWidth();
void SetMode(int param_1);
undefined4 GetMode();
void Mute();
void ~ZN9CRevModel5ResetEv();
CRevModel();
};
#endif //VIPER_CREVMODEL_H

239
src/util/Crossfeed.cpp Normal file
View File

@ -0,0 +1,239 @@
//
// Created by mart on 2/13/21.
//
#include "Crossfeed.h"
// Crossfeed::~Crossfeed()
Crossfeed::~Crossfeed() {
return;
}
// Crossfeed::FilterSample(int*)
void Crossfeed::FilterSample(int *param_1) {
longlong lVar1;
longlong lVar2;
longlong lVar3;
longlong lVar4;
longlong lVar5;
int iVar6;
int iVar7;
lVar1 = (longlong)this->field_0x4 * (longlong)this->field_0x20 + 0x1000000;
lVar2 = (longlong)this->field_0x0 * (longlong)*param_1 + 0x1000000;
lVar3 = (longlong)this->field_0x4 * (longlong)*(int *)&this->field_0x24 + 0x1000000;
this->field_0x20 =
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7) +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)this->field_0xc * (longlong)this->field_0x18 + 0x1000000;
lVar2 = (longlong)this->field_0x0 * (longlong)param_1[1] + 0x1000000;
lVar4 = (longlong)this->field_0xc * (longlong)*(int *)&this->field_0x1c + 0x1000000;
iVar6 = ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7) +
((uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7);
*(int *)&this->field_0x24 = iVar6;
lVar2 = (longlong)this->field_0x10 * (longlong)this->field_0x28 + 0x1000000;
lVar3 = (longlong)this->field_0x8 * (longlong)*param_1 + 0x1000000;
lVar5 = (longlong)this->field_0x10 * (longlong)(int)this->field_0x2c + 0x1000000;
iVar7 = ((uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7) +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
this->field_0x28 = iVar7;
iVar6 = iVar6 + iVar7;
lVar1 = (longlong)this->field_0x8 * (longlong)param_1[1] + 0x1000000;
this->field_0x2c =
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar4 >> 0x19 | (int)((ulonglong)lVar4 >> 0x20) << 7) +
((uint)lVar5 >> 0x19 | (int)((ulonglong)lVar5 >> 0x20) << 7);
this->field_0x18 = *param_1;
*(int *)&this->field_0x1c = param_1[1];
*param_1 = iVar6;
iVar7 = this->field_0x2c + this->field_0x20;
param_1[1] = iVar7;
lVar1 = (longlong)iVar6 * (longlong)this->field_0x14 + 0x1000000;
*param_1 = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
lVar1 = (longlong)iVar7 * (longlong)this->field_0x14 + 0x1000000;
param_1[1] = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
return;
}
// Crossfeed::Reset()
void Crossfeed::Reset() {
undefined4 uVar1;
undefined4 uVar2;
undefined4 uVar3;
undefined4 extraout_r1;
undefined4 extraout_r1_00;
undefined4 extraout_r1_01;
undefined4 extraout_r1_02;
undefined4 extraout_r1_03;
undefined4 extraout_r1_04;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr2;
undefined4 in_cr3;
undefined4 in_cr4;
undefined4 in_cr11;
undefined4 in_cr13;
double dVar4;
double dVar5;
double dVar6;
double __x;
dVar5 = (double)(longlong)(int)(*(uint *)&this->cutoff & 0xffff);
uVar2 = 0;
coprocessor_function(0xb,6,1,in_cr0,in_cr13,in_cr0);
__x = -3.833333333333333;
uVar1 = uVar2;
pow(-3.833333333333333,dVar5);
pow(__x,dVar5);
dVar4 = 1.0 - (double)CONCAT44(extraout_r1_00,uVar2);
uVar2 = SUB84(dVar4,0);
log10(__x);
uVar3 = 0;
dVar6 = __x - (double)CONCAT44(extraout_r1_01,uVar2) * 20.0;
pow(__x,dVar5);
coprocessor_function(0xb,6,5,in_cr1,in_cr0,in_cr2);
uVar2 = SUB84(dVar6 / (double)(longlong)this->samplerate,0);
exp(__x);
coprocessor_function(0xb,2,4,in_cr11,in_cr3,in_cr11);
coprocessor_function(0xb,6,5,in_cr0,in_cr1,in_cr4);
coprocessor_function(0xb,2,1,in_cr11,in_cr11,in_cr3);
this->field_0x4 = SUB84(ROUND((double)CONCAT44(extraout_r1_03,uVar2) * 33554432.0 + 0.5),0);
this->field_0x0 = SUB84(ROUND((double)CONCAT44(extraout_r1_03,uVar2) * 33554432.0 + 0.5),0);
uVar2 = SUB84((double)CONCAT44(extraout_r1_02,uVar3) / (double)(longlong)this->samplerate,0);
exp(__x);
dVar5 = (double)CONCAT44(extraout_r1_04,uVar2);
this->field_0x10 = SUB84(ROUND(dVar5 * 33554432.0 + 0.5),0);
this->field_0xc = SUB84(ROUND(0.5 - dVar5 * 33554432.0),0);
this->field_0x8 = SUB84(ROUND((1.0 - (1.0 - dVar5) * dVar4) * 33554432.0 + 0.5),0);
this->field_0x14 =
SUB84(ROUND((1.0 / ((1.0 - dVar4) + (double)CONCAT44(extraout_r1,uVar1))) * 33554432.0 + 0.5)(0);
memset(&this->field_0x18,0,0x18);
return;
}
// Crossfeed::Crossfeed()
Crossfeed::Crossfeed() {
memset(this,0,0x30);
this->samplerate = 0xac44;
*(undefined4 *)&this->cutoff = 0x2d02bc;
Reset(this);
return this;
}
// Crossfeed::SetSamplingRate(int)
void Crossfeed::SetSamplingRate(int param_1) {
if (this->samplerate == param_1) {
return;
}
this->samplerate = param_1;
Reset(this);
return;
}
// Crossfeed::SetPreset(unsigned int)
void Crossfeed::SetPreset(uint param_1) {
*(uint *)&this->cutoff = param_1;
Reset(this);
return;
}
// Crossfeed::SetCutoff(int)
void Crossfeed::SetCutoff(int param_1) {
SetPreset(this,param_1 | (uint)(ushort)this->feedback << 0x10);
return;
}
// Crossfeed::SetFeedback(float)
void Crossfeed::SetFeedback(float param_1) {
undefined4 in_cr7;
coprocessor_function(10,6,1,in_cr7,in_cr7,in_cr7);
SetPreset(this,(uint)(ushort)this->cutoff);
return;
}
// Crossfeed::GetCutoff()
short Crossfeed::GetCutoff() {
return this->cutoff;
}
// Crossfeed::GetFeedback()
float Crossfeed::GetFeedback() {
return (float)(longlong)(int)(uint)(ushort)this->feedback / 10.0;
}
// Crossfeed::GetLevelDelay()
float Crossfeed::GetLevelDelay() {
int iVar1;
undefined4 in_cr7;
float fVar2;
iVar1 = GetCutoff(this);
if (iVar1 - 300U < 0x6a5) {
fVar2 = 18700.0 / (float)(longlong)iVar1;
coprocessor_function(10,6,4,in_cr7,in_cr7,in_cr7);
}
else {
fVar2 = 0.0;
}
return fVar2;
}
// Crossfeed::GetPreset()
undefined4 Crossfeed::GetPreset() {
return *(undefined4 *)&this->cutoff;
}
// Crossfeed::ProcessFrames(int*, int)
void Crossfeed::ProcessFrames(int *param_1,int param_2) {
int iVar1;
if (param_2 < 1) {
return;
}
iVar1 = param_2 + -1;
do {
iVar1 = iVar1 + -1;
FilterSample(this,param_1);
param_1 = param_1 + 2;
} while (iVar1 != -1);
return;
}

49
src/util/Crossfeed.h Normal file
View File

@ -0,0 +1,49 @@
//
// Created by mart on 2/13/21.
//
#ifndef VIPER_CROSSFEED_H
#define VIPER_CROSSFEED_H
class Crossfeed {
int field_0x0;
int field_0x4;
int field_0x8;
int field_0xc;
int field_0x10;
int field_0x14;
int field_0x18;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
int field_0x20;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
int field_0x28;
uint field_0x2c;
short cutoff;
short feedback; // Created by retype action
int samplerate;
public:
~Crossfeed();
void FilterSample(int *param_1);
void Reset();
Crossfeed();
void SetSamplingRate(int param_1);
void SetPreset(uint param_1);
void SetCutoff(int param_1);
void SetFeedback(float param_1);
short GetCutoff();
float GetFeedback();
float GetLevelDelay();
undefined4 GetPreset();
void ProcessFrames(int *param_1,int param_2);
};
#endif //VIPER_CROSSFEED_H

1090
src/util/FFT_R24_F32.cpp Normal file

File diff suppressed because it is too large Load Diff

32
src/util/FFT_R24_F32.h Normal file
View File

@ -0,0 +1,32 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_FFT_R24_F32_H
#define VIPER_FFT_R24_F32_H
class FFT_R24_F32 {
void* field_0x0;
void* field_0x4;
int field_0x8;
public:
void makect(int param_1,int *param_2,float *param_3);
void bitrv2(int param_1,int *param_2,float *param_3);
void makewt(int param_1,int *param_2,float *param_3);
cft1st(int param_1,float *param_2,float *param_3);
cftmdl(int param_1,int param_2,float *param_3,float *param_4);
void cftfsub(int param_1,float *param_2,float *param_3);
void cftbsub(int param_1,float *param_2,float *param_3);
void rftfsub(int param_1,float *param_2,int param_3,float *param_4);
void rftbsub(int param_1,float *param_2,int param_3,float *param_4);
void rdft(int param_1,int param_2,float *param_3,int *param_4,float *param_5);
FFT_R24_F32(int param_1);
~FFT_R24_F32();
void RDFT(float *param_1);
void IRDFT(float *param_1);
};
#endif //VIPER_FFT_R24_F32_H

240
src/util/FIR.cpp Normal file
View File

@ -0,0 +1,240 @@
//
// Created by mart on 2/12/21.
//
#include "FIR.h"
// FIR::FIR()
FIR::FIR() {
this->field_0x0 = nullptr;
this->field_0x20 = nullptr;
this->field_0x40 = nullptr;
this->field_0x44 = 0;
this->blockLength = 0;
this->field_0x4c = '\0';
return;
}
// FIR::~FIR()
FIR::~FIR() {
if (this->field_0x0 != nullptr) {
free(this->field_0x0);
}
if (this->field_0x20 != nullptr) {
free(this->field_0x20);
}
if (this->field_0x40 != nullptr) {
free(this->field_0x40);
}
return this;
}
// FIR::GetBlockLength()
int FIR::GetBlockLength() {
return this->blockLength;
}
// FIR::Reset()
void FIR::Reset() {
undefined4 *puVar1;
int iVar2;
if ((this->field_0x0 != nullptr) && (-1 < this->field_0x44 + this->blockLength)) {
iVar2 = 0;
puVar1 = (undefined4 *)((int)this->field_0x0 + -4);
do {
puVar1 = puVar1 + 1;
*puVar1 = 0;
iVar2 = iVar2 + 1;
} while (iVar2 <= this->field_0x44 + this->blockLength);
}
return;
}
// FIR::LoadCoefficients(int const*, int, int)
undefined4 FIR::LoadCoefficients(int *param_1,int param_2,int param_3) {
void *pvVar1;
void *pvVar2;
int iVar3;
int iVar4;
bool bVar5;
bool bVar6;
bVar5 = param_3 < 0;
bVar6 = param_3 == 0;
if (0 < param_3) {
bVar5 = param_2 < 0;
bVar6 = param_2 == 0;
}
iVar3 = param_3;
if (!bVar6 && !bVar5) {
iVar3 = 0;
}
if ((!bVar6 && !bVar5) && (param_1 != nullptr)) {
this->field_0x4c = (char)iVar3;
if (this->field_0x0 != nullptr) {
free(this->field_0x0);
}
if (this->field_0x20 != nullptr) {
free(this->field_0x20);
}
if (this->field_0x40 != nullptr) {
free(this->field_0x40);
}
this->field_0x0 = nullptr;
this->field_0x20 = nullptr;
this->field_0x40 = nullptr;
pvVar1 = valloc((param_2 + param_3 + 1) * 4);
this->field_0x0 = pvVar1;
pvVar1 = valloc(param_2 << 2);
this->field_0x20 = pvVar1;
pvVar1 = valloc(param_3 << 2);
this->field_0x40 = pvVar1;
if (((this->field_0x0 != nullptr) && (pvVar2 = this->field_0x20, pvVar2 != nullptr)) &&
(pvVar1 != nullptr)) {
iVar3 = 0;
iVar4 = 0;
this->field_0x44 = param_2;
this->blockLength = param_3;
do {
iVar4 = iVar4 + 1;
*(undefined4 *)((int)pvVar2 + iVar3) = *(undefined4 *)((int)param_1 + iVar3);
iVar3 = iVar3 + 4;
} while (iVar4 < param_2);
Reset(this);
if (((this->field_0x0 != nullptr) && (this->field_0x20 != nullptr)) && (this->field_0x40 != nullptr)) {
this->field_0x4c = '\x01';
return 1;
}
}
}
return 0;
}
// FIR::FilterSamplesInterleaved(int*, int, int)
void FIR::FilterSamplesInterleaved(int *param_1,int param_2,int param_3) {
undefined4 *puVar1;
longlong lVar2;
int iVar3;
int iVar4;
int *piVar5;
int iVar6;
undefined4 *puVar7;
undefined4 *puVar8;
int *piVar9;
int *piVar10;
void *pvVar12;
undefined4 *puVar13;
void *pvVar14;
int *piVar15;
int *piVar16;
int iVar17;
int iVar18;
int iVar19;
int *piVar11;
if (this->field_0x4c != '\0') {
iVar3 = this->field_0x44;
iVar6 = this->blockLength;
iVar4 = iVar6;
if (0 < param_2) {
puVar7 = (undefined4 *)this->field_0x40;
iVar4 = 0;
puVar13 = puVar7;
do {
puVar1 = (undefined4 *)((int)param_1 + iVar4);
iVar4 = iVar4 + param_3 * 4;
puVar8 = puVar13 + 1;
*puVar13 = *puVar1;
puVar13 = puVar8;
} while (puVar8 != puVar7 + param_2);
iVar4 = this->blockLength;
}
if (param_2 < iVar4) {
puVar13 = (undefined4 *)((int)this->field_0x40 + (param_2 + 0x3fffffff) * 4);
iVar4 = param_2;
do {
puVar13 = puVar13 + 1;
*puVar13 = 0;
iVar4 = iVar4 + 1;
} while (iVar4 < this->blockLength);
}
if (0 < iVar6) {
piVar9 = (int *)this->field_0x40;
piVar16 = (int *)this->field_0x0;
piVar15 = piVar16 + iVar3 + 0x3fffffff;
piVar10 = piVar9;
do {
piVar11 = piVar10 + 1;
piVar5 = piVar15 + 1;
*piVar15 = *piVar10;
piVar15 = piVar5;
piVar10 = piVar11;
} while (piVar11 != piVar9 + iVar6);
iVar18 = 0;
iVar4 = 0;
do {
if (iVar3 < 1) {
iVar19 = 0;
}
else {
iVar19 = 0;
piVar15 = (int *)((int)this->field_0x20 + -4);
piVar5 = piVar16 + iVar3 + 0x40000000;
do {
piVar15 = piVar15 + 1;
piVar5 = piVar5 + -1;
lVar2 = (longlong)*piVar15 * (longlong)*piVar5 + 0x1000000;
iVar19 = iVar19 + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
} while (piVar16 != piVar5);
}
if (iVar4 < param_2) {
piVar5 = param_1;
}
iVar17 = iVar4 + 1;
piVar16 = piVar16 + 1;
if (iVar4 < param_2) {
*(int *)((int)piVar5 + iVar18) = iVar19;
}
iVar18 = iVar18 + param_3 * 4;
iVar4 = iVar17;
} while (iVar17 != iVar6);
}
if (1 < iVar3) {
pvVar12 = this->field_0x40;
puVar13 = (undefined4 *)((int)pvVar12 + iVar6 * 4);
pvVar14 = (void *)((int)this->field_0x0 + iVar3 * 4);
do {
puVar13 = puVar13 + -1;
*(undefined4 *)((int)pvVar14 + -8) = *puVar13;
pvVar14 = (void *)((int)pvVar14 + -4);
} while (puVar13 != (undefined4 *)((int)pvVar12 + iVar3 * -4 + iVar6 * 4 + 4));
}
}
return;
}
// FIR::FilterSamples(int*, int)
void FIR::FilterSamples(int *param_1,int param_2) {
FilterSamplesInterleaved(this,param_1,param_2,1);
return;
}

83
src/util/FIR.h Normal file
View File

@ -0,0 +1,83 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_FIR_H
#define VIPER_FIR_H
class FIR {
void * field_0x0;
undefined field_0x4;
undefined field_0x5;
undefined field_0x6;
undefined field_0x7;
undefined field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined field_0x18;
undefined field_0x19;
undefined field_0x1a;
undefined field_0x1b;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
void * field_0x20;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
undefined field_0x28;
undefined field_0x29;
undefined field_0x2a;
undefined field_0x2b;
undefined field_0x2c;
undefined field_0x2d;
undefined field_0x2e;
undefined field_0x2f;
undefined field_0x30;
undefined field_0x31;
undefined field_0x32;
undefined field_0x33;
undefined field_0x34;
undefined field_0x35;
undefined field_0x36;
undefined field_0x37;
undefined field_0x38;
undefined field_0x39;
undefined field_0x3a;
undefined field_0x3b;
undefined field_0x3c;
undefined field_0x3d;
undefined field_0x3e;
undefined field_0x3f;
void * field_0x40;
int field_0x44;
int blockLength;
char field_0x4c;
public:
FIR();
~FIR();
int GetBlockLength();
void Reset();
undefined4 LoadCoefficients(int *param_1,int param_2,int param_3);
void FilterSamplesInterleaved(int *param_1,int param_2,int param_3);
void FilterSamples(int *param_1,int param_2);
};
#endif //VIPER_FIR_H

223
src/util/FixedBiquad.cpp Normal file
View File

@ -0,0 +1,223 @@
//
// Created by mart on 2/12/21.
//
#include "FixedBiquad.h"
// FixedBiquad::SetCoeffs(float, float, float, float, float, float)
void FixedBiquad::SetCoeffs(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6
) {
this->field_0x4 = 0;
this->field_0x0 = 0;
this->field_0xc = 0;
this->field_0x8 = 0;
this->field_0x1c = -SUB84(ROUND((double)((float)param_2 / (float)param_1) * 33554432.0 + 0.5),0);
this->field_0x20 = -SUB84(ROUND((double)((float)param_3 / (float)param_1) * 33554432.0 + 0.5),0);
this->field_0x10 = SUB84(ROUND((double)((float)param_4 / (float)param_1) * 33554432.0 + 0.5),0);
this->field_0x18 = SUB84(ROUND((double)((float)param_6 / (float)param_1) * 33554432.0 + 0.5),0);
this->field_0x14 = SUB84(ROUND((double)((float)param_5 / (float)param_1) * 33554432.0 + 0.5),0);
return;
}
// FixedBiquad::Reset()
void FixedBiquad::Reset() {
this->field_0x1c = 0;
this->field_0x20 = 0;
this->field_0x10 = 0;
this->field_0x14 = 0;
this->field_0x18 = 0;
this->field_0x0 = 0;
this->field_0x4 = 0;
this->field_0x8 = 0;
this->field_0xc = 0;
return;
}
// FixedBiquad::FixedBiquad()
FixedBiquad::FixedBiquad() {
Reset(this);
SetCoeffs(this,0x3f800000,0,0,0x3f800000,0,0);
return this;
}
// FixedBiquad::SetHighPassParameter(float, float, float, float, float)
void FixedBiquad::SetHighPassParameter(float param_1,float param_2,float param_3,float param_4,float param_5) {
float fVar1;
float fVar2;
int iVar3;
float fVar4;
float in_r2;
undefined in_ZR;
undefined4 in_cr7;
undefined4 in_cr8;
undefined4 in_cr9;
undefined4 in_cr10;
undefined4 in_cr11;
undefined4 in_cr12;
undefined4 in_cr13;
float fVar5;
float __x;
float extraout_s1;
float __y;
float extraout_s1_00;
float extraout_s1_01;
float extraout_s1_02;
float extraout_s1_03;
float fVar6;
float fVar7;
float fVar8;
float fVar9;
float fVar10;
float unaff_s24;
fVar1 = 10.0;
coprocessor_function(10,6,1,in_cr10,in_cr7,in_cr10);
fVar10 = 6.283185 / in_r2;
fVar5 = powf(param_1,param_2);
fVar2 = fVar10;
fVar5 = sinf(fVar5);
if (!(bool)in_ZR) {
fVar5 = sqrtf(fVar5);
}
fVar6 = SQRT(fVar1);
coprocessor_function(10,2,0,in_cr9,in_cr9,in_cr7);
fVar7 = fVar1 - 1.0;
fVar8 = fVar1 + 1.0;
coprocessor_function(10,2,1,in_cr9,in_cr9,in_cr7);
__x = cosf(fVar5);
coprocessor_function(10,2,4,in_cr12,in_cr9,in_cr11);
__y = extraout_s1;
fVar5 = fVar6;
if (!(bool)in_ZR) {
fVar5 = fVar1;
__x = sqrtf(__x);
__y = extraout_s1_03;
}
coprocessor_function(10,2,0,in_cr11,in_cr10,in_cr11);
coprocessor_function(10,6,5,in_cr12,in_cr8,in_cr12);
coprocessor_function(10,6,5,in_cr12,in_cr12,in_cr7);
coprocessor_function(10,2,1,in_cr13,in_cr13,in_cr8);
if (!(bool)in_ZR) {
__x = sqrtf(__x);
__y = extraout_s1_02;
}
fVar9 = fVar8 - unaff_s24;
coprocessor_function(10,2,1,in_cr12,in_cr12,in_cr8);
fVar4 = fVar6;
if (!(bool)in_ZR) {
fVar4 = fVar1;
__x = sqrtf(__x);
__y = extraout_s1_01;
}
if (!(bool)in_ZR) {
__x = sqrtf(__x);
__y = extraout_s1_00;
fVar6 = fVar1;
}
iVar3 = 0x41200000;
powf(__x,__y);
fVar7 = fVar7 - fVar10;
coprocessor_function(10,2,1,in_cr13,in_cr13,in_cr7);
coprocessor_function(10,6,5,in_cr12,in_cr12,in_cr7);
coprocessor_function(10,6,1,in_cr7,in_cr12,in_cr7);
SetCoeffs(this,(int)(fVar9 + (fVar4 + fVar4) * fVar2),(int)(fVar7 + fVar7),
(int)(fVar9 - (fVar6 + fVar6) * fVar2),
(int)(fVar8 + unaff_s24 + (fVar5 + fVar5) * fVar2),-0x40000000,iVar3);
return;
}
// FixedBiquad::SetBandPassParameter(float, float, float)
void FixedBiquad::SetBandPassParameter(int param_1,int samplerate,int param_3) {
float fVar1;
undefined4 in_cr6;
undefined4 in_cr7;
undefined4 in_cr8;
undefined4 in_cr9;
float in_s0;
float __x;
float fVar2;
float phaseStep;
coprocessor_function(10,2,0,in_cr9,in_cr7,in_cr9);
phaseStep = 6.283185 / (float)samplerate;
fVar1 = phaseStep;
__x = sinf(in_s0);
fVar2 = fVar1 / ((float)param_3 + (float)param_3);
cosf(__x);
coprocessor_function(10,6,1,in_cr6,in_cr7,in_cr6);
coprocessor_function(10,2,1,in_cr7,in_cr8,in_cr7);
SetCoeffs(this,(int)(fVar2 + 1.0),-0x40000000,(int)(1.0 - fVar2),(int)phaseStep,0,
(int)(0.0 - fVar1 * 0.5));
return;
}
// FixedBiquad::SetLowPassParameter(float, float, float)
void FixedBiquad::SetLowPassParameter(float param_1,float param_2,float param_3) {
float in_r2;
float in_r3;
undefined4 in_cr5;
undefined4 in_cr6;
undefined4 in_cr7;
undefined4 in_cr8;
float __x;
float fVar1;
float fVar2;
coprocessor_function(10,6,1,in_cr8,in_cr7,in_cr8);
fVar2 = 6.283185 / in_r2;
fVar1 = fVar2;
__x = sinf(param_1);
fVar1 = fVar1 / (in_r3 + in_r3);
cosf(__x);
coprocessor_function(10,2,0,in_cr7,in_cr6,in_cr7);
coprocessor_function(10,6,5,in_cr5,in_cr6,in_cr5);
SetCoeffs(this,(int)(fVar1 + 1.0),-0x40000000,(int)(1.0 - fVar1),0x3f000000,(int)(1.0 - fVar2),
0x3f000000);
return;
}
// FixedBiquad::ProcessSample(int)
uint FixedBiquad::ProcessSample(int param_1) {
longlong lVar1;
uint uVar2;
int iVar3;
int iVar4;
int iVar5;
iVar3 = this->field_0x0;
iVar5 = this->field_0x4;
iVar4 = this->field_0xc;
this->field_0x4 = iVar3;
this->field_0x0 = param_1;
this->field_0xc = this->field_0x8;
lVar1 = (longlong)this->field_0x20 * (longlong)iVar4 +
(longlong)this->field_0x1c * (longlong)(int)this->field_0x8 +
(longlong)this->field_0x18 * (longlong)iVar5 +
(longlong)this->field_0x10 * (longlong)param_1 +
(longlong)this->field_0x14 * (longlong)iVar3;
uVar2 = (uint)lVar1;
uVar2 = uVar2 + 0x1000000 >> 0x19 |
((int)((ulonglong)lVar1 >> 0x20) + (uint)(0xfeffffff < uVar2)) * 0x80;
this->field_0x8 = uVar2;
return uVar2;
}

31
src/util/FixedBiquad.h Normal file
View File

@ -0,0 +1,31 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_FIXEDBIQUAD_H
#define VIPER_FIXEDBIQUAD_H
class FixedBiquad {
undefined4 field_0x0;
undefined4 field_0x4;
undefined4 field_0x8;
undefined4 field_0xc;
int field_0x10;
int field_0x14;
int field_0x18;
int field_0x1c;
int field_0x20;
public:
void SetCoeffs(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6);
void Reset();
FixedBiquad();
void SetHighPassParameter(float param_1,float param_2,float param_3,float param_4,float param_5);
void SetBandPassParameter(int param_1,int samplerate,int param_3);
void SetLowPassParameter(float param_1,float param_2,float param_3);
uint ProcessSample(int param_1);
};
#endif //VIPER_FIXEDBIQUAD_H

228
src/util/Harmonic.cpp Normal file
View File

@ -0,0 +1,228 @@
//
// Created by mart on 2/12/21.
//
#include "Harmonic.h"
// Harmonic::~Harmonic()
Harmonic::~Harmonic() {
return;
}
// Harmonic::UpdateCoeffs(float const*)
void Harmonic::UpdateCoeffs(float *param_1) {
float *pfVar1;
float *pfVar2;
int iVar3;
int iVar4;
float *pfVar5;
float *pfVar6;
char in_NG;
undefined in_ZR;
char in_OV;
undefined4 in_cr7;
float coeff;
float fVar7;
float local_9c [20];
float afStack76 [14];
float *coeffptr;
fVar7 = 0.0;
iVar3 = 10;
local_9c[0] = 0.0;
local_9c[1] = 0.0;
local_9c[2] = 0.0;
local_9c[3] = 0.0;
local_9c[4] = 0.0;
local_9c[5] = 0.0;
local_9c[6] = 0.0;
local_9c[7] = 0.0;
local_9c[8] = 0.0;
local_9c[9] = 0.0;
local_9c[10] = 0.0;
coeffptr = param_1;
do {
coeff = *coeffptr;
coeffptr = coeffptr + 1;
if (!(bool)in_ZR && in_NG == in_OV) {
fVar7 = ABS(coeff);
}
in_OV = SBORROW4(iVar3,1);
iVar3 = iVar3 + -1;
in_NG = iVar3 < 0;
in_ZR = iVar3 == 0;
} while (!(bool)in_ZR);
coprocessor_function(10,6,4,in_cr7,in_cr7,in_cr7);
this->field_0x34 = ROUND(fVar7);
coeffptr = local_9c + 1;
do {
pfVar1 = coeffptr + 1;
*coeffptr = *param_1;
param_1 = param_1 + 1;
coeffptr = pfVar1;
} while (pfVar1 != local_9c + 0xb);
coeffptr = local_9c;
do {
coprocessor_function(10,6,4,in_cr7,in_cr7,in_cr7);
*coeffptr = *coeffptr;
coeffptr = coeffptr + 1;
} while (coeffptr != local_9c + 0xb);
pfVar1 = afStack76 + 2;
do {
pfVar6 = pfVar1 + 1;
*pfVar1 = 0.0;
*coeffptr = 0.0;
pfVar1 = pfVar6;
coeffptr = coeffptr + 1;
} while (pfVar6 != afStack76 + 0xd);
coeffptr = local_9c + 10;
pfVar1 = local_9c + 0xe;
pfVar2 = afStack76 + 5;
iVar4 = 2;
local_9c[11] = local_9c[10];
fVar7 = local_9c[11];
pfVar6 = pfVar1;
pfVar5 = pfVar2;
iVar3 = iVar4;
do {
do {
local_9c[11] = fVar7;
coeff = pfVar1[-2];
iVar4 = iVar4 + -1;
fVar7 = pfVar2[-1];
pfVar2 = pfVar2 + -1;
*pfVar2 = pfVar1[-1];
pfVar1 = pfVar1 + -1;
*pfVar1 = (coeff + coeff) - fVar7;
fVar7 = local_9c[11];
} while (0 < iVar4);
iVar4 = iVar3 + 1;
coeffptr = coeffptr + -1;
pfVar1 = pfVar6 + 1;
pfVar2 = pfVar5 + 1;
fVar7 = *coeffptr - afStack76[2];
afStack76[2] = local_9c[11];
pfVar6 = pfVar1;
pfVar5 = pfVar2;
iVar3 = iVar4;
} while (iVar4 != 0xb);
coeffptr = afStack76 + 0xd;
pfVar1 = afStack76 + 2;
do {
pfVar6 = pfVar1 + -2;
coeffptr = coeffptr + -1;
pfVar1 = pfVar1 + -1;
*pfVar1 = *pfVar6 - *coeffptr;
} while (coeffptr != afStack76 + 3);
coeffptr = local_9c + 0xc;
iVar3 = 0;
local_9c[11] = local_9c[0] * 0.5 - local_9c[11];
while( true ) {
*(float *)((int)this->field_0x0 + iVar3) = ROUND(local_9c[11] * 3.355443e+07 + 0.5);
iVar3 = iVar3 + 4;
if (iVar3 == 0x2c) break;
local_9c[11] = *coeffptr;
coeffptr = coeffptr + 1;
}
return;
}
// Harmonic::Reset()
void Harmonic::Reset() {
this->field_0x2c = 0;
this->field_0x30 = 0;
this->field_0x38 = 0;
return;
}
// Harmonic::Harmonic()
Harmonic::Harmonic() {
UpdateCoeffs(this,FLOAT_ARRAY_000ce820);
Reset(this);
return this;
}
// Harmonic::SetHarmonics(float const*)
void Harmonic::SetHarmonics(float *param_1) {
UpdateCoeffs(this,param_1);
Reset(this);
return;
}
// Harmonic::Process(int)
int Harmonic::Process(int param_1) {
longlong lVar1;
longlong lVar2;
int iVar3;
int iVar4;
int iVar5;
lVar1 = (longlong)(int)this->field_0x0[10] * (longlong)param_1 + 0x1000000;
lVar1 = (longlong)param_1 *
(longlong)
(int)((int)this->field_0x0[9] +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)) + 0x1000000;
lVar1 = (longlong)param_1 *
(longlong)
(int)((int)this->field_0x0[8] +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)) + 0x1000000;
lVar2 = (longlong)(int)this->field_0x30 * 0x1ff7cee + 0x1000000;
iVar3 = this->field_0x2c;
lVar1 = (longlong)param_1 *
(longlong)
(int)((int)this->field_0x0[7] +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)) + 0x1000000;
iVar5 = this->field_0x38;
lVar1 = (longlong)param_1 *
(longlong)
(int)((int)this->field_0x0[6] +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)) + 0x1000000;
if (iVar5 < (int)this->field_0x34) {
this->field_0x38 = iVar5 + 1;
}
lVar1 = (longlong)param_1 *
(longlong)
(int)((int)this->field_0x0[5] +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)) + 0x1000000;
lVar1 = (longlong)param_1 *
(longlong)
(int)((int)this->field_0x0[4] +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)) + 0x1000000;
lVar1 = (longlong)param_1 *
(longlong)
(int)((int)this->field_0x0[3] +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)) + 0x1000000;
lVar1 = (longlong)param_1 *
(longlong)
(int)((int)this->field_0x0[2] +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)) + 0x1000000;
lVar1 = (longlong)param_1 *
(longlong)
(int)((int)this->field_0x0[1] +
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)) + 0x1000000;
iVar4 = (int)this->field_0x0[0] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
this->field_0x2c = iVar4;
iVar3 = (iVar4 + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7)) - iVar3;
this->field_0x30 = iVar3;
if (iVar5 < (int)this->field_0x34) {
iVar3 = 0;
}
return iVar3;
}

26
src/util/Harmonic.h Normal file
View File

@ -0,0 +1,26 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_HARMONIC_H
#define VIPER_HARMONIC_H
class Harmonic {
float field_0x0[11];
undefined4 field_0x2c;
undefined4 field_0x30;
float field_0x34;
undefined4 field_0x38;
public:
~Harmonic();
void UpdateCoeffs(float *param_1);
void Reset();
Harmonic();
void SetHarmonics(float *param_1);
int Process(int param_1);
};
#endif //VIPER_HARMONIC_H

391
src/util/HiFi.cpp Normal file
View File

@ -0,0 +1,391 @@
//
// Created by mart on 2/13/21.
//
#include "HiFi.h"
// HiFi::~HiFi()
HiFi::~HiFi() {
IIR_NOrder_BW_LH *pIVar1;
IIR_NOrder_BW_BP *pIVar2;
WaveBuffer_I32 *pWVar3;
pIVar1 = *(IIR_NOrder_BW_LH **)(this + 8);
if (pIVar1 != nullptr) {
IIR_NOrder_BW_LH::~IIR_NOrder_BW_LH(pIVar1);
operator_delete(pIVar1);
}
pIVar1 = *(IIR_NOrder_BW_LH **)(this + 0xc);
if (pIVar1 != nullptr) {
IIR_NOrder_BW_LH::~IIR_NOrder_BW_LH(pIVar1);
operator_delete(pIVar1);
}
pIVar2 = *(IIR_NOrder_BW_BP **)(this + 0x10);
if (pIVar2 != nullptr) {
IIR_NOrder_BW_BP::~IIR_NOrder_BW_BP(pIVar2);
operator_delete(pIVar2);
}
pIVar1 = *(IIR_NOrder_BW_LH **)(this + 0x14);
if (pIVar1 != nullptr) {
IIR_NOrder_BW_LH::~IIR_NOrder_BW_LH(pIVar1);
operator_delete(pIVar1);
}
pIVar1 = *(IIR_NOrder_BW_LH **)(this + 0x18);
if (pIVar1 != nullptr) {
IIR_NOrder_BW_LH::~IIR_NOrder_BW_LH(pIVar1);
operator_delete(pIVar1);
}
pIVar2 = *(IIR_NOrder_BW_BP **)(this + 0x1c);
if (pIVar2 != nullptr) {
IIR_NOrder_BW_BP::~IIR_NOrder_BW_BP(pIVar2);
operator_delete(pIVar2);
}
pWVar3 = *(WaveBuffer_I32 **)this;
if (pWVar3 != nullptr) {
WaveBuffer_I32::~WaveBuffer_I32(pWVar3);
operator_delete(pWVar3);
}
pWVar3 = *(WaveBuffer_I32 **)(this + 4);
if (pWVar3 != nullptr) {
WaveBuffer_I32::~WaveBuffer_I32(pWVar3);
operator_delete(pWVar3);
}
return this;
}
// HiFi::Reset()
void HiFi::Reset(void) {
WaveBuffer_I32 **in_r0;
undefined4 in_cr0;
undefined4 in_cr1;
float in_s0;
float in_s1;
undefined8 uVar1;
float in_s2;
float extraout_s2;
float extraout_s2_00;
float extraout_s2_01;
float extraout_s2_02;
float extraout_s2_03;
WaveBuffer_I32 *pWVar2;
uVar1 = CONCAT44(in_s1,in_s0);
if ((IIR_NOrder_BW_LH *)in_r0[2] != nullptr) {
IIR_NOrder_BW_LH::setLPF((IIR_NOrder_BW_LH *)in_r0[2],in_s0,in_s1);
uVar1 = IIR_NOrder_BW_LH::Mute((IIR_NOrder_BW_LH *)in_r0[2]);
in_s2 = extraout_s2;
}
if ((IIR_NOrder_BW_LH *)in_r0[3] != nullptr) {
IIR_NOrder_BW_LH::setHPF
((IIR_NOrder_BW_LH *)in_r0[3],(float)uVar1,(float)((ulonglong)uVar1 >> 0x20));
uVar1 = IIR_NOrder_BW_LH::Mute((IIR_NOrder_BW_LH *)in_r0[3]);
in_s2 = extraout_s2_00;
}
if (in_r0[4] != nullptr) {
IIR_NOrder_BW_BP::setBPF((float)uVar1,(float)((ulonglong)uVar1 >> 0x20),in_s2);
uVar1 = IIR_NOrder_BW_BP::Mute((IIR_NOrder_BW_BP *)in_r0[4]);
in_s2 = extraout_s2_01;
}
if ((IIR_NOrder_BW_LH *)in_r0[5] != nullptr) {
IIR_NOrder_BW_LH::setLPF
((IIR_NOrder_BW_LH *)in_r0[5],(float)uVar1,(float)((ulonglong)uVar1 >> 0x20));
uVar1 = IIR_NOrder_BW_LH::Mute((IIR_NOrder_BW_LH *)in_r0[5]);
in_s2 = extraout_s2_02;
}
if ((IIR_NOrder_BW_LH *)in_r0[6] != nullptr) {
IIR_NOrder_BW_LH::setHPF
((IIR_NOrder_BW_LH *)in_r0[6],(float)uVar1,(float)((ulonglong)uVar1 >> 0x20));
uVar1 = IIR_NOrder_BW_LH::Mute((IIR_NOrder_BW_LH *)in_r0[6]);
in_s2 = extraout_s2_03;
}
if (in_r0[7] != nullptr) {
IIR_NOrder_BW_BP::setBPF((float)uVar1,(float)((ulonglong)uVar1 >> 0x20),in_s2);
IIR_NOrder_BW_BP::Mute((IIR_NOrder_BW_BP *)in_r0[7]);
}
if (*in_r0 != nullptr) {
pWVar2 = in_r0[9];
coprocessor_function(0xb,6,5,in_cr0,in_cr0,in_cr1);
WaveBuffer_I32::Reset(*in_r0);
WaveBuffer_I32::PushZeros(*in_r0,SUB84(ROUND((double)(longlong)(int)pWVar2 / 1000000000.0),0));
}
if (in_r0[1] != nullptr) {
pWVar2 = in_r0[9];
coprocessor_function(0xb,6,5,in_cr0,in_cr0,in_cr1);
WaveBuffer_I32::Reset(in_r0[1]);
WaveBuffer_I32::PushZeros(in_r0[1],SUB84(ROUND((double)(longlong)(int)pWVar2 / 1000000000.0),0))
;
return;
}
return;
}
// HiFi::HiFi()
HiFi::HiFi() {
WaveBuffer_I32 *pWVar1;
IIR_NOrder_BW_LH *pIVar2;
IIR_NOrder_BW_BP *pIVar3;
*(undefined4 *)(this + 0x20) = 0x2000000;
*(undefined4 *)(this + 0x24) = 0xac44;
pWVar1 = (WaveBuffer_I32 *)operator_new(0x20);
WaveBuffer_I32::WaveBuffer_I32(pWVar1,2,0x800);
*(WaveBuffer_I32 **)this = pWVar1;
pWVar1 = (WaveBuffer_I32 *)operator_new(0x20);
WaveBuffer_I32::WaveBuffer_I32(pWVar1,2,0x800);
*(WaveBuffer_I32 **)(this + 4) = pWVar1;
pIVar2 = (IIR_NOrder_BW_LH *)operator_new(8);
IIR_NOrder_BW_LH::IIR_NOrder_BW_LH(pIVar2,1);
*(IIR_NOrder_BW_LH **)(this + 8) = pIVar2;
pIVar2 = (IIR_NOrder_BW_LH *)operator_new(8);
IIR_NOrder_BW_LH::IIR_NOrder_BW_LH(pIVar2,3);
*(IIR_NOrder_BW_LH **)(this + 0xc) = pIVar2;
pIVar3 = (IIR_NOrder_BW_BP *)operator_new(0xc);
IIR_NOrder_BW_BP::IIR_NOrder_BW_BP(pIVar3,3);
*(IIR_NOrder_BW_BP **)(this + 0x10) = pIVar3;
pIVar2 = (IIR_NOrder_BW_LH *)operator_new(8);
IIR_NOrder_BW_LH::IIR_NOrder_BW_LH(pIVar2,1);
*(IIR_NOrder_BW_LH **)(this + 0x14) = pIVar2;
pIVar2 = (IIR_NOrder_BW_LH *)operator_new(8);
IIR_NOrder_BW_LH::IIR_NOrder_BW_LH(pIVar2,3);
*(IIR_NOrder_BW_LH **)(this + 0x18) = pIVar2;
pIVar3 = (IIR_NOrder_BW_BP *)operator_new(0xc);
IIR_NOrder_BW_BP::IIR_NOrder_BW_BP(pIVar3,3);
*(IIR_NOrder_BW_BP **)(this + 0x1c) = pIVar3;
Reset();
return this;
}
// HiFi::SetSamplingRate(int)
void HiFi::SetSamplingRate(int param_1) {
*(int *)(this + 0x24) = param_1;
Reset();
return;
}
// HiFi::SetClarity(float)
void HiFi::SetClarity(float param_1) {
float in_r1;
*(float *)(this + 0x20) = ROUND(in_r1 * 3.355443e+07 + 0.5);
return;
}
// HiFi::Process(int*, int)
int HiFi::Process(int *param_1,int param_2) {
longlong lVar1;
longlong lVar2;
longlong lVar3;
int iVar4;
int iVar5;
int **ppiVar6;
int *piVar7;
int **ppiVar8;
int *piVar9;
int **ppiVar10;
int *piVar11;
int *piVar12;
int *piVar13;
int *piVar14;
int **ppiVar15;
int *piVar16;
int iVar17;
int **ppiVar18;
int *piVar19;
int **ppiVar20;
int *piVar21;
int *piVar22;
int *piVar23;
int *piVar24;
int iVar25;
int *piVar26;
int iVar27;
int *local_78;
if (0 < param_2) {
iVar4 = WaveBuffer_I32::PushZerosGetBuffer(*(WaveBuffer_I32 **)this,param_2);
iVar5 = WaveBuffer_I32::PushZerosGetBuffer(*(WaveBuffer_I32 **)(this + 4),param_2);
if (iVar4 == 0 || iVar5 == 0) {
Reset();
return param_2;
}
ppiVar20 = *(int ***)(this + 0x10);
ppiVar15 = *(int ***)(this + 8);
ppiVar18 = *(int ***)(this + 0xc);
ppiVar6 = *(int ***)(this + 0x14);
piVar14 = *ppiVar18;
piVar12 = *ppiVar15;
ppiVar8 = *(int ***)(this + 0x18);
ppiVar10 = *(int ***)(this + 0x1c);
piVar16 = *ppiVar20;
piVar19 = ppiVar20[1];
piVar7 = *ppiVar6;
piVar9 = *ppiVar8;
piVar11 = *ppiVar10;
piVar13 = ppiVar10[1];
piVar21 = param_1 + 1;
piVar22 = (int *)(iVar5 + 4);
local_78 = (int *)(iVar4 + 4);
do {
iVar4 = piVar21[-1];
iVar5 = iVar4;
if ((piVar12 != nullptr) && (piVar26 = ppiVar15[1], 0 < (int)piVar26)) {
piVar24 = piVar12;
do {
piVar23 = piVar24 + 4;
lVar1 = (longlong)iVar5 * (longlong)piVar24[1] + 0x1000000;
lVar2 = (longlong)iVar5 * (longlong)piVar24[2] + 0x1000000;
iVar5 = piVar24[3] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar5 * (longlong)*piVar24 + 0x1000000;
piVar24[3] = ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
piVar24 = piVar23;
} while (piVar23 != piVar12 + (int)piVar26 * 4);
iVar4 = piVar21[-1];
}
iVar27 = iVar4;
if ((piVar14 != nullptr) && (piVar26 = ppiVar18[1], 0 < (int)piVar26)) {
piVar24 = piVar14;
do {
piVar23 = piVar24 + 4;
lVar1 = (longlong)iVar27 * (longlong)piVar24[1] + 0x1000000;
lVar2 = (longlong)iVar27 * (longlong)piVar24[2] + 0x1000000;
iVar27 = piVar24[3] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar27 * (longlong)*piVar24 + 0x1000000;
piVar24[3] = ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
piVar24 = piVar23;
} while (piVar23 != piVar14 + (int)piVar26 * 4);
iVar4 = piVar21[-1];
}
if ((piVar16 != nullptr) && (piVar26 = ppiVar20[2], 0 < (int)piVar26)) {
piVar24 = piVar16;
do {
piVar23 = piVar24 + 4;
lVar1 = (longlong)iVar4 * (longlong)piVar24[1] + 0x1000000;
lVar2 = (longlong)iVar4 * (longlong)piVar24[2] + 0x1000000;
iVar4 = piVar24[3] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar4 * (longlong)*piVar24 + 0x1000000;
piVar24[3] = ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
piVar24 = piVar23;
} while (piVar23 != piVar16 + (int)piVar26 * 4);
}
if ((piVar19 != nullptr) && (piVar26 = ppiVar20[2], 0 < (int)piVar26)) {
piVar24 = piVar19;
do {
piVar23 = piVar24 + 4;
lVar1 = (longlong)iVar4 * (longlong)piVar24[1] + 0x1000000;
lVar2 = (longlong)iVar4 * (longlong)piVar24[2] + 0x1000000;
iVar4 = piVar24[3] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar4 * (longlong)*piVar24 + 0x1000000;
piVar24[3] = ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
piVar24 = piVar23;
} while (piVar23 != piVar19 + (int)piVar26 * 4);
}
piVar21[-1] = iVar27;
piVar22[-1] = iVar5;
local_78[-1] = iVar4;
iVar4 = *piVar21;
iVar5 = iVar4;
if ((piVar7 != nullptr) && (piVar26 = ppiVar6[1], 0 < (int)piVar26)) {
piVar24 = piVar7;
do {
piVar23 = piVar24 + 4;
lVar1 = (longlong)iVar5 * (longlong)piVar24[1] + 0x1000000;
lVar2 = (longlong)iVar5 * (longlong)piVar24[2] + 0x1000000;
iVar5 = piVar24[3] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar5 * (longlong)*piVar24 + 0x1000000;
piVar24[3] = ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
piVar24 = piVar23;
} while (piVar23 != piVar7 + (int)piVar26 * 4);
iVar4 = *piVar21;
}
iVar27 = iVar4;
if ((piVar9 != nullptr) && (piVar26 = ppiVar8[1], 0 < (int)piVar26)) {
piVar24 = piVar9;
do {
piVar23 = piVar24 + 4;
lVar1 = (longlong)iVar27 * (longlong)piVar24[1] + 0x1000000;
lVar2 = (longlong)iVar27 * (longlong)piVar24[2] + 0x1000000;
iVar27 = piVar24[3] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar27 * (longlong)*piVar24 + 0x1000000;
piVar24[3] = ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
piVar24 = piVar23;
} while (piVar23 != piVar9 + (int)piVar26 * 4);
iVar4 = *piVar21;
}
if ((piVar11 != nullptr) && (piVar26 = ppiVar10[2], 0 < (int)piVar26)) {
piVar24 = piVar11;
do {
piVar23 = piVar24 + 4;
lVar1 = (longlong)iVar4 * (longlong)piVar24[1] + 0x1000000;
lVar2 = (longlong)iVar4 * (longlong)piVar24[2] + 0x1000000;
iVar4 = piVar24[3] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar4 * (longlong)*piVar24 + 0x1000000;
piVar24[3] = ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
piVar24 = piVar23;
} while (piVar23 != piVar11 + (int)piVar26 * 4);
}
if ((piVar13 != nullptr) && (piVar26 = ppiVar10[2], 0 < (int)piVar26)) {
piVar24 = piVar13;
do {
piVar23 = piVar24 + 4;
lVar1 = (longlong)iVar4 * (longlong)piVar24[1] + 0x1000000;
lVar2 = (longlong)iVar4 * (longlong)piVar24[2] + 0x1000000;
iVar4 = piVar24[3] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar4 * (longlong)*piVar24 + 0x1000000;
piVar24[3] = ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
piVar24 = piVar23;
} while (piVar23 != piVar13 + (int)piVar26 * 4);
}
piVar26 = piVar21 + 2;
*piVar21 = iVar27;
*piVar22 = iVar5;
*local_78 = iVar4;
piVar21 = piVar26;
piVar22 = piVar22 + 2;
local_78 = local_78 + 2;
} while (piVar26 != param_1 + param_2 * 2 + 1);
iVar17 = *(int *)(this + 0x20);
lVar1 = (longlong)iVar17 * 0x2666666 + 0x1000000;
iVar4 = WaveBuffer_I32::GetCurrentBufferI32Ptr(*(WaveBuffer_I32 **)this);
iVar5 = WaveBuffer_I32::GetCurrentBufferI32Ptr(*(WaveBuffer_I32 **)(this + 4));
iVar27 = 0;
iVar25 = 0;
do {
iVar25 = iVar25 + 1;
lVar2 = (longlong)*(int *)((int)param_1 + iVar27) *
(longlong)(int)((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
0x1000000;
lVar3 = (longlong)iVar17 * (longlong)*(int *)(iVar4 + iVar27) + 0x1000000;
*(uint *)((int)param_1 + iVar27) =
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7) +
((uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7) + *(int *)(iVar5 + iVar27);
iVar27 = iVar27 + 4;
} while (iVar25 < param_2 * 2);
WaveBuffer_I32::PopSamples(*(WaveBuffer_I32 **)this,param_2,false);
WaveBuffer_I32::PopSamples(*(WaveBuffer_I32 **)(this + 4),param_2,false);
}
return param_2;
}

31
src/util/HiFi.h Normal file
View File

@ -0,0 +1,31 @@
//
// Created by mart on 2/13/21.
//
#ifndef VIPER_HIFI_H
#define VIPER_HIFI_H
class HiFi {
struct WaveBuffer_I32* field_0x0;
struct WaveBuffer_I32* field_0x4;
struct IIR_NOrder_BW_LH* field_0x8;
struct IIR_NOrder_BW_LH* field_0xc;
struct IIR_NOrder_BW_BP* field_0x10;
struct IIR_NOrder_BW_LH* field_0x14;
struct IIR_NOrder_BW_LH* field_0x18;
struct IIR_NOrder_BW_BP* field_0x1c;
int field_0x20;
int field_0x24;
public:
~HiFi();
void Reset();
HiFi();
void SetSamplingRate(int param_1);
void SetClarity(float param_1);
int Process(int *param_1,int param_2);
};
#endif //VIPER_HIFI_H

151
src/util/HighShelf.cpp Normal file
View File

@ -0,0 +1,151 @@
//
// Created by mart on 2/13/21.
//
#include "HighShelf.h"
// HighShelf::SetSamplingRate(int)
void HighShelf::SetSamplingRate(int param_1) {
undefined4 uVar1;
undefined4 uVar2;
undefined4 extraout_r1;
undefined4 extraout_r1_00;
undefined4 extraout_r1_01;
undefined in_ZR;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr2;
undefined4 in_cr4;
undefined4 in_cr8;
undefined4 in_cr11;
undefined4 in_cr12;
undefined4 in_cr13;
undefined4 in_cr14;
undefined4 uVar3;
int iVar5;
double unaff_d8;
double dVar6;
double dVar7;
double dVar8;
double dVar9;
double dVar4;
coprocessor_function(0xb,2,1,in_cr8,in_cr8,in_cr1);
uVar1 = SUB84((double)*(float *)this / (double)(longlong)param_1,0);
uVar2 = uVar1;
cos(unaff_d8);
sin(unaff_d8);
dVar6 = (double)CONCAT44(extraout_r1_00,uVar1);
coprocessor_function(0xb,6,5,in_cr1,in_cr1,in_cr2);
uVar1 = SUB84((double)*(float *)(this + 8) / 40.0,0);
dVar4 = exp(unaff_d8);
uVar3 = SUB84(dVar4,0);
dVar4 = (double)CONCAT44(extraout_r1_01,uVar1);
dVar9 = dVar4 + dVar4;
if (!(bool)in_ZR) {
dVar7 = sqrt(unaff_d8);
uVar3 = SUB84(dVar7,0);
}
coprocessor_function(0xb,6,0,in_cr1,in_cr12,in_cr13);
coprocessor_function(0xb,2,0,in_cr13,in_cr13,in_cr14);
coprocessor_function(0xb,2,4,in_cr11,in_cr0,in_cr11);
coprocessor_function(0xb,6,1,in_cr2,in_cr8,in_cr2);
dVar8 = (dVar4 + 1.0) - dVar9;
dVar7 = (dVar4 - 1.0) - (double)CONCAT44(extraout_r1,uVar2);
coprocessor_function(0xb,6,5,in_cr2,in_cr2,in_cr4);
coprocessor_function(0xb,6,4,in_cr1,in_cr1,in_cr8);
coprocessor_function(0xb,2,4,in_cr8,in_cr0,in_cr8);
*(int *)(this + 0x38) = SUB84(ROUND(dVar4 * 33554432.0 + 0.5),0);
*(undefined4 *)(this + 0x20) = 0xf8000000;
*(int *)(this + 0x1c) = SUB84(ROUND((dVar4 + 1.0 + dVar9 + dVar6) * 33554432.0 + 0.5),0);
iVar5 = SUB84(ROUND((dVar6 + dVar8) * 33554432.0 + 0.5),0);
*(int *)(this + 0x24) = SUB84(ROUND(dVar4 * 33554432.0 + 0.5),0);
*(int *)(this + 0x28) = iVar5;
uVar2 = __aeabi_ldivmod(uVar3,0,0x40000,iVar5,iVar5 >> 0x1f);
*(undefined4 *)(this + 0x2c) = uVar2;
*(undefined4 *)(this + 0xc) = 0;
*(undefined4 *)(this + 0x10) = 0;
*(undefined4 *)(this + 0x14) = 0;
*(undefined4 *)(this + 0x18) = 0;
*(int *)(this + 0x30) = SUB84(ROUND((dVar7 + dVar7) * 33554432.0 + 0.5),0);
*(int *)(this + 0x34) = SUB84(ROUND((dVar8 - dVar6) * 33554432.0 + 0.5),0);
return;
}
// HighShelf::SetFrequency(float)
void HighShelf::SetFrequency(float param_1) {
undefined4 in_r1;
*(undefined4 *)this = in_r1;
return;
}
// HighShelf::SetQuality(float)
void HighShelf::SetQuality(float param_1) {
undefined4 in_r1;
*(undefined4 *)(this + 4) = in_r1;
return;
}
// HighShelf::SetGain(float)
void HighShelf::SetGain(float param_1) {
int in_r0;
undefined4 unaff_r4;
undefined4 in_lr;
undefined4 in_cr0;
undefined4 in_cr1;
log10((double)CONCAT44(in_lr,unaff_r4));
coprocessor_function(0xb,6,5,in_cr0,in_cr1,in_cr0);
*(undefined4 *)(in_r0 + 8) = 0x41a00000;
return;
}
// HighShelf::Process(int)
uint HighShelf::Process(int param_1) {
longlong lVar1;
longlong lVar2;
longlong lVar3;
longlong lVar4;
longlong lVar5;
uint uVar6;
int iVar7;
int iVar8;
int iVar9;
iVar8 = *(int *)(this + 0xc);
lVar1 = (longlong)*(int *)(this + 0x1c) * (longlong)param_1 + 0x1000000;
*(int *)(this + 0xc) = param_1;
iVar7 = *(int *)(this + 0x10);
lVar2 = (longlong)*(int *)(this + 0x20) * (longlong)iVar8 + 0x1000000;
iVar9 = *(int *)(this + 0x18);
*(int *)(this + 0x10) = iVar8;
lVar3 = (longlong)*(int *)(this + 0x24) * (longlong)iVar7 + 0x1000000;
*(int *)(this + 0x18) = *(int *)(this + 0x14);
lVar4 = (longlong)*(int *)(this + 0x30) * (longlong)*(int *)(this + 0x14) + 0x1000000;
lVar5 = (longlong)*(int *)(this + 0x34) * (longlong)iVar9 + 0x1000000;
lVar1 = (longlong)
(int)(((((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7) +
((uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7)) -
((uint)lVar4 >> 0x19 | (int)((ulonglong)lVar4 >> 0x20) << 7)) -
((uint)lVar5 >> 0x19 | (int)((ulonglong)lVar5 >> 0x20) << 7)) *
(longlong)*(int *)(this + 0x2c) + 0x1000000;
uVar6 = (uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7;
*(uint *)(this + 0x14) = uVar6;
return uVar6;
}

35
src/util/HighShelf.h Normal file
View File

@ -0,0 +1,35 @@
//
// Created by mart on 2/13/21.
//
#ifndef VIPER_HIGHSHELF_H
#define VIPER_HIGHSHELF_H
class HighShelf {
float field_0x0;
float field_0x4;
float field_0x8;
int field_0xc;
int field_0x10;
int field_0x14;
int field_0x18;
int field_0x1c;
int field_0x20;
int field_0x24;
int field_0x28;
int field_0x2c;
int field_0x30;
int field_0x34;
int field_0x38;
public:
void SetSamplingRate(int param_1);
void SetFrequency(float param_1);
void SetQuality(float param_1);
void SetGain(float param_1);
uint Process(int param_1);
};
#endif //VIPER_HIGHSHELF_H

199
src/util/IIRFilter.cpp Normal file
View File

@ -0,0 +1,199 @@
//
// Created by mart on 2/12/21.
//
#include "IIRFilter.h"
// IIRFilter::~IIRFilter()
IIRFilter::~IIRFilter() {
MinPhaseIIRCoeffs::~MinPhaseIIRCoeffs(&this->field_0xc);
return this;
}
// IIRFilter::SetBandLevel(int, float)
double IIRFilter::SetBandLevel(int param_1,float param_2) {
uint in_r1;
undefined4 in_r3;
undefined4 unaff_r4;
undefined4 unaff_r5;
undefined4 in_lr;
undefined4 in_cr2;
undefined4 in_cr3;
undefined4 in_s1;
double dVar1;
if (0x1e < in_r1) {
return (double)CONCAT44(in_s1,param_2);
}
dVar1 = pow((double)CONCAT44(unaff_r4,in_r3),(double)CONCAT44(in_lr,unaff_r5));
coprocessor_function(0xb,6,5,in_cr2,in_cr3,in_cr2);
*(undefined4 *)(param_1 + in_r1 * 4 + 0x7e4) = 0x30000000;
return dVar1;
}
// IIRFilter::Reset()
void IIRFilter::Reset() {
memset(this->field_0x18,0,0x7c0);
this->field_0x7d8 = 2;
this->field_0x7dc = 1;
this->field_0x7e0 = 0;
return;
}
// IIRFilter::IIRFilter(int)
IIRFilter::IIRFilter(int param_1) {
undefined4 *puVar1;
int iVar2;
MinPhaseIIRCoeffs::MinPhaseIIRCoeffs(&this->field_0xc);
this->enabled = false;
if ((param_1 == 10 || (param_1 & 0xffffffefU) == 0xf) || (param_1 == 0x19)) {
this->field_0x0 = param_1;
this->samplerate = 0xac44;
MinPhaseIIRCoeffs::UpdateCoeffs(&this->field_0xc,param_1,0xac44);
}
else {
this->field_0x0 = 0;
this->samplerate = 0xac44;
}
puVar1 = &this->field_0x7e0;
iVar2 = 0x1f;
do {
iVar2 = iVar2 + -1;
puVar1 = puVar1 + 1;
*puVar1 = 0x145a983;
} while (iVar2 != 0);
Reset(this);
return this;
}
// IIRFilter::SetEnable(bool)
undefined4 IIRFilter::SetEnable(bool param_1) {
char cVar1;
cVar1 = this->enabled;
if ((bool)cVar1 == false) {
if (param_1 == false) {
return 0;
}
Reset(this);
cVar1 = this->enabled;
}
if (param_1 == (bool)cVar1) {
return 0;
}
this->enabled = param_1;
return 1;
}
// IIRFilter::SetSamplingRate(int)
void IIRFilter::SetSamplingRate(int param_1) {
if (this->samplerate == param_1) {
return;
}
this->samplerate = param_1;
if (this->field_0x0 == 0) {
Reset(this);
return;
}
MinPhaseIIRCoeffs::UpdateCoeffs(&this->field_0xc,this->field_0x0,param_1);
Reset(this);
return;
}
// IIRFilter::Process(int*, int)
void IIRFilter::Process(int *param_1,int param_2) {
longlong lVar1;
longlong lVar2;
longlong lVar3;
int iVar4;
int iVar5;
int iVar6;
int *piVar7;
int iVar8;
int *piVar9;
int iVar10;
int iVar11;
int iVar12;
int iVar13;
int *piVar14;
int *piVar15;
int *piVar16;
int local_44;
int *local_40;
int *local_3c;
int local_34;
if (((this->enabled != false) &&
(iVar4 = MinPhaseIIRCoeffs::GetCoefficients(&this->field_0xc), iVar4 != 0)) &&
(local_34 = param_2 + -1, local_3c = param_1, param_2 != 0)) {
do {
local_44 = 0;
local_40 = local_3c;
do {
iVar6 = this->field_0x0;
iVar13 = *local_40;
if (iVar6 < 1) {
iVar12 = 0;
}
else {
iVar12 = 0;
iVar10 = this->field_0x7d8;
iVar11 = this->field_0x7e0;
iVar8 = this->field_0x7dc;
piVar14 = &this->field_0x7e0;
piVar9 = (int *)(iVar4 + 8);
piVar15 = (int *)(this->field_0x18 + (iVar10 + local_44 * 8) * 4);
do {
iVar5 = piVar9[-1];
piVar7 = piVar15 + -iVar10;
*piVar15 = iVar13;
piVar16 = piVar15 + 0x10;
lVar1 = (longlong)iVar5 * (longlong)(iVar13 - piVar7[iVar11]) + 0x1000000;
lVar2 = (longlong)*piVar9 * (longlong)piVar7[iVar8 + 3] + 0x1000000;
lVar3 = (longlong)piVar9[-2] * (longlong)(piVar7 + iVar11)[3] + 0x1000000;
iVar5 = (((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7)) -
((uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7);
piVar15[3] = iVar5;
piVar14 = piVar14 + 1;
lVar1 = (longlong)iVar5 * (longlong)*piVar14 + 0x1000000;
iVar12 = iVar12 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
piVar9 = piVar9 + 4;
piVar15 = piVar16;
} while (piVar16 != (int *)(this->field_0x18 + (iVar10 + (local_44 + iVar6 * 2) * 8) * 4))
;
}
local_44 = local_44 + 1;
*local_40 = iVar12;
local_40 = local_40 + 1;
} while (local_44 != 2);
local_34 = local_34 + -1;
local_3c = local_3c + 2;
this->field_0x7d8 = (this->field_0x7d8 + 1) % 3;
this->field_0x7dc = (this->field_0x7dc + 1) % 3;
this->field_0x7e0 = (this->field_0x7e0 + 1) % 3;
} while (local_34 != -1);
return;
}
return;
}

154
src/util/IIRFilter.h Normal file
View File

@ -0,0 +1,154 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_IIRFILTER_H
#define VIPER_IIRFILTER_H
class IIRFilter {
int field_0x0;
undefined4 samplerate;
bool enabled; // Created by retype action
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
struct MinPhaseIIRCoeffs field_0xc;
char field_0x18[1984];
undefined4 field_0x7d8;
undefined4 field_0x7dc;
undefined4 field_0x7e0;
undefined4 field_0x7e4;
undefined field_0x7e8;
undefined field_0x7e9;
undefined field_0x7ea;
undefined field_0x7eb;
undefined field_0x7ec;
undefined field_0x7ed;
undefined field_0x7ee;
undefined field_0x7ef;
undefined field_0x7f0;
undefined field_0x7f1;
undefined field_0x7f2;
undefined field_0x7f3;
undefined field_0x7f4;
undefined field_0x7f5;
undefined field_0x7f6;
undefined field_0x7f7;
undefined field_0x7f8;
undefined field_0x7f9;
undefined field_0x7fa;
undefined field_0x7fb;
undefined field_0x7fc;
undefined field_0x7fd;
undefined field_0x7fe;
undefined field_0x7ff;
undefined field_0x800;
undefined field_0x801;
undefined field_0x802;
undefined field_0x803;
undefined field_0x804;
undefined field_0x805;
undefined field_0x806;
undefined field_0x807;
undefined field_0x808;
undefined field_0x809;
undefined field_0x80a;
undefined field_0x80b;
undefined field_0x80c;
undefined field_0x80d;
undefined field_0x80e;
undefined field_0x80f;
undefined field_0x810;
undefined field_0x811;
undefined field_0x812;
undefined field_0x813;
undefined field_0x814;
undefined field_0x815;
undefined field_0x816;
undefined field_0x817;
undefined field_0x818;
undefined field_0x819;
undefined field_0x81a;
undefined field_0x81b;
undefined field_0x81c;
undefined field_0x81d;
undefined field_0x81e;
undefined field_0x81f;
undefined field_0x820;
undefined field_0x821;
undefined field_0x822;
undefined field_0x823;
undefined field_0x824;
undefined field_0x825;
undefined field_0x826;
undefined field_0x827;
undefined field_0x828;
undefined field_0x829;
undefined field_0x82a;
undefined field_0x82b;
undefined field_0x82c;
undefined field_0x82d;
undefined field_0x82e;
undefined field_0x82f;
undefined field_0x830;
undefined field_0x831;
undefined field_0x832;
undefined field_0x833;
undefined field_0x834;
undefined field_0x835;
undefined field_0x836;
undefined field_0x837;
undefined field_0x838;
undefined field_0x839;
undefined field_0x83a;
undefined field_0x83b;
undefined field_0x83c;
undefined field_0x83d;
undefined field_0x83e;
undefined field_0x83f;
undefined field_0x840;
undefined field_0x841;
undefined field_0x842;
undefined field_0x843;
undefined field_0x844;
undefined field_0x845;
undefined field_0x846;
undefined field_0x847;
undefined field_0x848;
undefined field_0x849;
undefined field_0x84a;
undefined field_0x84b;
undefined field_0x84c;
undefined field_0x84d;
undefined field_0x84e;
undefined field_0x84f;
undefined field_0x850;
undefined field_0x851;
undefined field_0x852;
undefined field_0x853;
undefined field_0x854;
undefined field_0x855;
undefined field_0x856;
undefined field_0x857;
undefined field_0x858;
undefined field_0x859;
undefined field_0x85a;
undefined field_0x85b;
undefined field_0x85c;
undefined field_0x85d;
undefined field_0x85e;
undefined field_0x85f;
public:
~IIRFilter();
double SetBandLevel(int param_1,float param_2);
void Reset();
IIRFilter(int param_1);
undefined4 SetEnable(bool param_1);
void SetSamplingRate(int param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_IIRFILTER_H

447
src/util/IIR_1st.cpp Normal file
View File

@ -0,0 +1,447 @@
//
// Created by mart on 2/12/21.
//
#include "IIR_1st.h"
// IIR_1st::Mute()
void IIR_1st::Mute() {
this->field_0xc = 0;
return;
}
// IIR_1st::IIR_1st()
IIR_1st::IIR_1st() {
Mute(this);
return this;
}
// IIR_1st::setCoefficients(float, float, float)
void IIR_1st::setCoefficients(int param_1,int param_2,int param_3) {
this->field_0x4 = ROUND((float)param_1 * 3.355443e+07 + 0.5);
this->field_0x8 = ROUND((float)param_2 * 3.355443e+07 + 0.5);
this->field_0x0 = ROUND((float)param_3 * 3.355443e+07 + 0.5);
return;
}
// IIR_1st::setLPF_BW(float, float)
void IIR_1st::setLPF_BW(float param_1,float param_2) {
undefined4 uVar1;
undefined4 extraout_r1;
float in_r2;
undefined4 unaff_r4;
undefined4 in_lr;
undefined4 in_cr1;
undefined4 in_cr2;
float fVar2;
double dVar3;
coprocessor_function(0xb,6,5,in_cr1,in_cr2,in_cr1);
uVar1 = SUB84(3.141592653589793 / (double)in_r2,0);
tan((double)CONCAT44(in_lr,unaff_r4));
dVar3 = (double)CONCAT44(extraout_r1,uVar1);
fVar2 = SUB84(ROUND((dVar3 / (dVar3 + 1.0)) * 33554432.0 + 0.5),0);
this->field_0x8 = fVar2;
this->field_0x0 = SUB84(ROUND(((1.0 - dVar3) / (dVar3 + 1.0)) * 33554432.0 + 0.5),0);
this->field_0x4 = fVar2;
return;
}
// IIR_1st::setHPF_BW(float, float)
void IIR_1st::setHPF_BW(float param_1,float param_2) {
undefined4 uVar1;
undefined4 extraout_r1;
float in_r2;
undefined4 unaff_r4;
undefined4 in_lr;
undefined4 in_cr1;
undefined4 in_cr2;
double dVar2;
double dVar3;
coprocessor_function(0xb,6,5,in_cr1,in_cr2,in_cr1);
uVar1 = SUB84(3.141592653589793 / (double)in_r2,0);
tan((double)CONCAT44(in_lr,unaff_r4));
dVar3 = (double)CONCAT44(extraout_r1,uVar1) + 1.0;
dVar2 = 1.0 / dVar3;
this->field_0x4 = SUB84(ROUND(dVar2 * 33554432.0 + 0.5),0);
this->field_0x0 =
SUB84(ROUND(((1.0 - (double)CONCAT44(extraout_r1,uVar1)) / dVar3) * 33554432.0 + 0.5),0);
this->field_0x8 = SUB84(ROUND(0.5 - dVar2 * 33554432.0),0);
return;
}
// IIR_1st::setLPF_A(float, float)
void IIR_1st::setLPF_A(float param_1,float param_2) {
undefined4 uVar1;
undefined4 extraout_r1;
float in_r2;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr2;
undefined4 in_cr3;
undefined4 in_cr8;
double unaff_d8;
double dVar2;
coprocessor_function(0xb,6,5,in_cr1,in_cr2,in_cr1);
coprocessor_function(0xb,6,4,in_cr0,in_cr0,in_cr8);
uVar1 = SUB84(-3.141592653589793 / (double)in_r2,0);
exp(unaff_d8);
dVar2 = (double)CONCAT44(extraout_r1,uVar1);
this->field_0x0 = SUB84(ROUND(dVar2 * 33554432.0 + 0.5),0);
coprocessor_function(0xb,6,5,in_cr2,in_cr1,in_cr3);
this->field_0x4 = SUB84(ROUND(((1.0 - dVar2) / 1.12) * 33554432.0 + 0.5),0);
this->field_0x8 = SUB84(ROUND(dVar2 * 33554432.0 + 0.5),0);
return;
}
// IIR_1st::setHPF_A(float, float)
void IIR_1st::setHPF_A(float param_1,float param_2) {
undefined4 uVar1;
undefined4 extraout_r1;
float in_r2;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr2;
undefined4 in_cr8;
double unaff_d8;
double dVar2;
coprocessor_function(0xb,6,5,in_cr1,in_cr2,in_cr1);
coprocessor_function(0xb,6,4,in_cr0,in_cr0,in_cr8);
uVar1 = SUB84(-3.141592653589793 / (double)in_r2,0);
exp(unaff_d8);
dVar2 = (double)CONCAT44(extraout_r1,uVar1) + 1.0;
coprocessor_function(0xb,6,4,in_cr1,in_cr1,in_cr8);
this->field_0x8 = SUB84(ROUND(0.5 - dVar2 * 33554432.0),0);
this->field_0x0 = SUB84(ROUND((double)CONCAT44(extraout_r1,uVar1) * 33554432.0 + 0.5),0);
this->field_0x4 = SUB84(ROUND(dVar2 * 33554432.0 + 0.5),0);
return;
}
// IIR_1st::setLSF_A(float, float, float)
void IIR_1st::setLSF_A(float param_1,float param_2,float param_3) {
undefined4 uVar1;
float in_r1;
undefined4 extraout_r1;
undefined4 extraout_r1_00;
float in_r3;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr8;
undefined4 in_cr10;
undefined4 in_cr11;
double unaff_d8;
coprocessor_function(0xb,2,0,in_cr10,in_cr10,in_cr8);
coprocessor_function(0xb,6,4,in_cr0,in_cr0,in_cr11);
uVar1 = SUB84((double)in_r1 / (double)in_r3,0);
exp(unaff_d8);
this->field_0x4 = -4.25353e+37;
coprocessor_function(0xb,2,4,in_cr11,in_cr1,in_cr11);
this->field_0x0 = SUB84(ROUND(0.5 - (double)CONCAT44(extraout_r1,uVar1) * 33554432.0),0);
uVar1 = SUB84(-3.141592653589793 / (double)in_r3,0);
exp(unaff_d8);
this->field_0x8 = SUB84(ROUND((double)CONCAT44(extraout_r1_00,uVar1) * 33554432.0 + 0.5),0);
return;
}
// IIR_1st::setHSF_A(float, float, float)
void IIR_1st::setHSF_A(float param_1,float param_2,float param_3) {
undefined4 uVar1;
undefined4 uVar2;
float in_r1;
undefined4 extraout_r1;
undefined4 extraout_r1_00;
float in_r3;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr2;
undefined4 in_cr8;
undefined4 in_cr10;
undefined4 in_cr11;
double unaff_d8;
coprocessor_function(0xb,2,0,in_cr10,in_cr10,in_cr8);
coprocessor_function(0xb,6,4,in_cr0,in_cr0,in_cr11);
uVar1 = SUB84((double)in_r1 / (double)in_r3,0);
exp(unaff_d8);
coprocessor_function(0xb,2,4,in_cr11,in_cr0,in_cr11);
uVar2 = SUB84(-3.141592653589793 / (double)in_r3,0);
exp(unaff_d8);
this->field_0x0 = SUB84(ROUND((double)CONCAT44(extraout_r1,uVar1) * 33554432.0 + 0.5),0);
coprocessor_function(0xb,6,5,in_cr2,in_cr2,in_cr1);
this->field_0x4 =
SUB84(ROUND(0.5 - ((1.0 - (double)CONCAT44(extraout_r1,uVar1)) /
((double)CONCAT44(extraout_r1_00,uVar2) - 1.0)) * 33554432.0),0);
this->field_0x8 = SUB84(ROUND((double)CONCAT44(extraout_r1_00,uVar2) * 33554432.0 + 0.5),0);
return;
}
// IIR_1st::setHPFwLFS_A(float, float)
void IIR_1st::setHPFwLFS_A(float param_1,float param_2) {
undefined4 uVar1;
undefined4 extraout_r1;
float in_r2;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr2;
undefined4 in_cr8;
int iVar2;
double unaff_d8;
coprocessor_function(0xb,6,5,in_cr1,in_cr2,in_cr1);
coprocessor_function(0xb,6,4,in_cr0,in_cr0,in_cr8);
uVar1 = SUB84(-3.141592653589793 / (double)in_r2,0);
exp(unaff_d8);
this->field_0x0 = -NAN;
iVar2 = SUB84(ROUND((double)CONCAT44(extraout_r1,uVar1) - 1.0),0);
if (iVar2 < 0) {
iVar2 = -iVar2;
}
coprocessor_function(0xb,6,5,in_cr2,in_cr2,in_cr1);
this->field_0x4 = SUB84(ROUND(0.5 - (1.12 / (double)(longlong)iVar2) * 33554432.0),0);
this->field_0x8 = SUB84(ROUND((double)CONCAT44(extraout_r1,uVar1) * 33554432.0 + 0.5),0);
return;
}
// IIR_1st::setLPF_C(float, float)
void IIR_1st::setLPF_C(float param_1,float param_2) {
float in_r1;
float in_r2;
float fVar1;
fVar1 = SUB84(ROUND((double)(in_r1 / (in_r2 + in_r1)) * 33554432.0 + 0.5),0);
this->field_0x8 = fVar1;
this->field_0x0 = SUB84(ROUND((double)((in_r2 - in_r1) / (in_r2 + in_r1)) * 33554432.0 + 0.5),0);
this->field_0x4 = fVar1;
return;
}
// IIR_1st::setHPF_C(float, float)
void IIR_1st::setHPF_C(float param_1,float param_2) {
float in_r1;
float in_r2;
double dVar1;
dVar1 = (double)(in_r2 / (in_r2 + in_r1));
this->field_0x4 = SUB84(ROUND(dVar1 * 33554432.0 + 0.5),0);
this->field_0x8 = SUB84(ROUND(0.5 - dVar1 * 33554432.0),0);
this->field_0x0 = SUB84(ROUND((double)((in_r2 - in_r1) / (in_r2 + in_r1)) * 33554432.0 + 0.5),0);
return;
}
// IIR_1st::setPole(float)
void IIR_1st::setPole(float param_1) {
float in_r1;
undefined4 in_cr2;
undefined4 in_cr3;
float fVar1;
fVar1 = ROUND(in_r1);
if ((int)fVar1 < 0) {
fVar1 = (float)-(int)fVar1;
}
coprocessor_function(0xb,6,5,in_cr3,in_cr2,in_cr3);
this->field_0x0 = SUB84(ROUND((double)in_r1 * 33554432.0 + 0.5),0);
this->field_0x4 = SUB84(ROUND((1.0 - (double)(longlong)(int)fVar1) * 33554432.0 + 0.5),0);
this->field_0x8 = 0.0;
return;
}
// IIR_1st::setZero(float)
void IIR_1st::setZero(float param_1) {
float in_r1;
undefined4 in_cr2;
undefined4 in_cr3;
float fVar1;
fVar1 = ROUND(in_r1);
if ((int)fVar1 < 0) {
fVar1 = (float)-(int)fVar1;
}
this->field_0x0 = 0.0;
coprocessor_function(0xb,6,5,in_cr3,in_cr3,in_cr2);
this->field_0x4 = SUB84(ROUND(0.5 - ((double)(longlong)(int)fVar1 + 1.0) * 33554432.0),0);
this->field_0x8 = SUB84(ROUND((double)in_r1 * 33554432.0 + 0.5),0);
return;
}
// IIR_1st::setPoleLPF(float, float)
void IIR_1st::setPoleLPF(float param_1,float param_2) {
undefined4 uVar1;
undefined4 extraout_r1;
undefined4 extraout_r1_00;
float in_r2;
undefined in_ZR;
undefined4 in_cr1;
undefined4 in_cr2;
double unaff_d8;
double dVar2;
double dVar3;
double dVar4;
coprocessor_function(0xb,6,5,in_cr1,in_cr2,in_cr1);
uVar1 = SUB84(6.283185307179586 / (double)in_r2,0);
cos(unaff_d8);
dVar2 = 2.0 - (double)CONCAT44(extraout_r1,uVar1);
dVar4 = dVar2 * dVar2 - 1.0;
dVar3 = SQRT(dVar4);
if (!(bool)in_ZR) {
uVar1 = SUB84(dVar4,0);
sqrt(unaff_d8);
dVar3 = (double)CONCAT44(extraout_r1_00,uVar1);
}
this->field_0x8 = 0.0;
this->field_0x0 = SUB84(ROUND((dVar2 - dVar3) * 33554432.0 + 0.5),0);
this->field_0x4 = SUB84(ROUND((1.0 - (dVar2 - dVar3)) * 33554432.0 + 0.5),0);
return;
}
// IIR_1st::setPoleHPF(float, float)
void IIR_1st::setPoleHPF(float param_1,float param_2) {
undefined4 uVar1;
undefined4 extraout_r1;
undefined4 extraout_r1_00;
float in_r2;
undefined in_ZR;
undefined4 in_cr1;
undefined4 in_cr2;
double unaff_d8;
double dVar2;
double dVar3;
double dVar4;
coprocessor_function(0xb,6,5,in_cr1,in_cr2,in_cr1);
uVar1 = SUB84(6.283185307179586 / (double)in_r2,0);
cos(unaff_d8);
dVar2 = (double)CONCAT44(extraout_r1,uVar1) + 2.0;
dVar4 = dVar2 * dVar2 - 1.0;
dVar3 = SQRT(dVar4);
if (!(bool)in_ZR) {
uVar1 = SUB84(dVar4,0);
sqrt(unaff_d8);
dVar3 = (double)CONCAT44(extraout_r1_00,uVar1);
}
this->field_0x8 = 0.0;
this->field_0x0 = SUB84(ROUND(0.5 - (dVar2 - dVar3) * 33554432.0),0);
this->field_0x4 = SUB84(ROUND(((dVar2 - dVar3) - 1.0) * 33554432.0 + 0.5),0);
return;
}
// IIR_1st::setZeroLPF(float, float)
void IIR_1st::setZeroLPF(float param_1,float param_2) {
undefined4 uVar1;
undefined4 extraout_r1;
undefined4 extraout_r1_00;
float in_r2;
undefined in_ZR;
undefined4 in_cr1;
undefined4 in_cr2;
double unaff_d8;
double dVar2;
double dVar3;
double dVar4;
coprocessor_function(0xb,6,5,in_cr1,in_cr2,in_cr1);
uVar1 = SUB84(6.283185307179586 / (double)in_r2,0);
cos(unaff_d8);
dVar2 = 1.0 - ((double)CONCAT44(extraout_r1,uVar1) + (double)CONCAT44(extraout_r1,uVar1));
dVar4 = dVar2 * dVar2 - 1.0;
dVar3 = SQRT(dVar4);
if (!(bool)in_ZR) {
uVar1 = SUB84(dVar4,0);
sqrt(unaff_d8);
dVar3 = (double)CONCAT44(extraout_r1_00,uVar1);
}
dVar4 = (dVar2 - dVar3) + 1.0;
this->field_0x0 = 0.0;
this->field_0x4 = SUB84(ROUND((1.0 / dVar4) * 33554432.0 + 0.5),0);
this->field_0x8 = SUB84(ROUND(((dVar2 - dVar3) / dVar4) * 33554432.0 + 0.5),0);
return;
}
// IIR_1st::setZeroHPF(float, float)
void IIR_1st::setZeroHPF(float param_1,float param_2) {
undefined4 uVar1;
undefined4 extraout_r1;
undefined4 extraout_r1_00;
float in_r2;
undefined in_ZR;
undefined4 in_cr1;
undefined4 in_cr2;
double unaff_d8;
double dVar2;
double dVar3;
double dVar4;
coprocessor_function(0xb,6,5,in_cr1,in_cr2,in_cr1);
uVar1 = SUB84(6.283185307179586 / (double)in_r2,0);
cos(unaff_d8);
dVar2 = (double)CONCAT44(extraout_r1,uVar1) + (double)CONCAT44(extraout_r1,uVar1) + 1.0;
dVar4 = dVar2 * dVar2 - 1.0;
dVar3 = SQRT(dVar4);
if (!(bool)in_ZR) {
uVar1 = SUB84(dVar4,0);
sqrt(unaff_d8);
dVar3 = (double)CONCAT44(extraout_r1_00,uVar1);
}
dVar4 = (dVar2 - dVar3) + 1.0;
this->field_0x0 = 0.0;
this->field_0x4 = SUB84(ROUND((1.0 / dVar4) * 33554432.0 + 0.5),0);
this->field_0x8 = SUB84(ROUND(((0.0 - (dVar2 - dVar3)) / dVar4) * 33554432.0 + 0.5),0);
return;
}

37
src/util/IIR_1st.h Normal file
View File

@ -0,0 +1,37 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_IIR_1ST_H
#define VIPER_IIR_1ST_H
class IIR_1st {
float field_0x0;
float field_0x4;
float field_0x8;
undefined4 field_0xc;
public:
void Mute();
IIR_1st();
void setCoefficients(int param_1,int param_2,int param_3);
void setLPF_BW(float param_1,float param_2);
void setHPF_BW(float param_1,float param_2);
void setLPF_A(float param_1,float param_2);
void setHPF_A(float param_1,float param_2);
void setLSF_A(float param_1,float param_2,float param_3);
void setHSF_A(float param_1,float param_2,float param_3);
void setHPFwLFS_A(float param_1,float param_2);
void setLPF_C(float param_1,float param_2);
void setHPF_C(float param_1,float param_2);
void setPole(float param_1);
void setZero(float param_1);
void setPoleLPF(float param_1,float param_2);
void setPoleHPF(float param_1,float param_2);
void setZeroLPF(float param_1,float param_2);
void setZeroHPF(float param_1,float param_2);
};
#endif //VIPER_IIR_1ST_H

View File

@ -0,0 +1,165 @@
//
// Created by mart on 2/12/21.
//
#include "IIR_NOrder_BW_BP.h"
// IIR_NOrder_BW_BP::IIR_NOrder_BW_BP(int)
IIR_NOrder_BW_BP::IIR_NOrder_BW_BP(int param_1) {
int iVar1;
uint uVar2;
IIR_1st *pIVar3;
void *pvVar4;
IIR_1st *pIVar5;
int iVar6;
uint uVar7;
*(undefined4 *)this = 0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
if (0 < param_1) {
uVar7 = param_1 - 1;
if ((uint)param_1 < 0x7f00001) {
uVar2 = param_1 * 0x10;
}
else {
uVar2 = 0xffffffff;
}
pIVar3 = (IIR_1st *)operator_new__(uVar2);
uVar2 = uVar7;
pIVar5 = pIVar3;
do {
uVar2 = uVar2 - 1;
IIR_1st::IIR_1st(pIVar5);
pIVar5 = pIVar5 + 1;
} while (uVar2 != 0xffffffff);
*(IIR_1st **)this = pIVar3;
if ((uint)param_1 < 0x7f00001) {
uVar2 = param_1 * 0x10;
}
pIVar3 = (IIR_1st *)operator_new__(uVar2);
pIVar5 = pIVar3;
do {
uVar7 = uVar7 - 1;
IIR_1st::IIR_1st(pIVar5);
pIVar5 = pIVar5 + 1;
} while (uVar7 != 0xffffffff);
pvVar4 = *(void **)this;
*(IIR_1st **)(this + 4) = pIVar3;
if (pvVar4 != nullptr) {
if (pIVar3 != nullptr) {
iVar6 = 0;
while( true ) {
iVar1 = iVar6 * 0x10;
iVar6 = iVar6 + 1;
IIR_1st::Mute((IIR_1st *)((int)pvVar4 + iVar1));
IIR_1st::Mute((IIR_1st *)(*(int *)(this + 4) + iVar1));
if (iVar6 == param_1) break;
pvVar4 = *(void **)this;
}
*(int *)(this + 8) = iVar6;
return this;
}
operator_delete__(pvVar4);
pIVar3 = *(IIR_1st **)(this + 4);
}
if (pIVar3 != nullptr) {
operator_delete__(pIVar3);
return this;
}
}
return this;
}
// IIR_NOrder_BW_BP::~IIR_NOrder_BW_BP()
IIR_NOrder_BW_BP::~IIR_NOrder_BW_BP() {
if (*(void **)this != nullptr) {
operator_delete__(*(void **)this);
}
if (*(void **)(this + 4) != nullptr) {
operator_delete__(*(void **)(this + 4));
}
return this;
}
// IIR_NOrder_BW_BP::Mute()
void IIR_NOrder_BW_BP::Mute() {
int iVar1;
int iVar2;
int iVar3;
iVar2 = *(int *)this;
if ((iVar2 != 0) && (0 < *(int *)(this + 8))) {
iVar3 = 0;
while( true ) {
iVar1 = iVar3 * 0x10;
iVar3 = iVar3 + 1;
IIR_1st::Mute((IIR_1st *)(iVar2 + iVar1));
if (*(int *)(this + 8) <= iVar3) break;
iVar2 = *(int *)this;
}
}
iVar2 = *(int *)(this + 4);
if (iVar2 == 0) {
return;
}
if (*(int *)(this + 8) < 1) {
return;
}
iVar3 = 0;
while( true ) {
iVar1 = iVar3 * 0x10;
iVar3 = iVar3 + 1;
IIR_1st::Mute((IIR_1st *)(iVar2 + iVar1));
if (*(int *)(this + 8) <= iVar3) break;
iVar2 = *(int *)(this + 4);
}
return;
}
// IIR_NOrder_BW_BP::setBPF(float, float, float)
void IIR_NOrder_BW_BP::setBPF(float param_1,float param_2,float param_3) {
int *in_r0;
int iVar1;
int iVar2;
undefined8 uVar3;
uVar3 = CONCAT44(param_2,param_1);
iVar1 = *in_r0;
if ((iVar1 != 0) && (0 < in_r0[2])) {
iVar2 = 0;
while( true ) {
uVar3 = IIR_1st::setLPF_BW((IIR_1st *)(iVar1 + iVar2 * 0x10),(float)uVar3,
(float)((ulonglong)uVar3 >> 0x20));
iVar2 = iVar2 + 1;
if (in_r0[2] <= iVar2) break;
iVar1 = *in_r0;
}
}
iVar1 = in_r0[1];
if (iVar1 == 0) {
return;
}
if (in_r0[2] < 1) {
return;
}
iVar2 = 0;
while( true ) {
uVar3 = IIR_1st::setHPF_BW((IIR_1st *)(iVar1 + iVar2 * 0x10),(float)uVar3,
(float)((ulonglong)uVar3 >> 0x20));
iVar2 = iVar2 + 1;
if (in_r0[2] <= iVar2) break;
iVar1 = in_r0[1];
}
return;
}

View File

@ -0,0 +1,22 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_IIR_NORDER_BW_BP_H
#define VIPER_IIR_NORDER_BW_BP_H
class IIR_NOrder_BW_BP {
struct IIR_1st* field_0x0;
struct IIR_1st* field_0x4;
undefined4 field_0x8;
public:
IIR_NOrder_BW_BP(int param_1);
~IIR_NOrder_BW_BP();
void Mute();
void setBPF(float param_1,float param_2,float param_3);
};
#endif //VIPER_IIR_NORDER_BW_BP_H

View File

@ -0,0 +1,137 @@
//
// Created by mart on 2/12/21.
//
#include "IIR_NOrder_BW_LH.h"
// IIR_NOrder_BW_LH::IIR_NOrder_BW_LH(int)
IIR_NOrder_BW_LH::IIR_NOrder_BW_LH(int param_1) {
uint uVar1;
IIR_1st *pIVar2;
IIR_1st *this_00;
int iVar3;
this->field_0x0 = nullptr;
this->field_0x4 = 0;
if (0 < param_1) {
iVar3 = param_1 + -1;
if ((uint)param_1 < 0x7f00001) {
uVar1 = param_1 * 0x10;
}
else {
uVar1 = 0xffffffff;
}
pIVar2 = (IIR_1st *)operator_new__(uVar1);
this_00 = pIVar2;
do {
iVar3 = iVar3 + -1;
IIR_1st::IIR_1st(this_00);
this_00 = this_00 + 1;
} while (iVar3 != -1);
this->field_0x0 = pIVar2;
if (pIVar2 != nullptr) {
iVar3 = 0;
while( true ) {
pIVar2 = pIVar2 + iVar3;
iVar3 = iVar3 + 1;
IIR_1st::Mute(pIVar2);
if (iVar3 == param_1) break;
pIVar2 = this->field_0x0;
}
this->field_0x4 = iVar3;
}
}
return this;
}
// IIR_NOrder_BW_LH::~IIR_NOrder_BW_LH()
IIR_NOrder_BW_LH::~IIR_NOrder_BW_LH() {
if (this->field_0x0 != nullptr) {
operator_delete__(this->field_0x0);
}
return this;
}
// IIR_NOrder_BW_LH::Mute()
void IIR_NOrder_BW_LH::Mute() {
IIR_1st *pIVar1;
int iVar2;
pIVar1 = this->field_0x0;
if (pIVar1 == nullptr) {
return;
}
if (this->field_0x4 < 1) {
return;
}
iVar2 = 0;
while( true ) {
pIVar1 = pIVar1 + iVar2;
iVar2 = iVar2 + 1;
IIR_1st::Mute(pIVar1);
if (this->field_0x4 <= iVar2) break;
pIVar1 = this->field_0x0;
}
return;
}
// IIR_NOrder_BW_LH::setLPF(float, float)
void IIR_NOrder_BW_LH::setLPF(float param_1,float param_2) {
IIR_1st *pIVar1;
int iVar2;
undefined8 uVar3;
uVar3 = CONCAT44(param_2,param_1);
pIVar1 = this->field_0x0;
if (pIVar1 == nullptr) {
return;
}
if (this->field_0x4 < 1) {
return;
}
iVar2 = 0;
while( true ) {
uVar3 = IIR_1st::setLPF_BW(pIVar1 + iVar2,(float)uVar3,(float)((ulonglong)uVar3 >> 0x20));
iVar2 = iVar2 + 1;
if (this->field_0x4 <= iVar2) break;
pIVar1 = this->field_0x0;
}
return;
}
// IIR_NOrder_BW_LH::setHPF(float, float)
void IIR_NOrder_BW_LH::setHPF(float param_1,float param_2) {
IIR_1st *pIVar1;
int iVar2;
undefined8 uVar3;
uVar3 = CONCAT44(param_2,param_1);
pIVar1 = this->field_0x0;
if (pIVar1 == nullptr) {
return;
}
if (this->field_0x4 < 1) {
return;
}
iVar2 = 0;
while( true ) {
uVar3 = IIR_1st::setHPF_BW(pIVar1 + iVar2,(float)uVar3,(float)((ulonglong)uVar3 >> 0x20));
iVar2 = iVar2 + 1;
if (this->field_0x4 <= iVar2) break;
pIVar1 = this->field_0x0;
}
return;
}

View File

@ -0,0 +1,22 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_IIR_NORDER_BW_LH_H
#define VIPER_IIR_NORDER_BW_LH_H
class IIR_NOrder_BW_LH {
struct IIR_1st * field_0x0;
int field_0x4;
public:
IIR_NOrder_BW_LH(int param_1);
~IIR_NOrder_BW_LH();
void Mute();
void setLPF(float param_1,float param_2);
void setHPF(float param_1,float param_2);
};
#endif //VIPER_IIR_NORDER_BW_LH_H

View File

@ -0,0 +1,337 @@
//
// Created by mart on 2/12/21.
//
#include "MinPhaseIIRCoeffs.h"
// MinPhaseIIRCoeffs::MinPhaseIIRCoeffs()
MinPhaseIIRCoeffs::MinPhaseIIRCoeffs() {
this->samplerate = 0xac44;
this->coefficients = nullptr;
this->field_0x8 = 0;
return;
}
// MinPhaseIIRCoeffs::~MinPhaseIIRCoeffs()
MinPhaseIIRCoeffs::~MinPhaseIIRCoeffs() {
if (this->coefficients != nullptr) {
operator_delete__(this->coefficients);
this->coefficients = nullptr;
}
return this;
}
// MinPhaseIIRCoeffs::Find_F1_F2(double, double, double*, double*)
void MinPhaseIIRCoeffs::Find_F1_F2(double param_1,double param_2,double *param_3,double *param_4) {
undefined4 uVar1;
undefined4 extraout_r1;
undefined4 in_r2;
undefined4 in_r3;
undefined4 unaff_r4;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr2;
undefined4 in_cr8;
double unaff_d8;
uVar1 = 0;
coprocessor_function(0xb,6,5,in_cr2,in_cr0,in_cr1);
pow(unaff_d8,(double)CONCAT44(unaff_r4,in_r3));
coprocessor_function(0xb,2,1,in_cr8,in_cr8,in_cr0);
*param_2._0_4_ = (double)CONCAT44(in_r3,in_r2) / (double)CONCAT44(extraout_r1,uVar1);
*param_2._4_4_ = (double)CONCAT44(in_r3,in_r2);
return;
}
// MinPhaseIIRCoeffs::SolveRoot(double, double, double, double*)
double * MinPhaseIIRCoeffs::SolveRoot(double param_1,double param_2,double param_3,double *param_4) {
undefined4 uVar1;
undefined4 uVar2;
undefined4 extraout_r1;
undefined4 extraout_r1_00;
undefined4 in_r2;
undefined4 in_r3;
char in_NG;
undefined in_ZR;
char in_OV;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr3;
undefined4 in_cr4;
double unaff_d8;
double dVar3;
double dVar4;
double dVar5;
double in_d20;
dVar5 = (double)CONCAT44(in_r3,in_r2);
coprocessor_function(0xb,6,5,in_cr3,in_cr0,in_cr3);
coprocessor_function(0xb,6,5,in_cr4,in_cr1,in_cr1);
dVar4 = param_1 / (dVar5 + dVar5);
if (!(bool)in_ZR && in_NG == in_OV) {
param_4 = (double *)0xffffffff;
}
if ((bool)in_ZR || in_NG != in_OV) {
dVar5 = 0.0 - (param_2 - in_d20 / 4.0) / dVar5;
dVar3 = SQRT(dVar5);
uVar2 = SUB84(dVar5,0);
dVar5 = dVar3;
if (!(bool)in_ZR) {
uVar1 = uVar2;
sqrt(unaff_d8);
dVar5 = (double)CONCAT44(extraout_r1,uVar1);
}
*param_3._0_4_ = (0.0 - dVar4) - dVar5;
if (!(bool)in_ZR) {
sqrt(unaff_d8);
dVar3 = (double)CONCAT44(extraout_r1_00,uVar2);
}
param_4 = nullptr;
if ((bool)in_NG) {
*param_3._0_4_ = dVar3 - dVar4;
}
}
return param_4;
}
// MinPhaseIIRCoeffs::UpdateCoeffs(int, int)
undefined4 MinPhaseIIRCoeffs::UpdateCoeffs(int param_1,int samplerate) {
uint uVar1;
void *pvVar2;
undefined4 uVar3;
undefined4 uVar4;
double *extraout_r1;
undefined4 extraout_r1_00;
undefined4 extraout_r1_01;
double *pdVar5;
double *pdVar6;
int iVar7;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr3;
undefined4 in_cr4;
undefined4 in_cr8;
undefined4 in_cr9;
undefined4 in_cr10;
undefined4 in_cr11;
undefined4 in_cr12;
undefined4 in_cr13;
undefined4 in_cr14;
undefined4 in_cr15;
int iVar8;
double unaff_d13;
double unaff_d14;
double dVar9;
double dVar10;
undefined8 uVar11;
undefined4 in_stack_ffffff6c;
double local_90;
double local_80;
undefined auStack120 [8];
double local_70;
if ((param_1 != 10 && (param_1 & 0xffffffefU) != 0xf) && (param_1 != 0x19)) {
return 0;
}
if (samplerate < 0xac44) {
return 0;
}
this->field_0x8 = param_1;
this->samplerate = samplerate;
if (this->coefficients != nullptr) {
operator_delete__(this->coefficients);
param_1 = this->field_0x8;
this->coefficients = nullptr;
}
if ((uint)param_1 < 0x7f00001) {
uVar1 = param_1 << 4;
}
else {
uVar1 = 0xffffffff;
}
pvVar2 = operator_new__(uVar1);
this->coefficients = pvVar2;
if (pvVar2 == nullptr) {
return 0;
}
memset(pvVar2,0,this->field_0x8 << 4);
switch(this->field_0x8) {
case 10:
local_90 = 1.0;
pdVar6 = (double *)&DAT_000ce7d0;
goto LAB_00065e84;
case 0xb:
break;
case 0xc:
break;
case 0xd:
break;
case 0xe:
break;
case 0xf:
local_90 = 0.6666666666666666;
pdVar6 = (double *)&DAT_000ce598;
goto LAB_00065e84;
case 0x10:
break;
case 0x11:
break;
case 0x12:
break;
case 0x13:
break;
case 0x14:
break;
case 0x15:
break;
case 0x16:
break;
case 0x17:
break;
case 0x18:
break;
case 0x19:
pdVar6 = (double *)&DAT_000ce610;
local_90 = 0.3333333333333333;
goto LAB_00065e84;
case 0x1a:
break;
case 0x1b:
break;
case 0x1c:
break;
case 0x1d:
break;
case 0x1e:
break;
case 0x1f:
local_90 = 0.3333333333333333;
pdVar6 = (double *)&DAT_000ce6d8;
LAB_00065e84:
iVar7 = 0;
pdVar5 = extraout_r1;
do {
dVar10 = local_90;
Find_F1_F2(local_90,(double)CONCAT44(auStack120,&local_80),(double *)this,pdVar5);
dVar9 = *pdVar6;
pdVar6 = pdVar6 + 1;
iVar8 = this->samplerate;
coprocessor_function(0xb,6,4,in_cr0,in_cr0,in_cr15);
uVar3 = SUB84(dVar9 / (double)(longlong)iVar8,0);
cos(dVar10);
coprocessor_function(0xb,2,0,in_cr14,in_cr8,in_cr8);
coprocessor_function(0xb,2,0,in_cr12,in_cr12,in_cr15);
coprocessor_function(0xb,2,0,in_cr13,in_cr14,in_cr11);
dVar9 = local_80 / (double)(longlong)iVar8;
uVar4 = SUB84(dVar9,0);
cos(dVar10);
coprocessor_function(0xb,2,1,in_cr12,in_cr9,in_cr0);
sin(dVar10);
coprocessor_function(0xb,2,0,in_cr12,in_cr8,in_cr12);
coprocessor_function(0xb,6,1,in_cr3,in_cr9,in_cr0);
coprocessor_function(0xb,2,0,in_cr9,in_cr9,in_cr9);
coprocessor_function(0xb,6,5,in_cr0,in_cr4,in_cr4);
coprocessor_function(0xb,2,1,in_cr8,in_cr8,in_cr3);
unaff_d13 = unaff_d13 + (double)CONCAT44(extraout_r1_01,uVar4) * 0.9999999999999998;
dVar10 = ((unaff_d13 - dVar9) - 0.4999999999999999) + 0.2499999999999999;
uVar11 = SolveRoot(dVar10,((unaff_d14 * 0.125 - (double)CONCAT44(extraout_r1_00,uVar3)) +
0.125) - 0.06249999999999999,
(double)CONCAT44(in_stack_ffffff6c,&local_70),(double *)this);
pdVar5 = (double *)((ulonglong)uVar11 >> 0x20);
if ((int)uVar11 == 0) {
coprocessor_function(0xb,6,4,in_cr1,in_cr1,in_cr15);
coprocessor_function(0xb,6,4,in_cr0,in_cr0,in_cr10);
pvVar2 = (void *)((int)this->coefficients + iVar7 * 0x10);
dVar9 = local_70 + 0.5;
*(int *)((int)this->coefficients + iVar7 * 0x10) =
SUB84(ROUND((local_70 + local_70) * 33554432.0 + 0.5),0);
*(int *)((int)pvVar2 + 4) =
SUB84(ROUND(((0.5 - local_70) + (0.5 - local_70)) * 33554432.0 + 0.5),0);
cos(dVar10);
pdVar5 = (double *)0x41800000;
coprocessor_function(0xb,2,1,in_cr8,in_cr8,in_cr0);
*(int *)((int)pvVar2 + 8) = SUB84(ROUND((dVar9 + dVar9) * 33554432.0 + 0.5),0);
}
iVar7 = iVar7 + 1;
} while (iVar7 < this->field_0x8);
return 1;
}
return 0;
}
// MinPhaseIIRCoeffs::GetCoefficients()
void * MinPhaseIIRCoeffs::GetCoefficients() {
return this->coefficients;
}
// MinPhaseIIRCoeffs::GetIndexFrequency(int)
undefined8 MinPhaseIIRCoeffs::GetIndexFrequency(int param_1) {
if ((-1 < param_1) && (param_1 < this->field_0x8)) {
switch(this->field_0x8) {
case 10:
return *(undefined8 *)(&DAT_000ce7d0 + param_1 * 2);
case 0xb:
break;
case 0xc:
break;
case 0xd:
break;
case 0xe:
break;
case 0xf:
return *(undefined8 *)(&DAT_000ce598 + param_1 * 2);
case 0x10:
break;
case 0x11:
break;
case 0x12:
break;
case 0x13:
break;
case 0x14:
break;
case 0x15:
break;
case 0x16:
break;
case 0x17:
break;
case 0x18:
break;
case 0x19:
return *(undefined8 *)(&DAT_000ce610 + param_1 * 2);
case 0x1a:
break;
case 0x1b:
break;
case 0x1c:
break;
case 0x1d:
break;
case 0x1e:
break;
case 0x1f:
return *(undefined8 *)(&DAT_000ce6d8 + param_1 * 8);
}
}
return 0;
}

View File

@ -0,0 +1,25 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_MINPHASEIIRCOEFFS_H
#define VIPER_MINPHASEIIRCOEFFS_H
class MinPhaseIIRCoeffs {
void * coefficients;
int samplerate;
int field_0x8;
public:
MinPhaseIIRCoeffs();
~MinPhaseIIRCoeffs();
void Find_F1_F2(double param_1,double param_2,double *param_3,double *param_4);
double * SolveRoot(double param_1,double param_2,double param_3,double *param_4);
undefined4 UpdateCoeffs(int param_1,int samplerate);
void * GetCoefficients();
undefined8 GetIndexFrequency(int param_1);
};
#endif //VIPER_MINPHASEIIRCOEFFS_H

240
src/util/MultiBiquad.cpp Normal file
View File

@ -0,0 +1,240 @@
//
// Created by mart on 2/12/21.
//
#include "MultiBiquad.h"
// MultiBiquad::MultiBiquad()
MultiBiquad::MultiBiquad() {
this->field_0x0 = 0;
this->field_0x4 = 0;
this->field_0x8 = 0;
this->field_0xc = 0;
this->field_0x10 = 0;
this->field_0x18 = 0;
this->field_0x14 = 0;
this->field_0x20 = 0;
this->field_0x1c = 0;
return;
}
// MultiBiquad::RefreshFilter(MultiBiquad::FilterType( float, float, float, float, bool)
void MultiBiquad::RefreshFilter(dword param_1,float param_2,float param_3,float param_4,
float param_5,bool param_6) {
undefined4 uVar1;
undefined4 uVar2;
undefined4 extraout_r1;
undefined4 extraout_r1_00;
undefined4 extraout_r1_01;
undefined4 extraout_r1_02;
undefined4 extraout_r1_03;
undefined uVar3;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr2;
undefined4 in_cr3;
undefined4 in_cr4;
undefined4 in_cr9;
undefined4 in_cr10;
undefined4 in_cr11;
undefined4 in_cr12;
undefined4 in_cr13;
undefined4 in_cr14;
undefined4 in_cr15;
double unaff_d8;
double dVar4;
double dVar5;
double unaff_d12;
double dVar6;
double unaff_d14;
double unaff_d15;
double dVar7;
double in_d18;
double in_d19;
float in_stack_00000000;
float in_stack_00000004;
char in_stack_00000008;
double in_stack_ffffffa0;
double in_stack_ffffffa8;
if (param_1 - 5 < 3) {
uVar1 = 0;
in_d18 = (double)(float)(uint)param_6 / 40.0;
pow(in_stack_ffffffa0,in_stack_ffffffa8);
dVar4 = (double)CONCAT44(extraout_r1,uVar1);
}
else {
uVar1 = 0;
in_d19 = (double)(float)(uint)param_6 / 20.0;
pow(in_stack_ffffffa0,in_stack_ffffffa8);
dVar4 = (double)CONCAT44(extraout_r1_02,uVar1);
}
coprocessor_function(0xb,6,5,in_cr0,in_cr1,in_cr0);
uVar2 = SUB84(6.283185307179586 / (double)in_stack_00000000,0);
uVar1 = uVar2;
sin(in_stack_ffffffa0);
dVar6 = (double)CONCAT44(extraout_r1_00,uVar1);
cos(in_stack_ffffffa0);
dVar5 = (double)CONCAT44(extraout_r1_01,uVar2);
uVar3 = param_1 - 6 == 1;
if (param_1 - 6 < 2) {
in_d19 = 1.0 / (double)in_stack_00000004;
if (!(bool)uVar3) {
sqrt(in_stack_ffffffa0);
}
dVar7 = SQRT(dVar4);
in_d18 = 0.5;
coprocessor_function(0xb,2,1,in_cr13,in_cr13,in_cr2);
coprocessor_function(0xb,2,1,in_cr13,in_cr13,in_cr1);
if (!(bool)uVar3) {
uVar1 = SUB84(dVar4,0);
sqrt(in_stack_ffffffa0);
dVar7 = (double)CONCAT44(extraout_r1_03,uVar1);
}
dVar7 = dVar7 + dVar7;
coprocessor_function(0xb,6,4,in_cr0,in_cr0,in_cr13);
}
else {
if (in_stack_00000008 == '\0') {
dVar7 = -1.0;
dVar6 = dVar6 / ((double)in_stack_00000004 + (double)in_stack_00000004);
}
else {
coprocessor_function(0xb,6,5,in_cr0,in_cr1,in_cr0);
coprocessor_function(0xb,2,4,in_cr9,in_cr0,in_cr9);
sinh(in_stack_ffffffa0);
dVar7 = -1.0;
coprocessor_function(0xb,2,4,in_cr13,in_cr1,in_cr13);
}
}
switch(param_1) {
case 0:
unaff_d12 = 1.0 - dVar5;
coprocessor_function(0xb,2,0,in_cr14,in_cr12,in_cr14);
goto LAB_00066c34;
case 1:
coprocessor_function(0xb,2,0,in_cr14,in_cr12,in_cr14);
unaff_d12 = 0.0 - (dVar5 + 1.0);
LAB_00066c34:
unaff_d8 = dVar6 + 1.0;
unaff_d14 = 0.5;
coprocessor_function(0xb,6,1,in_cr3,in_cr11,in_cr1);
in_stack_ffffffa8 = 1.0 - dVar6;
unaff_d15 = 0.5;
in_stack_ffffffa0 = in_d19;
break;
case 2:
coprocessor_function(0xb,6,1,in_cr2,in_cr11,in_cr1);
in_stack_ffffffa8 = 1.0 - dVar6;
unaff_d8 = dVar6 + 1.0;
unaff_d15 = 0.0 - dVar6;
unaff_d12 = 0.0;
unaff_d14 = dVar6;
in_stack_ffffffa0 = in_d18;
break;
case 3:
unaff_d12 = -2.0;
unaff_d15 = 1.0;
coprocessor_function(0xb,2,0,in_cr12,in_cr11,in_cr12);
in_stack_ffffffa8 = 1.0 - dVar6;
unaff_d8 = dVar6 + 1.0;
unaff_d14 = unaff_d15;
in_stack_ffffffa0 = -2.0;
break;
case 4:
unaff_d12 = -2.0;
coprocessor_function(0xb,2,0,in_cr12,in_cr11,in_cr12);
in_stack_ffffffa8 = 1.0 - dVar6;
unaff_d8 = dVar6 + 1.0;
unaff_d14 = in_stack_ffffffa8;
unaff_d15 = unaff_d8;
in_stack_ffffffa0 = -2.0;
break;
case 5:
unaff_d12 = -2.0;
coprocessor_function(0xb,2,0,in_cr13,in_cr13,in_cr10);
coprocessor_function(0xb,2,0,in_cr12,in_cr11,in_cr12);
in_stack_ffffffa8 = 1.0 - dVar6 / dVar4;
unaff_d8 = dVar6 / dVar4 + 1.0;
unaff_d14 = dVar6 + 1.0;
unaff_d15 = 1.0 - dVar6;
in_stack_ffffffa0 = -2.0;
break;
case 6:
unaff_d12 = dVar4 + dVar4;
coprocessor_function(0xb,6,4,in_cr3,in_cr1,in_cr11);
coprocessor_function(0xb,2,1,in_cr11,in_cr11,in_cr2);
dVar5 = (dVar4 + 1.0) - in_d19;
in_d19 = dVar4 + 1.0 + in_d19;
unaff_d8 = in_d19 + dVar7;
coprocessor_function(0xb,2,1,in_cr12,in_cr12,in_cr3);
in_stack_ffffffa8 = in_d19 - dVar7;
coprocessor_function(0xb,6,1,in_cr0,in_cr11,in_cr4);
coprocessor_function(0xb,2,0,in_cr14,in_cr14,in_cr10);
coprocessor_function(0xb,2,0,in_cr15,in_cr15,in_cr10);
unaff_d14 = dVar5 + dVar7;
unaff_d15 = dVar5 - dVar7;
in_stack_ffffffa0 = dVar7;
break;
case 7:
unaff_d12 = -2.0;
coprocessor_function(0xb,6,4,in_cr3,in_cr1,in_cr11);
coprocessor_function(0xb,2,1,in_cr11,in_cr11,in_cr2);
coprocessor_function(0xb,2,0,in_cr12,in_cr10,in_cr12);
dVar6 = dVar4 + 1.0 + in_d19;
in_d19 = (dVar4 + 1.0) - in_d19;
dVar5 = (dVar4 - 1.0) - dVar5;
unaff_d8 = in_d19 + dVar7;
coprocessor_function(0xb,2,1,in_cr12,in_cr12,in_cr3);
in_stack_ffffffa8 = in_d19 - dVar7;
coprocessor_function(0xb,2,0,in_cr14,in_cr14,in_cr10);
coprocessor_function(0xb,2,0,in_cr15,in_cr15,in_cr10);
unaff_d14 = dVar6 + dVar7;
unaff_d15 = dVar6 - dVar7;
in_stack_ffffffa0 = dVar5 + dVar5;
}
this->field_0x14 = 0;
this->field_0x18 = 0;
this->field_0x1c = 0;
this->field_0x20 = 0;
this->field_0x8 = SUB84(ROUND(((0.0 - in_stack_ffffffa0) / unaff_d8) * 33554432.0 + 0.5),0);
this->field_0xc = SUB84(ROUND(((0.0 - in_stack_ffffffa8) / unaff_d8) * 33554432.0 + 0.5),0);
this->field_0x10 = SUB84(ROUND((unaff_d14 / unaff_d8) * 33554432.0 + 0.5),0);
this->field_0x0 = SUB84(ROUND((unaff_d12 / unaff_d8) * 33554432.0 + 0.5),0);
this->field_0x4 = SUB84(ROUND((unaff_d15 / unaff_d8) * 33554432.0 + 0.5),0);
return;
}
// MultiBiquad::ProcessSample(int)
uint MultiBiquad::ProcessSample(int param_1) {
longlong lVar1;
uint uVar2;
int iVar3;
int iVar4;
int iVar5;
iVar3 = this->field_0x14;
iVar5 = this->field_0x18;
iVar4 = this->field_0x20;
this->field_0x18 = iVar3;
this->field_0x14 = param_1;
this->field_0x20 = this->field_0x1c;
lVar1 = (longlong)(int)this->field_0xc * (longlong)iVar4 +
(longlong)(int)this->field_0x8 * (longlong)(int)this->field_0x1c +
(longlong)(int)this->field_0x4 * (longlong)iVar5 +
(longlong)(int)this->field_0x10 * (longlong)param_1 +
(longlong)(int)this->field_0x0 * (longlong)iVar3;
uVar2 = (uint)lVar1;
uVar2 = uVar2 + 0x1000000 >> 0x19 |
((int)((ulonglong)lVar1 >> 0x20) + (uint)(0xfeffffff < uVar2)) * 0x80;
this->field_0x1c = uVar2;
return uVar2;
}

27
src/util/MultiBiquad.h Normal file
View File

@ -0,0 +1,27 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_MULTIBIQUAD_H
#define VIPER_MULTIBIQUAD_H
class MultiBiquad {
undefined4 field_0x0;
undefined4 field_0x4;
undefined4 field_0x8;
undefined4 field_0xc;
undefined4 field_0x10;
undefined4 field_0x14;
undefined4 field_0x18;
undefined4 field_0x1c;
undefined4 field_0x20;
public:
MultiBiquad();
void RefreshFilter(dword param_1,float param_2,float param_3,float param_4,float param_5,bool param_6);
uint ProcessSample(int param_1);
};
#endif //VIPER_MULTIBIQUAD_H

View File

@ -0,0 +1,141 @@
//
// Created by mart on 2/13/21.
//
#include "NoiseSharpening.h"
// NoiseSharpening::Reset()
void NoiseSharpening::Reset(void) {
IIR_1st *in_r0;
float in_s0;
float in_s1;
undefined8 uVar1;
IIR_1st::setLPF_BW(in_r0,in_s0,in_s1);
uVar1 = IIR_1st::Mute(in_r0);
IIR_1st::setLPF_BW(in_r0 + 1,(float)uVar1,(float)((ulonglong)uVar1 >> 0x20));
IIR_1st::Mute(in_r0 + 1);
in_r0[2].field_0x0 = 0.0;
in_r0[2].field_0x4 = 0.0;
return;
}
// NoiseSharpening::NoiseSharpening()
NoiseSharpening::NoiseSharpening() {
IIR_1st::IIR_1st((IIR_1st *)this);
IIR_1st::IIR_1st((IIR_1st *)(this + 0x10));
*(undefined4 *)(this + 0x2c) = 0xac44;
*(undefined4 *)(this + 0x28) = 0;
Reset();
return this;
}
// NoiseSharpening::SetSamplingRate(int)
void NoiseSharpening::SetSamplingRate(int param_1) {
if (*(int *)(this + 0x2c) == param_1) {
return;
}
*(int *)(this + 0x2c) = param_1;
Reset();
return;
}
// NoiseSharpening::SetGain(float)
void NoiseSharpening::SetGain(float param_1) {
float in_r1;
*(float *)(this + 0x28) = ROUND(in_r1 * 3.355443e+07 + 0.5);
return;
}
// NoiseSharpening::Process(int*, int)
void NoiseSharpening::Process(int *param_1,int param_2) {
longlong lVar1;
int iVar2;
int *piVar3;
int iVar4;
int iVar5;
int *piVar6;
int *piVar7;
bool bVar8;
undefined8 uVar9;
int local_28;
if (0 < param_2) {
iVar4 = *param_1;
iVar2 = *(int *)(this + 0x20);
*(int *)(this + 0x20) = iVar4;
iVar5 = param_1[1];
lVar1 = (longlong)(iVar4 - iVar2) * (longlong)*(int *)(this + 0x28) + 0x1000000;
bVar8 = param_2 * 2 != 2;
*param_1 = *param_1 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
iVar2 = *(int *)(this + 0x24);
*(int *)(this + 0x24) = iVar5;
piVar6 = (int *)(iVar5 - iVar2);
piVar3 = (int *)param_1[1];
lVar1 = (longlong)(int)piVar6 * (longlong)*(int *)(this + 0x28) + 0x1000000;
if (bVar8) {
piVar6 = param_1;
}
iVar2 = (int)piVar3 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
if (bVar8) {
piVar3 = param_1 + param_2 * 2;
}
param_1[1] = iVar2;
if (bVar8) {
do {
iVar2 = piVar6[2];
iVar4 = *(int *)(this + 0x20);
piVar7 = piVar6 + 2;
*(int *)(this + 0x20) = iVar2;
iVar5 = piVar6[3];
lVar1 = (longlong)(iVar2 - iVar4) * (longlong)*(int *)(this + 0x28) + 0x1000000;
*piVar7 = *piVar7 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
iVar2 = *(int *)(this + 0x24);
*(int *)(this + 0x24) = iVar5;
lVar1 = (longlong)(iVar5 - iVar2) * (longlong)*(int *)(this + 0x28) + 0x1000000;
piVar6[3] = piVar6[3] + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
piVar6 = piVar7;
} while (piVar7 != piVar3 + -2);
}
iVar2 = 0;
piVar6 = param_1 + 1;
do {
iVar2 = iVar2 + 2;
lVar1 = (longlong)piVar6[-1] * (longlong)*(int *)(this + 4) + 0x1000000;
iVar4 = *(int *)(this + 0xc) + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar4 * (longlong)*(int *)this + 0x1000000;
uVar9 = VectorShiftRight((longlong)piVar6[-1] * (longlong)*(int *)(this + 8) + 0x1000000,0x19)
;
local_28 = (int)uVar9;
*(uint *)(this + 0xc) =
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) + local_28;
piVar6[-1] = iVar4;
lVar1 = (longlong)param_1[1] * (longlong)*(int *)(this + 0x14) + 0x1000000;
iVar4 = *(int *)(this + 0x1c) + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar4 * (longlong)*(int *)(this + 0x10) + 0x1000000;
uVar9 = VectorShiftRight((longlong)param_1[1] * (longlong)*(int *)(this + 0x18) + 0x1000000,
0x19);
local_28 = (int)uVar9;
*(uint *)(this + 0x1c) =
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) + local_28;
param_1[1] = iVar4;
param_1 = param_1 + 2;
piVar6 = piVar6 + 2;
} while (iVar2 + param_2 * -2 < 0 != SBORROW4(iVar2,param_2 * 2));
}
return;
}

View File

@ -0,0 +1,26 @@
//
// Created by mart on 2/13/21.
//
#ifndef VIPER_NOISESHARPENING_H
#define VIPER_NOISESHARPENING_H
class NoiseSharpening {
struct IIR_1st field_0x0;
struct IIR_1st field_0x10;
int field_0x20;
int field_0x24;
int field_0x28;
int field_0x2c;
public:
void Reset();
NoiseSharpening();
void SetSamplingRate(int param_1);
void SetGain(float param_1);
void Process(int *param_1,int param_2);
};
#endif //VIPER_NOISESHARPENING_H

3318
src/util/PConvSingle_F32.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_PCONVSINGLE_F32_H
#define VIPER_PCONVSINGLE_F32_H
class PConvSingle_F32 {
bool field_0x0;
char field_0x1;
char field_0x2;
char field_0x3;
int field_0x4;
int field_0x8;
void* field_0xc;
public:
void PConvSingle_F32();
void ReleaseResources();
~PConvSingle_F32();
undefined4 ProcessKernel(float *param_1,int param_2,int param_3);
undefined4 ProcessKernel(float *param_1,float param_2,int param_3,int param_4);
void ConvSegment(float *param_1,bool param_2,int param_3);
void Reset();
int GetFFTSize();
undefined4 GetSegmentSize();
undefined4 GetSegmentCount();
void UnloadKernel();
int LoadKernel(float *param_1,int param_2,int param_3);
int LoadKernel(float *param_1,float param_2,int param_3,int param_4);
PConvSingle_F32 InstanceUsable();
void Convolve(float *param_1);
void ConvolveInterleaved(float *param_1,int param_2);
};
#endif //VIPER_PCONVSINGLE_F32_H

209
src/util/PassFilter.cpp Normal file
View File

@ -0,0 +1,209 @@
//
// Created by mart on 2/13/21.
//
#include "PassFilter.h"
// PassFilter::~PassFilter()
PassFilter::~PassFilter() {
IIR_NOrder_BW_LH *pIVar1;
pIVar1 = this->field_0x0;
if (pIVar1 != nullptr) {
IIR_NOrder_BW_LH::~IIR_NOrder_BW_LH(pIVar1);
operator_delete(pIVar1);
}
pIVar1 = this->field_0x4;
if (pIVar1 != nullptr) {
IIR_NOrder_BW_LH::~IIR_NOrder_BW_LH(pIVar1);
operator_delete(pIVar1);
}
pIVar1 = this->field_0x8;
if (pIVar1 != nullptr) {
IIR_NOrder_BW_LH::~IIR_NOrder_BW_LH(pIVar1);
operator_delete(pIVar1);
}
pIVar1 = this->field_0xc;
if (pIVar1 != nullptr) {
IIR_NOrder_BW_LH::~IIR_NOrder_BW_LH(pIVar1);
operator_delete(pIVar1);
}
return this;
}
// PassFilter::Reset()
void PassFilter::Reset(void) {
IIR_NOrder_BW_LH **in_r0;
float in_s0;
float in_s1;
undefined8 uVar1;
uVar1 = CONCAT44(in_s1,in_s0);
if ((*in_r0 != nullptr) && (in_r0[1] != nullptr)) {
if ((int)in_r0[4] < 0xac44) {
FixedToFP(&in_r0[4][-0xd].field_0x4,0x20,0x20,1,0,0);
}
uVar1 = IIR_NOrder_BW_LH::setLPF(*in_r0,in_s0,in_s1);
IIR_NOrder_BW_LH::setLPF(in_r0[1],(float)uVar1,(float)((ulonglong)uVar1 >> 0x20));
IIR_NOrder_BW_LH::Mute(*in_r0);
uVar1 = IIR_NOrder_BW_LH::Mute(in_r0[1]);
}
if ((in_r0[2] != nullptr) && (in_r0[3] != nullptr)) {
uVar1 = IIR_NOrder_BW_LH::setHPF(in_r0[2],(float)uVar1,(float)((ulonglong)uVar1 >> 0x20));
IIR_NOrder_BW_LH::setHPF(in_r0[3],(float)uVar1,(float)((ulonglong)uVar1 >> 0x20));
IIR_NOrder_BW_LH::Mute(in_r0[2]);
IIR_NOrder_BW_LH::Mute(in_r0[3]);
return;
}
return;
}
// PassFilter::PassFilter()
PassFilter::PassFilter() {
IIR_NOrder_BW_LH *pIVar1;
pIVar1 = (IIR_NOrder_BW_LH *)operator_new(8);
IIR_NOrder_BW_LH::IIR_NOrder_BW_LH(pIVar1,3);
this->field_0x0 = pIVar1;
pIVar1 = (IIR_NOrder_BW_LH *)operator_new(8);
IIR_NOrder_BW_LH::IIR_NOrder_BW_LH(pIVar1,3);
this->field_0x4 = pIVar1;
pIVar1 = (IIR_NOrder_BW_LH *)operator_new(8);
IIR_NOrder_BW_LH::IIR_NOrder_BW_LH(pIVar1,1);
this->field_0x8 = pIVar1;
pIVar1 = (IIR_NOrder_BW_LH *)operator_new(8);
IIR_NOrder_BW_LH::IIR_NOrder_BW_LH(pIVar1,1);
this->field_0xc = pIVar1;
this->samplerate = 0xac44;
Reset();
return this;
}
// PassFilter::SetSamplingRate(int)
void PassFilter::SetSamplingRate(int param_1) {
if (this->samplerate == param_1) {
return;
}
this->samplerate = param_1;
Reset();
return;
}
// PassFilter::ProcessFrames(int*, int)
void PassFilter::ProcessFrames(int *param_1,int param_2) {
longlong lVar1;
longlong lVar2;
IIR_NOrder_BW_LH *pIVar3;
IIR_NOrder_BW_LH *pIVar4;
IIR_1st *pIVar5;
IIR_NOrder_BW_LH *pIVar6;
IIR_1st *pIVar7;
int iVar8;
IIR_NOrder_BW_LH *pIVar9;
IIR_1st *pIVar10;
int iVar11;
IIR_1st *pIVar12;
int iVar13;
int *piVar14;
IIR_1st *pIVar15;
IIR_1st *pIVar16;
int local_4c;
int *local_48;
int *local_44;
if ((((0 < param_2) && (pIVar4 = this->field_0x0, pIVar4 != nullptr)) &&
(pIVar6 = this->field_0x4, pIVar6 != nullptr)) &&
((pIVar9 = this->field_0x8, pIVar9 != nullptr && (pIVar3 = this->field_0xc, pIVar3 != nullptr)))) {
pIVar12 = pIVar9->field_0x0;
local_44 = param_1 + 2;
pIVar5 = pIVar4->field_0x0;
pIVar7 = pIVar3->field_0x0;
pIVar10 = pIVar6->field_0x0;
local_4c = param_2 + -1;
piVar14 = local_44;
local_48 = param_1;
while( true ) {
iVar8 = piVar14[-2];
iVar13 = local_48[1];
if ((pIVar12 != nullptr) && (iVar11 = pIVar9->field_0x4, 0 < iVar11)) {
pIVar16 = pIVar12;
do {
lVar1 = (longlong)iVar8 * (longlong)(int)pIVar16->field_0x4 + 0x1000000;
pIVar15 = pIVar16 + 1;
lVar2 = (longlong)iVar8 * (longlong)(int)pIVar16->field_0x8 + 0x1000000;
iVar8 = pIVar16->field_0xc + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar8 * (longlong)(int)pIVar16->field_0x0 + 0x1000000;
pIVar16->field_0xc =
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
pIVar16 = pIVar15;
} while (pIVar15 != pIVar12 + iVar11);
}
if ((pIVar5 != nullptr) && (iVar11 = pIVar4->field_0x4, 0 < iVar11)) {
pIVar16 = pIVar5;
do {
pIVar15 = pIVar16 + 1;
lVar1 = (longlong)iVar8 * (longlong)(int)pIVar16->field_0x4 + 0x1000000;
lVar2 = (longlong)iVar8 * (longlong)(int)pIVar16->field_0x8 + 0x1000000;
iVar8 = pIVar16->field_0xc + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
lVar1 = (longlong)iVar8 * (longlong)(int)pIVar16->field_0x0 + 0x1000000;
pIVar16->field_0xc =
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
pIVar16 = pIVar15;
} while (pIVar15 != pIVar5 + iVar11);
}
if ((pIVar7 != nullptr) && (iVar11 = pIVar3->field_0x4, 0 < iVar11)) {
pIVar16 = pIVar7;
do {
pIVar15 = pIVar16 + 1;
lVar1 = (longlong)iVar13 * (longlong)(int)pIVar16->field_0x4 + 0x1000000;
lVar2 = (longlong)iVar13 * (longlong)(int)pIVar16->field_0x8 + 0x1000000;
iVar13 = pIVar16->field_0xc + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)
;
lVar1 = (longlong)iVar13 * (longlong)(int)pIVar16->field_0x0 + 0x1000000;
pIVar16->field_0xc =
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
pIVar16 = pIVar15;
} while (pIVar15 != pIVar7 + iVar11);
}
if ((pIVar10 != nullptr) && (iVar11 = pIVar6->field_0x4, 0 < iVar11)) {
pIVar16 = pIVar10;
do {
pIVar15 = pIVar16 + 1;
lVar1 = (longlong)iVar13 * (longlong)(int)pIVar16->field_0x4 + 0x1000000;
lVar2 = (longlong)iVar13 * (longlong)(int)pIVar16->field_0x8 + 0x1000000;
iVar13 = pIVar16->field_0xc + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7)
;
lVar1 = (longlong)iVar13 * (longlong)(int)pIVar16->field_0x0 + 0x1000000;
pIVar16->field_0xc =
((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7) +
((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
pIVar16 = pIVar15;
} while (pIVar15 != pIVar10 + iVar11);
}
local_4c = local_4c + -1;
piVar14[-2] = iVar8;
local_48[1] = iVar13;
local_48 = local_44;
if (local_4c == -1) break;
local_44 = local_44 + 2;
piVar14 = piVar14 + 2;
}
}
return;
}

25
src/util/PassFilter.h Normal file
View File

@ -0,0 +1,25 @@
//
// Created by mart on 2/13/21.
//
#ifndef VIPER_PASSFILTER_H
#define VIPER_PASSFILTER_H
class PassFilter {
struct IIR_NOrder_BW_LH * field_0x0;
struct IIR_NOrder_BW_LH * field_0x4;
struct IIR_NOrder_BW_LH * field_0x8;
struct IIR_NOrder_BW_LH * field_0xc;
undefined4 samplerate;
public:
~PassFilter();
void Reset();
PassFilter();
void SetSamplingRate(int param_1);
void ProcessFrames(int *param_1,int param_2);
};
#endif //VIPER_PASSFILTER_H

216
src/util/PolesFilter.cpp Normal file
View File

@ -0,0 +1,216 @@
//
// Created by mart on 2/12/21.
//
#include "PolesFilter.h"
// PolesFilter::UpdateCoeff()
void PolesFilter::UpdateCoeff() {
undefined4 extraout_r1;
undefined4 extraout_r1_00;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr10;
undefined4 in_cr11;
undefined4 uVar1;
undefined4 uVar2;
double unaff_d8;
double dVar3;
undefined4 in_d17;
memset(this,0,0x34);
memset(&this->field_0x34,0,0x34);
coprocessor_function(0xb,6,4,in_cr1,in_cr0,in_cr10);
sin(unaff_d8);
dVar3 = (double)CONCAT44(extraout_r1,in_d17) + (double)CONCAT44(extraout_r1,in_d17);
uVar1 = SUB84(ROUND(dVar3 * 33554432.0 + 0.5),0);
this->field_0x0 = uVar1;
coprocessor_function(0xb,6,0,in_cr0,in_cr11,in_cr10);
uVar2 = SUB84(dVar3,0);
sin(unaff_d8);
this->field_0x34 = uVar1;
uVar2 = SUB84(ROUND(((double)CONCAT44(extraout_r1_00,uVar2) +
(double)CONCAT44(extraout_r1_00,uVar2)) * 33554432.0 + 0.5),0);
this->field_0x4 = uVar2;
this->field_0x38 = uVar2;
return;
}
// PolesFilter::PolesFilter()
PolesFilter::PolesFilter() {
this->samplerate = 0xac44;
this->field_0x68 = 0xa0;
this->field_0x6c = 8000;
UpdateCoeff(this);
return this;
}
// PolesFilter::DoFilterLeft(int, int*, int*, int*)
void PolesFilter::DoFilterLeft(int param_1,int *param_2,int *param_3,int *param_4) {
longlong lVar1;
longlong lVar2;
int iVar3;
undefined4 uVar4;
int iVar5;
undefined4 uVar6;
int iVar7;
int iVar8;
iVar7 = *(int *)&this->field_0x10;
iVar8 = this->field_0x4;
lVar1 = (longlong)iVar8 * (longlong)(param_1 - *(int *)&this->field_0x24) + 0x1000000;
lVar2 = (longlong)(int)this->field_0x0 * (longlong)(param_1 - *(int *)&this->field_0x14) +
0x1000000;
uVar6 = *(undefined4 *)&this->field_0x8;
*(int *)&this->field_0x8 = param_1;
uVar4 = *(undefined4 *)&this->field_0xc;
*(undefined4 *)&this->field_0xc = uVar6;
iVar5 = *(int *)&this->field_0x24 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
*(undefined4 *)&this->field_0x10 = uVar4;
*(int *)&this->field_0x24 = iVar5;
iVar3 = *(int *)&this->field_0x14 + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
lVar1 = (longlong)iVar8 * (longlong)(iVar5 - *(int *)&this->field_0x28) + 0x1000000;
*(int *)&this->field_0x14 = iVar3;
lVar2 = (longlong)(int)this->field_0x0 * (longlong)(iVar3 - *(int *)&this->field_0x18) + 0x1000000
;
iVar3 = *(int *)&this->field_0x28 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
*(int *)&this->field_0x28 = iVar3;
lVar1 = (longlong)iVar8 * (longlong)(iVar3 - *(int *)&this->field_0x2c) + 0x1000000;
iVar3 = *(int *)&this->field_0x18 + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
lVar2 = (longlong)(int)this->field_0x0 * (longlong)(iVar3 - *(int *)&this->field_0x1c) + 0x1000000
;
*(int *)&this->field_0x18 = iVar3;
iVar3 = *(int *)&this->field_0x2c + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
*(int *)&this->field_0x2c = iVar3;
lVar1 = (longlong)iVar8 * (longlong)(iVar3 - *(int *)&this->field_0x30) + 0x1000000;
iVar3 = *(int *)&this->field_0x1c + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
*(int *)&this->field_0x1c = iVar3;
lVar2 = (longlong)(int)this->field_0x0 * (longlong)(iVar3 - *(int *)&this->field_0x20) + 0x1000000
;
iVar3 = *(int *)&this->field_0x30 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
*(int *)&this->field_0x30 = iVar3;
iVar3 = iVar7 - iVar3;
iVar5 = *(int *)&this->field_0x20 + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
*(int *)&this->field_0x20 = iVar5;
*param_2 = iVar5;
*param_3 = iVar3;
*param_4 = iVar7 - (iVar5 + iVar3);
return;
}
// PolesFilter::DoFilterRight(int, int*, int*, int*)
void PolesFilter::DoFilterRight(int param_1,int *param_2,int *param_3,int *param_4) {
longlong lVar1;
longlong lVar2;
int iVar3;
undefined4 uVar4;
int iVar5;
undefined4 uVar6;
int iVar7;
int iVar8;
iVar7 = *(int *)&this->field_0x44;
iVar8 = this->field_0x38;
lVar1 = (longlong)iVar8 * (longlong)(param_1 - *(int *)&this->field_0x58) + 0x1000000;
lVar2 = (longlong)(int)this->field_0x34 * (longlong)(param_1 - *(int *)&this->field_0x48) +
0x1000000;
uVar6 = *(undefined4 *)&this->field_0x3c;
*(int *)&this->field_0x3c = param_1;
uVar4 = *(undefined4 *)&this->field_0x40;
*(undefined4 *)&this->field_0x40 = uVar6;
iVar5 = *(int *)&this->field_0x58 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
*(undefined4 *)&this->field_0x44 = uVar4;
*(int *)&this->field_0x58 = iVar5;
iVar3 = *(int *)&this->field_0x48 + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
lVar1 = (longlong)iVar8 * (longlong)(iVar5 - *(int *)&this->field_0x5c) + 0x1000000;
*(int *)&this->field_0x48 = iVar3;
lVar2 = (longlong)(int)this->field_0x34 * (longlong)(iVar3 - *(int *)&this->field_0x4c) +
0x1000000;
iVar3 = *(int *)&this->field_0x5c + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
*(int *)&this->field_0x5c = iVar3;
lVar1 = (longlong)iVar8 * (longlong)(iVar3 - *(int *)&this->field_0x60) + 0x1000000;
iVar3 = *(int *)&this->field_0x4c + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
lVar2 = (longlong)(int)this->field_0x34 * (longlong)(iVar3 - *(int *)&this->field_0x50) +
0x1000000;
*(int *)&this->field_0x4c = iVar3;
iVar3 = *(int *)&this->field_0x60 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
*(int *)&this->field_0x60 = iVar3;
lVar1 = (longlong)iVar8 * (longlong)(iVar3 - *(int *)&this->field_0x64) + 0x1000000;
iVar3 = *(int *)&this->field_0x50 + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
*(int *)&this->field_0x50 = iVar3;
lVar2 = (longlong)(int)this->field_0x34 * (longlong)(iVar3 - *(int *)&this->field_0x54) +
0x1000000;
iVar3 = *(int *)&this->field_0x64 + ((uint)lVar1 >> 0x19 | (int)((ulonglong)lVar1 >> 0x20) << 7);
*(int *)&this->field_0x64 = iVar3;
iVar3 = iVar7 - iVar3;
iVar5 = *(int *)&this->field_0x54 + ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7);
*(int *)&this->field_0x54 = iVar5;
*param_2 = iVar5;
*param_3 = iVar3;
*param_4 = iVar7 - (iVar5 + iVar3);
return;
}
// PolesFilter::SetSamplingRate(int)
void PolesFilter::SetSamplingRate(int param_1) {
this->samplerate = param_1;
UpdateCoeff(this);
return;
}
// PolesFilter::SetPassFilter(int, int)
void PolesFilter::SetPassFilter(int param_1,int param_2) {
this->field_0x68 = param_1;
this->field_0x6c = param_2;
UpdateCoeff(this);
return;
}
void PolesFilter::~ZN11PolesFilter5ResetEv() {
undefined4 extraout_r1;
undefined4 extraout_r1_00;
undefined4 in_cr0;
undefined4 in_cr1;
undefined4 in_cr10;
undefined4 in_cr11;
undefined4 uVar1;
undefined4 uVar2;
double unaff_d8;
double dVar3;
undefined4 in_d17;
memset(this,0,0x34);
memset(&this->field_0x34,0,0x34);
coprocessor_function(0xb,6,4,in_cr1,in_cr0,in_cr10);
sin(unaff_d8);
dVar3 = (double)CONCAT44(extraout_r1,in_d17) + (double)CONCAT44(extraout_r1,in_d17);
uVar1 = SUB84(ROUND(dVar3 * 33554432.0 + 0.5),0);
this->field_0x0 = uVar1;
coprocessor_function(0xb,6,0,in_cr0,in_cr11,in_cr10);
uVar2 = SUB84(dVar3,0);
sin(unaff_d8);
this->field_0x34 = uVar1;
uVar2 = SUB84(ROUND(((double)CONCAT44(extraout_r1_00,uVar2) +
(double)CONCAT44(extraout_r1_00,uVar2)) * 33554432.0 + 0.5),0);
this->field_0x4 = uVar2;
this->field_0x38 = uVar2;
return;
}

117
src/util/PolesFilter.h Normal file
View File

@ -0,0 +1,117 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_POLESFILTER_H
#define VIPER_POLESFILTER_H
class PolesFilter {
undefined4 field_0x0;
undefined4 field_0x4;
undefined field_0x8;
undefined field_0x9;
undefined field_0xa;
undefined field_0xb;
undefined field_0xc;
undefined field_0xd;
undefined field_0xe;
undefined field_0xf;
undefined field_0x10;
undefined field_0x11;
undefined field_0x12;
undefined field_0x13;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined field_0x18;
undefined field_0x19;
undefined field_0x1a;
undefined field_0x1b;
undefined field_0x1c;
undefined field_0x1d;
undefined field_0x1e;
undefined field_0x1f;
undefined field_0x20;
undefined field_0x21;
undefined field_0x22;
undefined field_0x23;
undefined field_0x24;
undefined field_0x25;
undefined field_0x26;
undefined field_0x27;
undefined field_0x28;
undefined field_0x29;
undefined field_0x2a;
undefined field_0x2b;
undefined field_0x2c;
undefined field_0x2d;
undefined field_0x2e;
undefined field_0x2f;
undefined field_0x30;
undefined field_0x31;
undefined field_0x32;
undefined field_0x33;
undefined4 field_0x34;
undefined4 field_0x38;
undefined field_0x3c;
undefined field_0x3d;
undefined field_0x3e;
undefined field_0x3f;
undefined field_0x40;
undefined field_0x41;
undefined field_0x42;
undefined field_0x43;
undefined field_0x44;
undefined field_0x45;
undefined field_0x46;
undefined field_0x47;
undefined field_0x48;
undefined field_0x49;
undefined field_0x4a;
undefined field_0x4b;
undefined field_0x4c;
undefined field_0x4d;
undefined field_0x4e;
undefined field_0x4f;
undefined field_0x50;
undefined field_0x51;
undefined field_0x52;
undefined field_0x53;
undefined field_0x54;
undefined field_0x55;
undefined field_0x56;
undefined field_0x57;
undefined field_0x58;
undefined field_0x59;
undefined field_0x5a;
undefined field_0x5b;
undefined field_0x5c;
undefined field_0x5d;
undefined field_0x5e;
undefined field_0x5f;
undefined field_0x60;
undefined field_0x61;
undefined field_0x62;
undefined field_0x63;
undefined field_0x64;
undefined field_0x65;
undefined field_0x66;
undefined field_0x67;
undefined4 field_0x68;
undefined4 field_0x6c;
undefined4 samplerate;
public:
void UpdateCoeff();
PolesFilter();
void DoFilterLeft(int param_1,int *param_2,int *param_3,int *param_4);
void DoFilterRight(int param_1,int *param_2,int *param_3,int *param_4);
void SetSamplingRate(int param_1);
void SetPassFilter(int param_1,int param_2);
void ~ZN11PolesFilter5ResetEv();
};
#endif //VIPER_POLESFILTER_H

160
src/util/Polyphase.cpp Normal file
View File

@ -0,0 +1,160 @@
//
// Created by mart on 2/12/21.
//
#include "Polyphase.h"
// Polyphase::Polyphase(int)
Polyphase::Polyphase(int param_1) {
FIR *pFVar1;
WaveBuffer_I32 *pWVar2;
void *pvVar3;
int iVar4;
int *piVar5;
*(undefined4 *)(this + 0x18) = 0xac44;
*(undefined4 *)this = 0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
*(undefined4 *)(this + 0xc) = 0;
*(undefined4 *)(this + 0x10) = 0;
this[0x14] = (Polyphase)0x0;
if (param_1 - 1U < 2) {
pFVar1 = (FIR *)operator_new(0x60);
FIR::FIR(pFVar1);
*(FIR **)this = pFVar1;
pFVar1 = (FIR *)operator_new(0x60);
FIR::FIR(pFVar1);
*(FIR **)(this + 4) = pFVar1;
pWVar2 = (WaveBuffer_I32 *)operator_new(0x20);
WaveBuffer_I32::WaveBuffer_I32(pWVar2,2,0x1000);
*(WaveBuffer_I32 **)(this + 8) = pWVar2;
pWVar2 = (WaveBuffer_I32 *)operator_new(0x20);
WaveBuffer_I32::WaveBuffer_I32(pWVar2,2,0x1000);
*(WaveBuffer_I32 **)(this + 0xc) = pWVar2;
pvVar3 = valloc(0x1f80);
pFVar1 = *(FIR **)this;
*(void **)(this + 0x10) = pvVar3;
if ((((pFVar1 != nullptr) && (*(int *)(this + 4) != 0)) && (*(int *)(this + 8) != 0)) &&
((*(int *)(this + 0xc) != 0 && (pvVar3 != nullptr)))) {
if (param_1 == 2) {
piVar5 = (int *)&DAT_000cea28;
iVar4 = FIR::LoadCoefficients(pFVar1,(int *)&DAT_000cea28,0x3f,0x3f0);
}
else {
piVar5 = (int *)&DAT_000ce92c;
iVar4 = FIR::LoadCoefficients(pFVar1,(int *)&DAT_000ce92c,0x3f,0x3f0);
}
if ((iVar4 != 0) &&
(iVar4 = FIR::LoadCoefficients(*(FIR **)(this + 4),piVar5,0x3f,0x3f0), iVar4 != 0)) {
this[0x14] = (Polyphase)0x1;
}
}
}
return this;
}
// Polyphase::~Polyphase()
Polyphase::~Polyphase() {
FIR *pFVar1;
WaveBuffer_I32 *pWVar2;
pFVar1 = *(FIR **)this;
if (pFVar1 != nullptr) {
FIR::~FIR(pFVar1);
operator_delete(pFVar1);
}
pFVar1 = *(FIR **)(this + 4);
if (pFVar1 != nullptr) {
FIR::~FIR(pFVar1);
operator_delete(pFVar1);
}
pWVar2 = *(WaveBuffer_I32 **)(this + 8);
if (pWVar2 != nullptr) {
WaveBuffer_I32::~WaveBuffer_I32(pWVar2);
operator_delete(pWVar2);
}
pWVar2 = *(WaveBuffer_I32 **)(this + 0xc);
if (pWVar2 != nullptr) {
WaveBuffer_I32::~WaveBuffer_I32(pWVar2);
operator_delete(pWVar2);
}
if (*(void **)(this + 0x10) != nullptr) {
free(*(void **)(this + 0x10));
}
return this;
}
// Polyphase::GetLatency()
undefined4 Polyphase::GetLatency(void) {
return 0x3f;
}
// Polyphase::Reset()
void Polyphase::Reset() {
if (*(FIR **)this != nullptr) {
FIR::Reset(*(FIR **)this);
}
if (*(FIR **)(this + 4) != nullptr) {
FIR::Reset(*(FIR **)(this + 4));
}
if (*(WaveBuffer_I32 **)(this + 8) != nullptr) {
WaveBuffer_I32::Reset(*(WaveBuffer_I32 **)(this + 8));
}
if (*(WaveBuffer_I32 **)(this + 0xc) == nullptr) {
return;
}
WaveBuffer_I32::Reset(*(WaveBuffer_I32 **)(this + 0xc));
return;
}
// Polyphase::SetSamplingRate(int)
void Polyphase::SetSamplingRate(int param_1) {
if (*(int *)(this + 0x18) != param_1) {
*(int *)(this + 0x18) = param_1;
}
return;
}
// Polyphase::Process(int*, int)
int Polyphase::Process(int *param_1,int param_2) {
int iVar1;
uint uVar2;
if ((this[0x14] != (Polyphase)0x0) &&
(iVar1 = WaveBuffer_I32::PushSamples(*(WaveBuffer_I32 **)(this + 8),param_1,param_2),
iVar1 != 0)) {
while (uVar2 = WaveBuffer_I32::GetBufferOffset(), 0x3ef < uVar2) {
iVar1 = WaveBuffer_I32::PopSamples
(*(WaveBuffer_I32 **)(this + 8),*(int **)(this + 0x10),0x3f0,false);
if (iVar1 == 0x3f0) {
FIR::FilterSamplesInterleaved(*(FIR **)this,*(int **)(this + 0x10),0x3f0,2);
FIR::FilterSamplesInterleaved
(*(FIR **)(this + 4),(int *)(*(int *)(this + 0x10) + 4),0x3f0,2);
WaveBuffer_I32::PushSamples(*(WaveBuffer_I32 **)(this + 0xc),*(int **)(this + 0x10),0x3f0);
}
}
uVar2 = WaveBuffer_I32::GetBufferOffset();
if (uVar2 < (uint)param_2) {
return 0;
}
WaveBuffer_I32::PopSamples(*(WaveBuffer_I32 **)(this + 0xc),param_1,param_2,true);
}
return param_2;
}

31
src/util/Polyphase.h Normal file
View File

@ -0,0 +1,31 @@
//
// Created by mart on 2/12/21.
//
#ifndef VIPER_POLYPHASE_H
#define VIPER_POLYPHASE_H
class Polyphase {
struct FIR* field_0x0;
struct FIR* field_0x4;
struct WaveBuffer_I32* field_0x8;
struct WaveBuffer_I32* field_0xc;
void* field_0x10;
undefined field_0x14;
undefined field_0x15;
undefined field_0x16;
undefined field_0x17;
undefined4 field_0x18;
public:
Polyphase(int param_1);
~Polyphase();
undefined4 GetLatency();
void Reset();
void SetSamplingRate(int param_1);
int Process(int *param_1,int param_2);
};
#endif //VIPER_POLYPHASE_H

View File

@ -0,0 +1,162 @@
//
// Created by mart on 2/12/21.
//
#include "SoftwareLimiter.h"
// SoftwareLimiter::SetGate(float)
void SoftwareLimiter::SetGate(float param_1) {
float in_r1;
*(float *)&this->field_0x10 = ROUND(in_r1 * 3.355443e+07 + 0.5);
return;
}
// SoftwareLimiter::Process(int)
uint SoftwareLimiter::Process(int param_1) {
char cVar1;
longlong lVar2;
longlong lVar3;
longlong lVar4;
int iVar5;
undefined4 *puVar6;
uint in_r1;
uint uVar7;
int iVar8;
uint uVar9;
uint uVar10;
int iVar11;
uint uVar12;
uint *puVar13;
uVar12 = *(uint *)(param_1 + 0x10);
uVar7 = (in_r1 ^ (int)in_r1 >> 0x1f) - ((int)in_r1 >> 0x1f);
uVar9 = (uint)*(byte *)(param_1 + 0xc24);
if ((int)uVar12 < (int)uVar7) {
if (uVar9 == 0) {
puVar6 = (undefined4 *)(param_1 + 0x41c);
do {
uVar9 = uVar9 + 1;
puVar6 = puVar6 + 1;
*puVar6 = 0;
} while (uVar9 != 0x200);
}
*(undefined *)(param_1 + 0xc24) = 1;
LAB_000677d8:
uVar12 = 8;
uVar9 = *(uint *)(param_1 + 0xc20);
do {
uVar10 = uVar9 ^ 1;
puVar13 = (uint *)(param_1 + 0xc20) + -(2 << (uVar12 & 0xff));
puVar13[uVar9] = uVar7;
uVar9 = (int)uVar9 >> 1;
uVar10 = puVar13[uVar10];
if ((int)uVar7 < (int)uVar10) {
uVar7 = uVar10;
}
uVar12 = uVar12 - 1;
} while (uVar12 != 0);
uVar12 = *(uint *)(param_1 + 0x10);
if ((int)uVar12 < (int)uVar7) {
cVar1 = *(char *)(param_1 + 0xc24);
iVar5 = *(int *)(param_1 + 0x14);
uVar9 = *(int *)(param_1 + 0xc20) + 1U & 0xff;
*(uint *)(param_1 + (*(int *)(param_1 + 0xc20) + 8) * 4) = in_r1;
*(uint *)(param_1 + 0xc20) = uVar9;
uVar9 = *(uint *)(param_1 + (uVar9 + 8) * 4);
if (cVar1 != '\0') {
iVar5 = __aeabi_ldivmod(uVar12 << 0x19,((int)uVar12 >> 0x1f) << 0x19 | uVar12 >> 7,uVar7,
(int)uVar7 >> 0x1f);
}
goto LAB_00067898;
}
*(undefined *)(param_1 + 0xc24) = 0;
}
else {
if (uVar9 != 0) goto LAB_000677d8;
}
iVar5 = *(int *)(param_1 + 0x14);
uVar7 = *(int *)(param_1 + 0xc20) + 1U & 0xff;
*(uint *)(param_1 + (*(int *)(param_1 + 0xc20) + 8) * 4) = in_r1;
*(uint *)(param_1 + 0xc20) = uVar7;
uVar9 = *(uint *)(param_1 + (uVar7 + 8) * 4);
LAB_00067898:
lVar2 = (longlong)*(int *)param_1 * (longlong)*(int *)(param_1 + 0x1c) + 0x1000000;
lVar3 = (longlong)*(int *)(param_1 + 4) * (longlong)iVar5 + 0x1000000;
lVar4 = (longlong)*(int *)(param_1 + 0xc) * (longlong)*(int *)(param_1 + 0x18) + 0x1000000;
iVar11 = ((uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7) +
((uint)lVar3 >> 0x19 | (int)((ulonglong)lVar3 >> 0x20) << 7);
*(int *)(param_1 + 0x1c) = iVar11;
iVar8 = *(int *)(param_1 + 8) + ((uint)lVar4 >> 0x19 | (int)((ulonglong)lVar4 >> 0x20) << 7);
iVar5 = iVar11;
if (iVar8 <= iVar11) {
*(int *)(param_1 + 0x18) = iVar8;
iVar5 = iVar8;
}
lVar2 = (longlong)(int)uVar9 * (longlong)iVar5 + 0x1000000;
if (iVar11 < iVar8) {
*(int *)(param_1 + 0x18) = iVar11;
}
uVar7 = (uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7;
if ((int)((uVar7 ^ (int)uVar7 >> 0x1f) - ((int)uVar7 >> 0x1f)) <= (int)uVar12) {
return uVar7;
}
iVar5 = (uVar9 ^ (int)uVar9 >> 0x1f) - ((int)uVar9 >> 0x1f);
iVar5 = __aeabi_ldivmod(uVar12 << 0x19,((int)uVar12 >> 0x1f) << 0x19 | uVar12 >> 7,iVar5,
iVar5 >> 0x1f);
lVar2 = (longlong)(int)uVar9 * (longlong)iVar5 + 0x1000000;
*(int *)(param_1 + 0x18) = iVar5;
return (uint)lVar2 >> 0x19 | (int)((ulonglong)lVar2 >> 0x20) << 7;
}
// SoftwareLimiter::ResetLimiter()
void SoftwareLimiter::ResetLimiter() {
undefined4 *puVar1;
int iVar2;
iVar2 = 0x100;
puVar1 = (undefined4 *)&this->field_0x1c;
do {
iVar2 = iVar2 + -1;
puVar1 = puVar1 + 1;
*puVar1 = 0;
} while (iVar2 != 0);
puVar1 = (undefined4 *)&this->field_0x41c;
iVar2 = 0x200;
do {
iVar2 = iVar2 + -1;
puVar1 = puVar1 + 1;
*puVar1 = 0;
} while (iVar2 != 0);
*(undefined *)&this->field_0xc24 = 0;
*(undefined4 *)&this->field_0xc20 = 0;
*(undefined4 *)&this->field_0x18 = 0x2000000;
*(undefined4 *)&this->field_0x1c = 0x2000000;
return;
}
// SoftwareLimiter::SoftwareLimiter()
SoftwareLimiter::SoftwareLimiter() {
*(undefined4 *)this = 0x1ccbfb2;
*(undefined4 *)&this->field_0x4 = 0x332618;
*(undefined4 *)&this->field_0x8 = 0xd1c;
*(undefined4 *)&this->field_0xc = 0x1fff2e5;
*(undefined4 *)&this->field_0x10 = 0x1ffffff;
*(undefined *)&this->field_0xc24 = 0;
*(undefined4 *)&this->field_0xc20 = 0;
*(undefined4 *)&this->field_0x18 = 0x2000000;
*(undefined4 *)&this->field_0x1c = 0x2000000;
*(undefined4 *)&this->field_0x14 = 0x2000000;
ResetLimiter(this);
return this;
}

3131
src/util/SoftwareLimiter.h Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More