iOS core: Morph Pad, Wavetable and Grain Cloud ported, bit-exact with Kotlin
Ported by parallel agents against reference renders. The export now records Kotlin's global voice-seed counters and every factory wavetable's data, and adds Sampler/SF2 scenarios (not ported yet). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bf5f2b53af
commit
8d85b14a67
@@ -22,6 +22,7 @@
|
||||
#include <vector>
|
||||
#include "sizzle/Effect.hpp"
|
||||
#include "sizzle/TestVoice.hpp"
|
||||
#include "wavetable/WaveTables.hpp"
|
||||
|
||||
using namespace sizzle;
|
||||
|
||||
@@ -57,6 +58,9 @@ int main(int argc, char **argv) {
|
||||
int sr = 48000, block = 256, frames = 0;
|
||||
float tempo = 120.f;
|
||||
double clock0 = 0;
|
||||
int smpRate = 0, loopStart = -1, loopEnd = -1;
|
||||
long long frasilSeeds = 0, grainSeeds = 0;
|
||||
std::string table;
|
||||
struct Ev { int frame; bool on; int midi, vel; };
|
||||
std::vector<Ev> evs;
|
||||
Params p;
|
||||
@@ -70,6 +74,9 @@ int main(int argc, char **argv) {
|
||||
else if (tag == "block") ls >> block;
|
||||
else if (tag == "frames") ls >> frames;
|
||||
else if (tag == "clock") ls >> clock0;
|
||||
else if (tag == "sample") ls >> smpRate >> loopStart >> loopEnd;
|
||||
else if (tag == "seeds") ls >> frasilSeeds >> grainSeeds;
|
||||
else if (tag == "table") { std::getline(ls, table); if (!table.empty() && table[0] == ' ') table.erase(0, 1); }
|
||||
else if (tag == "on") { Ev e{0, true, 0, 0}; ls >> e.frame >> e.midi >> e.vel; evs.push_back(e); }
|
||||
else if (tag == "off") { Ev e{0, false, 0, 0}; ls >> e.frame >> e.midi; evs.push_back(e); }
|
||||
else if (tag == "p") {
|
||||
@@ -81,8 +88,35 @@ int main(int argc, char **argv) {
|
||||
std::string label = kind.empty() ? type : kind + "_" + type;
|
||||
if (!only.empty() && std::find(only.begin(), only.end(), type) == only.end()
|
||||
&& std::find(only.begin(), only.end(), label) == only.end()) continue;
|
||||
if (kind == "TABLE") {
|
||||
std::vector<float> want = readF32(dir + "/" + base + ".f32"), got;
|
||||
wavetable::WaveTables::prewarmBlocking();
|
||||
if (const wavetable::WaveTable *t = wavetable::WaveTables::factory(table.c_str()))
|
||||
for (int l = 0; l < wavetable::WaveTable::LEVELS; ++l)
|
||||
got.insert(got.end(), t->data(l), t->data(l) + (size_t)t->frames * t->size(l));
|
||||
double maxErr = got.size() == want.size() ? 0 : 1e9; size_t at = 0;
|
||||
for (size_t i = 0; i < got.size() && i < want.size(); ++i) {
|
||||
double e = std::fabs((double)got[i] - want[i]);
|
||||
if (!(e <= maxErr)) { maxErr = e; at = i; }
|
||||
}
|
||||
bool ok = maxErr < 1e-4;
|
||||
std::printf("%s %-36s max diff %.3g at %zu\n", ok ? "PASS" : "FAIL", base.c_str(), maxErr, at);
|
||||
ok ? ++pass : ++fail;
|
||||
continue;
|
||||
}
|
||||
if (!kind.empty()) {
|
||||
TestVoiceSetup setup{type.c_str(), &p, sr, tempo, clock0};
|
||||
setup.frasilSeeds = (uint32_t)frasilSeeds;
|
||||
setup.grainSeeds = (uint32_t)grainSeeds;
|
||||
std::vector<float> smp;
|
||||
if (smpRate > 0) {
|
||||
smp = readF32(dir + "/" + base + ".smp.f32");
|
||||
setup.sample = smp.data();
|
||||
setup.sampleLength = (int)smp.size();
|
||||
setup.sampleRate2 = smpRate;
|
||||
setup.loopStart = loopStart;
|
||||
setup.loopEnd = loopEnd;
|
||||
}
|
||||
auto v = makeTestVoice(kind.c_str(), setup);
|
||||
if (!v) { std::printf("SKIP %-36s (not ported)\n", base.c_str()); ++skip; continue; }
|
||||
std::vector<float> want = readF32(dir + "/" + base + ".f32");
|
||||
|
||||
Reference in New Issue
Block a user