0.37.0 (71): one engine, one version for Android and iOS
- Three source trees: core/ (shared C++ engine, moved from ios/core), app/ (Android UI), ios/app/ (iOS UI) - Android plays through core/ via JNI (EngineHost, jni_engine.cpp): the Oboe callback renders natively; the Kotlin model is mirrored as project text and applied as a diff, so playback continues through edits - The Kotlin engine moves to the unit tests as ReferenceEngine (golden reference) - Shared MasterRecorder in core/src/host, used by both apps; host_test - versions.properties: one versionName/versionCode for both platforms, continuing Android's numbering (iOS 0.6.0/11 -> 0.37.0/71) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
64e21e0bcc
commit
2bc5cb1cbb
@@ -0,0 +1,67 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// Port of GraphicEq (Effects.kt): ten peaking biquads at octave-spaced centres.
|
||||
|
||||
#include <cmath>
|
||||
#include "sizzle/Effect.hpp"
|
||||
#include "KotlinMath.hpp"
|
||||
|
||||
namespace sizzle {
|
||||
namespace {
|
||||
|
||||
struct PeakBiquad {
|
||||
double b0 = 1, b1 = 0, b2 = 0, a1 = 0, a2 = 0, z1 = 0, z2 = 0;
|
||||
|
||||
void set(int sampleRate, float freq, float gainDb) {
|
||||
if (freq >= sampleRate * 0.45f) return;
|
||||
double a = std::pow(10.0, gainDb / 40.0);
|
||||
double w0 = 2.0 * M_PI * freq / sampleRate;
|
||||
double cosW = std::cos(w0);
|
||||
double alpha = std::sin(w0) / (2.0 * 1.0);
|
||||
double a0 = 1 + alpha / a;
|
||||
b0 = (1 + alpha * a) / a0;
|
||||
b1 = (-2 * cosW) / a0;
|
||||
b2 = (1 - alpha * a) / a0;
|
||||
a1 = (-2 * cosW) / a0;
|
||||
a2 = (1 - alpha / a) / a0;
|
||||
}
|
||||
|
||||
float process(float x) {
|
||||
double input = (double)x;
|
||||
double out = b0 * input + z1;
|
||||
z1 = b1 * input - a1 * out + z2;
|
||||
z2 = b2 * input - a2 * out;
|
||||
return (float)out;
|
||||
}
|
||||
};
|
||||
|
||||
class GraphicEq final : public Effect {
|
||||
static constexpr float centers[10] = {31.f, 63.f, 125.f, 250.f, 500.f, 1000.f, 2000.f, 4000.f, 8000.f, 16000.f};
|
||||
static constexpr const char *keys[10] = {"band0", "band1", "band2", "band3", "band4",
|
||||
"band5", "band6", "band7", "band8", "band9"};
|
||||
PeakBiquad bands[10];
|
||||
int sampleRate;
|
||||
|
||||
public:
|
||||
explicit GraphicEq(int sr) : sampleRate(sr) {}
|
||||
|
||||
void update(const Params &p, float) override {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
float gainDb = kt::coerceIn(p.f(keys[i], 0.f), -1.f, 1.f) * 12.f;
|
||||
bands[i].set(sampleRate, centers[i], gainDb);
|
||||
}
|
||||
}
|
||||
|
||||
float process(float x) override {
|
||||
float y = x;
|
||||
for (auto &b : bands) y = b.process(y);
|
||||
return y;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<Effect> makeGraphicEq(int sr) { return std::make_unique<GraphicEq>(sr); }
|
||||
|
||||
} // namespace sizzle
|
||||
Reference in New Issue
Block a user