diff --git a/CMakeLists.txt b/CMakeLists.txt index 807d7d7..cfc8a93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,14 +2,14 @@ cmake_minimum_required(VERSION 3.16.3) set(CMAKE_CXX_COMPILER_VERSION 20) # NDK Settings -#set(ANDROID_ABI arm64-v8a) -set(ANDROID_ABI armeabi-v7a) -set(ANDROID_ARM_NEON true) -set(ANDROID_PLATFORM android-24) +#add_compile_definitions(ANDROID_ABI=arm64-v8a) +#add_compile_definitions(ANDROID_ABI=armeabi-v7a) +#add_compile_definitions(ANDROID_ARM_NEON=true) +#add_compile_definitions(ANDROID_PLATFORM=android-24) project("ViPER4Android") -add_compile_definitions(VERSION_CODE=20221231) -add_compile_definitions(VERSION_NAME="0.1.0") +add_compile_definitions(VERSION_CODE=20230311) +add_compile_definitions(VERSION_NAME="0.3.0") # FFTS add_subdirectory(src/viper/ffts) diff --git a/src/viper/effects/SoftwareLimiter.cpp b/src/viper/effects/SoftwareLimiter.cpp index b73959a..ea2ba94 100644 --- a/src/viper/effects/SoftwareLimiter.cpp +++ b/src/viper/effects/SoftwareLimiter.cpp @@ -15,59 +15,47 @@ SoftwareLimiter::SoftwareLimiter() { float SoftwareLimiter::Process(float sample) { bool bVar1; - float *pfVar2; uint uVar3; uint uVar4; int iVar5; uint uVar6; - uint *puVar7; uint uVar8; float fVar9; float fVar10; - float gate; float abs_sample; - gate = this->gate; abs_sample = std::abs(sample); - if (abs_sample < gate) { + if (abs_sample < this->gate) { if (this->ready) goto LAB_0006d86c; uVar8 = this->unknown4; } else { if (!this->ready) { - iVar5 = 0x200; - pfVar2 = this->arr512; - do { - iVar5 = iVar5 + -1; - *pfVar2 = 0.0; - pfVar2 = pfVar2 + 1; - } while (iVar5 != 0); + memset(this->arr512, 0, sizeof(this->arr512)); + this->ready = true; } - this->ready = true; LAB_0006d86c: uVar3 = 8; - puVar7 = &this->unknown4; - uVar8 = *puVar7; + uVar8 = this->unknown4; uVar4 = uVar8; do { iVar5 = 2 << (uVar3 & 0xff); uVar6 = uVar4 ^ 1; - puVar7[uVar4 - iVar5] = (uint)abs_sample; - uVar4 = (int)uVar4 >> 1; - if (abs_sample < (float)puVar7[uVar6 - iVar5]) { - abs_sample = (float)puVar7[uVar6 - iVar5]; + this->arr512[512 + uVar4 - iVar5] = abs_sample; + uVar4 = uVar4 / 2; + if (abs_sample < this->arr512[512 + uVar6 - iVar5]) { + abs_sample = this->arr512[512 + uVar6 - iVar5]; } uVar3 = uVar3 - 1; } while (uVar3 != 0); - gate = this->gate; - if (gate < abs_sample) { + if (this->gate < abs_sample) { bVar1 = this->ready; fVar10 = this->unknown1; - uVar4 = uVar8 + 1 & 0xff; + uVar4 = (uVar8 + 1) % 256; this->arr256[uVar8] = sample; this->unknown4 = uVar4; if (bVar1) { - fVar10 = gate / abs_sample; + fVar10 = this->gate / abs_sample; } abs_sample = this->arr256[uVar4]; goto LAB_0006d8fc; @@ -76,7 +64,7 @@ LAB_0006d86c: } fVar10 = this->unknown1; this->arr256[uVar8] = sample; - uVar8 = uVar8 + 1 & 0xff; + uVar8 = (uVar8 + 1) % 256; this->unknown4 = uVar8; abs_sample = this->arr256[uVar8]; LAB_0006d8fc: @@ -95,10 +83,10 @@ LAB_0006d8fc: } fVar9 = abs_sample * fVar9; fVar10 = std::abs(fVar9); - if (gate <= fVar10) { - fVar9 = gate / std::abs(abs_sample); + if (this->gate <= fVar10) { + fVar9 = this->gate / std::abs(abs_sample); } - if (gate <= fVar10) { + if (this->gate <= fVar10) { this->unknown2 = fVar9; fVar9 = abs_sample * fVar9; }