- 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>
46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
#pragma once
|
|
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
#include "sizzle/Specs.hpp"
|
|
|
|
namespace sizzle {
|
|
|
|
/**
|
|
* A device's settings, the C++ twin of ToolboxSlot's string map: every value is
|
|
* kept as text so `f()` / `s()` read exactly what the Kotlin `slot.float()` /
|
|
* `slot.string()` would. Fixed capacity, no allocation: safe to read from
|
|
* `Effect::update` on the audio thread. Keys are stored by copy, so values can
|
|
* come from a file (tests), a preset, or AU parameters.
|
|
*/
|
|
class Params {
|
|
public:
|
|
static constexpr int kMax = 128;
|
|
static constexpr int kKeyLen = 32;
|
|
static constexpr int kValLen = 256; // sample ids and file paths
|
|
|
|
/** All of [spec]'s defaults, like ToolboxSlot.fill(). */
|
|
void fill(const DeviceSpec &spec);
|
|
void set(const char *key, const char *value);
|
|
void set(const char *key, float value);
|
|
/** Number as Kotlin's String.toFloat would parse it, else [fallback]. */
|
|
float f(const char *key, float fallback = 0.f) const;
|
|
/** The stored text (enum choice name), else [fallback]. */
|
|
const char *s(const char *key, const char *fallback = "") const;
|
|
bool has(const char *key) const { return find(key) >= 0; }
|
|
/** Stored entries in insertion order (for saving state). */
|
|
int size() const { return n_; }
|
|
const char *keyAt(int i) const { return keys_[i]; }
|
|
const char *valueAt(int i) const { return vals_[i]; }
|
|
|
|
private:
|
|
int find(const char *key) const;
|
|
char keys_[kMax][kKeyLen] = {};
|
|
char vals_[kMax][kValLen] = {};
|
|
int n_ = 0;
|
|
};
|
|
|
|
} // namespace sizzle
|