// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown // SPDX-License-Identifier: GPL-3.0-or-later // The reference tests' FRASIL maker (see TestVoice.hpp, IosGoldenInstruments.kt). #include #include "frasil/FrasilVoice.hpp" #include "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 makeFrasilTestVoice(const TestVoiceSetup &setup) { return std::make_unique(setup); } } // namespace sizzle