Files
ReactorcoremeltdownandClaude Opus 5.5 2bc5cb1cbb 0.37.0 (71): one engine, one version for Android and iOS
- 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>
2026-11-16 14:49:46 +01:00

51 lines
2.0 KiB
C++

// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <memory>
#include "sizzle/Params.hpp"
namespace sizzle {
namespace sampler { class SampleStore; }
/**
* One playable instrument: a pool of voices for a ToolboxType, the way AudioEngine
* plays one mixer channel's instrument (8 voices, a free voice first, else the
* round-robin one; synth voices are cut when stolen, sample voices declick).
* Used by the AUv3 instruments and the in-app host until the full engine is ported.
*
* Threads: construct and call update()/noteOn()/noteOff()/render() from the audio
* thread only (the AU wrapper hands parameter changes over itself). No allocation
* after construction.
*/
class Instrument {
public:
virtual ~Instrument() = default;
/** New settings (and tempo): rebuild the patch, and let held notes follow it
* where the Kotlin engine does (synth voices take the new patch). */
virtual void update(const Params &p, float tempoBpm) = 0;
virtual void noteOn(int midi, int velocity) = 0;
/** Release the held note(s) at [midi]. */
virtual void noteOff(int midi) = 0;
/** Release everything (MIDI all-notes-off, transport stop). */
virtual void allNotesOff() = 0;
/** Hard stop, no release tails. */
virtual void kill() = 0;
/** Before each render block of [frames]: advances the Morph Pad's shared clock
* and lets the sample store reclaim memory. */
virtual void blockStart(int frames) = 0;
/** One mono output sample. */
virtual float render() = 0;
static constexpr int POLYPHONY = 8;
/** The instrument for ToolboxType [type] (NES_SYNTH, MORPH_PAD, WAVETABLE,
* GRAIN_CLOUD, SAMPLER, SOUNDFONT), or nullptr. [store] supplies samples for
* the Sampler, SF2/XI loader and Grain Cloud custom sources (may be null:
* those then stay silent); it must outlive the instrument. */
static std::unique_ptr<Instrument> create(const char *type, int sampleRate, sampler::SampleStore *store);
};
} // namespace sizzle