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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
64e21e0bcc
commit
2bc5cb1cbb
@@ -0,0 +1,65 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "sizzle/Params.hpp"
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
|
||||
namespace sizzle {
|
||||
|
||||
void Params::fill(const DeviceSpec &spec) {
|
||||
n_ = 0;
|
||||
for (int i = 0; i < spec.paramCount; ++i) {
|
||||
const ParamSpec &p = spec.params[i];
|
||||
if (p.isEnum()) {
|
||||
int idx = (int)p.def;
|
||||
int n = p.choiceCount();
|
||||
if (idx < 0) idx = 0;
|
||||
if (idx > n - 1) idx = n - 1;
|
||||
set(p.key, p.choices[idx]);
|
||||
} else {
|
||||
set(p.key, p.def);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Params::find(const char *key) const {
|
||||
for (int i = 0; i < n_; ++i) if (std::strcmp(keys_[i], key) == 0) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Params::set(const char *key, const char *value) {
|
||||
int i = find(key);
|
||||
if (i < 0) {
|
||||
if (n_ >= kMax) return;
|
||||
i = n_++;
|
||||
std::snprintf(keys_[i], kKeyLen, "%s", key);
|
||||
}
|
||||
std::snprintf(vals_[i], kValLen, "%s", value);
|
||||
}
|
||||
|
||||
void Params::set(const char *key, float value) {
|
||||
// Shortest text that reads back as the same float (Kotlin stores toString()).
|
||||
char buf[kValLen];
|
||||
std::snprintf(buf, sizeof buf, "%.9g", (double)value);
|
||||
set(key, buf);
|
||||
}
|
||||
|
||||
float Params::f(const char *key, float fallback) const {
|
||||
int i = find(key);
|
||||
if (i < 0) return fallback;
|
||||
const char *s = vals_[i];
|
||||
while (std::isspace((unsigned char)*s)) ++s;
|
||||
if (!*s) return fallback;
|
||||
char *end = nullptr;
|
||||
float v = std::strtof(s, &end);
|
||||
while (end && std::isspace((unsigned char)*end)) ++end;
|
||||
return (end && *end == '\0') ? v : fallback;
|
||||
}
|
||||
|
||||
const char *Params::s(const char *key, const char *fallback) const {
|
||||
int i = find(key);
|
||||
return i < 0 ? fallback : vals_[i];
|
||||
}
|
||||
|
||||
} // namespace sizzle
|
||||
Reference in New Issue
Block a user