- 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>
41 lines
1.7 KiB
C++
41 lines
1.7 KiB
C++
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include "sizzle/Params.hpp"
|
|
|
|
namespace sizzle {
|
|
|
|
/**
|
|
* An insert effect: the C++ twin of AudioEffect in Effects.kt. `update` refreshes
|
|
* cached settings (call it when the params change, and once before processing);
|
|
* `process` runs per mono sample and must never allocate or lock. Construct on a
|
|
* normal thread: constructors allocate delay lines for [sampleRate].
|
|
*/
|
|
class Effect {
|
|
public:
|
|
virtual ~Effect() = default;
|
|
virtual void update(const Params &p, float tempoBpm) = 0;
|
|
virtual float process(float x) = 0;
|
|
|
|
// ---- visualisation (Kotlin's VizEffect), optional
|
|
// The audio thread publishes a small snapshot while it runs process(); the UI
|
|
// reads it at frame rate from another thread, without locks (relaxed atomics: a
|
|
// value one frame stale is harmless). Publishing must never change the audio.
|
|
|
|
/** True if this effect publishes a scope and playhead (a VizEffect). */
|
|
virtual bool hasScope() const { return false; }
|
|
/** Copy up to [capacity] of the latest scope samples, oldest to newest, into
|
|
* [out]; returns the count written, or -1 if the effect has no scope. */
|
|
virtual int copyScope(float *out, int capacity) const { (void)out; (void)capacity; return -1; }
|
|
/** The read/play head within the scope window, 0 (oldest) to 1 (newest), or -1. */
|
|
virtual float playhead() const { return -1.f; }
|
|
|
|
/** The effect for ToolboxType name [type] ("DELAY", "FILTER", …), or nullptr
|
|
* for types without an audio processor (the MIDI effects) or not ported yet. */
|
|
static std::unique_ptr<Effect> create(const char *type, int sampleRate);
|
|
};
|
|
|
|
} // namespace sizzle
|