PORTING.md: native SwiftUI app on a C++ engine verified against Kotlin. IosGoldenInstruments renders note scripts through the Kotlin voices; the C++ runner plays the same scripts through TestVoice makers (weak placeholders until each port lands). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.8 KiB
C++
46 lines
1.8 KiB
C++
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
#pragma once
|
|
|
|
// The hook the reference tests use to play a note script through one instrument
|
|
// voice (see IosGoldenInstruments.kt and tests/golden_test.cpp). Each instrument
|
|
// port provides its maker (strong definition) in its own source file; the weak
|
|
// placeholders in src/TestVoices.cpp return nullptr for kinds not ported yet.
|
|
|
|
#include <memory>
|
|
#include "sizzle/Params.hpp"
|
|
|
|
namespace sizzle {
|
|
|
|
class TestVoice {
|
|
public:
|
|
virtual ~TestVoice() = default;
|
|
/** Called before each block of [frames] (AudioEngine advances shared clocks
|
|
* such as the Morph Pad's FrasilClock here). */
|
|
virtual void blockStart(int frames) { (void)frames; }
|
|
virtual void noteOn(int midi, int velocity) = 0;
|
|
virtual void noteOff(int midi) = 0;
|
|
virtual float render() = 0;
|
|
};
|
|
|
|
struct TestVoiceSetup {
|
|
const char *type; // ToolboxType name, e.g. "MORPH_PAD"
|
|
const Params *params; // the slot's values
|
|
int sampleRate;
|
|
float tempoBpm;
|
|
double clock0; // FrasilClock.seconds when the scenario started
|
|
};
|
|
|
|
/** kind "SYNTH": SynthVoice with the engine's patch for [setup.type]. */
|
|
std::unique_ptr<TestVoice> makeSynthTestVoice(const TestVoiceSetup &setup);
|
|
/** kind "FRASIL": FrasilVoice alone (Morph Pad). */
|
|
std::unique_ptr<TestVoice> makeFrasilTestVoice(const TestVoiceSetup &setup);
|
|
/** kind "WAVE": WaveVoice alone (Wavetable). */
|
|
std::unique_ptr<TestVoice> makeWaveTestVoice(const TestVoiceSetup &setup);
|
|
/** kind "GRAIN": GrainCloud (Grain Cloud), notes owned by live input. */
|
|
std::unique_ptr<TestVoice> makeGrainTestVoice(const TestVoiceSetup &setup);
|
|
|
|
std::unique_ptr<TestVoice> makeTestVoice(const char *kind, const TestVoiceSetup &setup);
|
|
|
|
} // namespace sizzle
|