- 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>
58 lines
2.5 KiB
C++
58 lines
2.5 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 "SAMPLE": the test sample (mono), its rate and loop points (-1 = none)
|
|
const float *sample = nullptr;
|
|
int sampleLength = 0;
|
|
int sampleRate2 = 0;
|
|
int loopStart = -1, loopEnd = -1;
|
|
// Kotlin's global seed counters right before the scenario built its voices
|
|
// (FrasilVoice, GrainCloud): a SynthVoice's Morph Pad voice takes the next
|
|
// Frasil seed, then the FRASIL kind's voice, then the GrainCloud the next grain one.
|
|
uint32_t frasilSeeds = 0, grainSeeds = 0;
|
|
};
|
|
|
|
/** 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);
|
|
/** kind "SAMPLE": SampleVoice with the engine's voiceSample() settings for
|
|
* [setup.type] (SAMPLER: pads by note; SOUNDFONT: sfRoot, envelope, loop). */
|
|
std::unique_ptr<TestVoice> makeSampleTestVoice(const TestVoiceSetup &setup);
|
|
|
|
std::unique_ptr<TestVoice> makeTestVoice(const char *kind, const TestVoiceSetup &setup);
|
|
|
|
} // namespace sizzle
|