Files
sizzletracker-android/ios/core/src/frasil/FrasilTestVoice.cpp
T
ReactorcoremeltdownandClaude Opus 5.5 8d85b14a67 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>
2026-11-15 21:56:33 +01:00

55 lines
1.7 KiB
C++

// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
// SPDX-License-Identifier: GPL-3.0-or-later
// The reference tests' FRASIL maker (see TestVoice.hpp, IosGoldenInstruments.kt).
#include <cmath>
#include "frasil/FrasilVoice.hpp"
#include "sizzle/TestVoice.hpp"
namespace sizzle {
namespace {
using frasil::FrasilClock;
using frasil::FrasilPatch;
using frasil::FrasilSeeds;
using frasil::FrasilVoice;
/**
* The seed the Kotlin export's FrasilVoice got: the export records Kotlin's global
* seed counter right before the scenario built its voices ("seeds" line). The
* SynthVoice built first takes the next seed for its own Morph Pad voice; the
* FrasilVoice takes the one after.
*/
int32_t exportSeed(const TestVoiceSetup &s) {
FrasilSeeds seeds;
seeds.seeds = s.frasilSeeds;
seeds.next(); // the SynthVoice's Morph Pad voice
return seeds.next();
}
class FrasilTestVoice final : public TestVoice {
FrasilClock clock;
FrasilPatch patch;
FrasilVoice voice;
int sampleRate;
public:
explicit FrasilTestVoice(const TestVoiceSetup &s)
: clock{s.clock0}, patch(FrasilPatch::from(s.params)), voice(s.sampleRate, clock, exportSeed(s)),
sampleRate(s.sampleRate) {}
void blockStart(int frames) override { clock.advance(frames, sampleRate); }
void noteOn(int midi, int velocity) override { voice.noteOn(midi, (float)velocity / 127.f, patch); }
void noteOff(int) override { voice.noteOff(); }
float render() override { return voice.render(); }
};
} // namespace
std::unique_ptr<TestVoice> makeFrasilTestVoice(const TestVoiceSetup &setup) {
return std::make_unique<FrasilTestVoice>(setup);
}
} // namespace sizzle