iOS 0.1.0: the eight audio effects as AUv3 plugins on a C++ core
C++ ports of the Kotlin effects, checked against audio the Kotlin code renders (25 scenarios, IosGoldenExport); an Objective-C++ AUv3 wrapper checked on the Mac against the core (parameters, presets, saved state); a container app that checks each plugin on the device. Built as a TrollStore .ipa. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c9ad186de1
commit
dcf85ba915
@@ -0,0 +1,34 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#pragma once
|
||||
|
||||
// Kotlin/JVM math semantics, so ports read like the Kotlin and match its output.
|
||||
// kotlin.math on Float goes through Java's double Math and rounds back to float.
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace sizzle::kt {
|
||||
|
||||
inline float tanhf_(float x) { return (float)std::tanh((double)x); }
|
||||
inline float expf_(float x) { return (float)std::exp((double)x); }
|
||||
inline float sinf_(float x) { return (float)std::sin((double)x); }
|
||||
inline float cosf_(float x) { return (float)std::cos((double)x); }
|
||||
inline float powf_(float a, float b) { return (float)std::pow((double)a, (double)b); }
|
||||
inline float sqrtf_(float x) { return (float)std::sqrt((double)x); }
|
||||
inline float log10f_(float x) { return (float)std::log10((double)x); }
|
||||
|
||||
/** Float.roundToInt(): Math.round, i.e. floor(x + 0.5). */
|
||||
inline int roundToInt(float x) { return (int)std::floor((double)x + 0.5); }
|
||||
inline int roundToInt(double x) { return (int)std::floor(x + 0.5); }
|
||||
/** Float.toInt(): truncation toward zero, NaN → 0, saturating. */
|
||||
inline int toInt(float x) {
|
||||
if (std::isnan(x)) return 0;
|
||||
if (x >= 2147483647.f) return 2147483647;
|
||||
if (x <= -2147483648.f) return (-2147483647 - 1);
|
||||
return (int)x;
|
||||
}
|
||||
template <class T> inline T coerceIn(T v, T lo, T hi) { return v < lo ? lo : (v > hi ? hi : v); }
|
||||
template <class T> inline T coerceAtLeast(T v, T lo) { return v < lo ? lo : v; }
|
||||
template <class T> inline T coerceAtMost(T v, T hi) { return v > hi ? hi : v; }
|
||||
|
||||
} // namespace sizzle::kt
|
||||
Reference in New Issue
Block a user