spike: AOT-compile thruster v5 to a C-ABI native lib with bounded rpm, test, timing script
Linux only; Windows/Unity unverified. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0efce042f3
commit
6cdab1220e
9 changed files with 807 additions and 0 deletions
1
spikes/faust-aot-thruster/.gitignore
vendored
Normal file
1
spikes/faust-aot-thruster/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
build/
|
||||
26
spikes/faust-aot-thruster/README.md
Normal file
26
spikes/faust-aot-thruster/README.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Faust AOT spike: thruster v5 as a native lib (Linux)
|
||||
|
||||
Spike for `docs/faust-unity-player-scoping.md` path (a). One patch, `patches/thruster/thruster.dsp`
|
||||
(copied here as `thruster.dsp`; re-copy if the patch changes), compiled by the `faust` CLI to C++ and
|
||||
wrapped behind a C ABI. Not wired into the solution or into Unity.
|
||||
|
||||
Limitation: AOT fixes the patch set at build time, so player-authored patches cannot run this way.
|
||||
|
||||
- `aqs_thruster.h`: the C ABI. `rpm` enters only via `aqs_thruster_set_rpm`: bounds are read from the
|
||||
compiled patch's `hslider` (300..6000, default 1200); out-of-range and +-inf clamp to the nearest bound
|
||||
(`AQS_PARAM_CLAMPED`), NaN applies the default (`AQS_PARAM_NAN`); both are counted and returned.
|
||||
`aqs_thruster_process` rejects NULL, negative or >`AQS_MAX_BLOCK` frames instead of truncating.
|
||||
- `test_thruster.c`: plain-C behaviour test (bounds, clamp, NaN, inf, hostile values give finite bounded
|
||||
output, rpm actually changes the output, instances are deterministic). A flipped clamp bound fails it.
|
||||
- `bench_thruster.c`: per-block `process` time at 48 kHz / 512 frames against the 10.667 ms deadline.
|
||||
- `run.sh`: generate, build, test, bench. `FAUST`, `FAUST_PREFIX` (needs `include/faust`), `FAUST_LIBS`
|
||||
(needs `stdfaust.lib`), `BLOCKS`, `RATE`, `FRAMES` override defaults. Exit status is test status; timing
|
||||
is reported, not gated.
|
||||
|
||||
Measured 2026-11-06, Faust 2.90.20, AMD EPYC-Genoa, shared Linux host, 20000 blocks, 3 runs:
|
||||
median 0.052 ms (0.49% of deadline), p99 0.10-0.16 ms (~1-1.5%), max 10.8-17.1 ms (4-5 blocks of 20000 over
|
||||
the deadline). The max is a scheduler preemption on a shared host, not DSP cost (median and p99 are
|
||||
two orders under the deadline); a quiet or realtime-priority host is needed to say anything about the max.
|
||||
|
||||
**Unverified:** Windows (MSVC build, `__declspec(dllexport)`), Unity P/Invoke, IL2CPP, the Unity audio
|
||||
thread, any device. Nothing here ran inside Unity.
|
||||
71
spikes/faust-aot-thruster/aqs_thruster.cpp
Normal file
71
spikes/faust-aot-thruster/aqs_thruster.cpp
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
#include "aqs_thruster.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <new>
|
||||
|
||||
#include <faust/dsp/dsp.h>
|
||||
#include <faust/gui/APIUI.h>
|
||||
#include <faust/gui/meta.h>
|
||||
#include "thruster_dsp.h"
|
||||
|
||||
struct aqs_thruster {
|
||||
ThrusterDsp dsp;
|
||||
APIUI ui;
|
||||
float lo, hi, init, applied;
|
||||
unsigned clamps = 0, nans = 0;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
aqs_thruster* aqs_thruster_create(int sample_rate) {
|
||||
if (sample_rate < 8000 || sample_rate > 384000) return nullptr;
|
||||
aqs_thruster* t = new (std::nothrow) aqs_thruster();
|
||||
if (!t) return nullptr;
|
||||
t->dsp.init(sample_rate);
|
||||
t->dsp.buildUserInterface(&t->ui);
|
||||
t->lo = t->ui.getParamMin(0);
|
||||
t->hi = t->ui.getParamMax(0);
|
||||
t->init = t->ui.getParamInit(0);
|
||||
t->applied = t->init;
|
||||
return t;
|
||||
}
|
||||
|
||||
void aqs_thruster_destroy(aqs_thruster* t) { delete t; }
|
||||
|
||||
float aqs_thruster_rpm_min(const aqs_thruster* t) { return t->lo; }
|
||||
float aqs_thruster_rpm_max(const aqs_thruster* t) { return t->hi; }
|
||||
float aqs_thruster_rpm_default(const aqs_thruster* t) { return t->init; }
|
||||
|
||||
int aqs_thruster_set_rpm(aqs_thruster* t, float rpm) {
|
||||
if (!t) return -1;
|
||||
int status = AQS_PARAM_OK;
|
||||
if (std::isnan(rpm)) {
|
||||
rpm = t->init;
|
||||
status = AQS_PARAM_NAN;
|
||||
++t->nans;
|
||||
} else if (rpm < t->lo) {
|
||||
rpm = t->lo;
|
||||
status = AQS_PARAM_CLAMPED;
|
||||
++t->clamps;
|
||||
} else if (rpm > t->hi) {
|
||||
rpm = t->hi;
|
||||
status = AQS_PARAM_CLAMPED;
|
||||
++t->clamps;
|
||||
}
|
||||
t->applied = rpm;
|
||||
t->ui.setParamValue(0, rpm);
|
||||
return status;
|
||||
}
|
||||
|
||||
float aqs_thruster_rpm(const aqs_thruster* t) { return t->applied; }
|
||||
unsigned aqs_thruster_clamp_count(const aqs_thruster* t) { return t->clamps; }
|
||||
unsigned aqs_thruster_nan_count(const aqs_thruster* t) { return t->nans; }
|
||||
|
||||
int aqs_thruster_process(aqs_thruster* t, float* out, int frames) {
|
||||
if (!t || !out || frames < 0 || frames > AQS_MAX_BLOCK) return -1;
|
||||
float* outs[1] = {out};
|
||||
t->dsp.compute(frames, nullptr, outs);
|
||||
return frames;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
52
spikes/faust-aot-thruster/aqs_thruster.h
Normal file
52
spikes/faust-aot-thruster/aqs_thruster.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/* C ABI over the AOT-compiled thruster (patches/thruster/thruster.dsp).
|
||||
* The host never touches Faust types. rpm enters only through aqs_thruster_set_rpm,
|
||||
* which enforces the bounds declared in the .dsp (hslider min/max/init). */
|
||||
#ifndef AQS_THRUSTER_H
|
||||
#define AQS_THRUSTER_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define AQS_API __declspec(dllexport)
|
||||
#else
|
||||
#define AQS_API __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
typedef struct aqs_thruster aqs_thruster;
|
||||
|
||||
/* Result of a parameter write. The applied value is always inside [min,max]. */
|
||||
enum {
|
||||
AQS_PARAM_OK = 0, /* applied as given */
|
||||
AQS_PARAM_CLAMPED = 1, /* out of range (including +-inf): applied the nearest bound */
|
||||
AQS_PARAM_NAN = 2 /* NaN: applied the declared default */
|
||||
};
|
||||
|
||||
/* Largest frame count one process call accepts; larger requests are rejected, not truncated. */
|
||||
#define AQS_MAX_BLOCK 16384
|
||||
|
||||
AQS_API aqs_thruster* aqs_thruster_create(int sample_rate); /* NULL on bad rate (<8000 or >384000) or OOM */
|
||||
AQS_API void aqs_thruster_destroy(aqs_thruster*);
|
||||
|
||||
/* Declared bounds, read from the compiled patch. */
|
||||
AQS_API float aqs_thruster_rpm_min(const aqs_thruster*);
|
||||
AQS_API float aqs_thruster_rpm_max(const aqs_thruster*);
|
||||
AQS_API float aqs_thruster_rpm_default(const aqs_thruster*);
|
||||
|
||||
/* Returns AQS_PARAM_*; negative on NULL handle. */
|
||||
AQS_API int aqs_thruster_set_rpm(aqs_thruster*, float rpm);
|
||||
/* Value currently applied (post-clamp). */
|
||||
AQS_API float aqs_thruster_rpm(const aqs_thruster*);
|
||||
|
||||
/* Counters since create, for the host to report: out-of-range and NaN writes. */
|
||||
AQS_API unsigned aqs_thruster_clamp_count(const aqs_thruster*);
|
||||
AQS_API unsigned aqs_thruster_nan_count(const aqs_thruster*);
|
||||
|
||||
/* Writes `frames` mono samples. Returns frames written, or -1 on NULL handle/out,
|
||||
* frames < 0, or frames > AQS_MAX_BLOCK. No allocation, no locks. */
|
||||
AQS_API int aqs_thruster_process(aqs_thruster*, float* out, int frames);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
38
spikes/faust-aot-thruster/bench_thruster.c
Normal file
38
spikes/faust-aot-thruster/bench_thruster.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* Per-block callback time vs deadline. usage: bench_thruster [blocks] [rate] [frames] */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "aqs_thruster.h"
|
||||
|
||||
static int cmp(const void* a, const void* b) { double x = *(const double*)a, y = *(const double*)b; return (x > y) - (x < y); }
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int blocks = argc > 1 ? atoi(argv[1]) : 20000;
|
||||
int rate = argc > 2 ? atoi(argv[2]) : 48000;
|
||||
int frames = argc > 3 ? atoi(argv[3]) : 512;
|
||||
aqs_thruster* t = aqs_thruster_create(rate);
|
||||
if (!t || blocks < 100) return 2;
|
||||
float* out = malloc(sizeof(float) * frames);
|
||||
double* ms = malloc(sizeof(double) * blocks);
|
||||
const int warm = 200;
|
||||
for (int i = 0; i < warm + blocks; ++i) {
|
||||
/* sweep rpm across its whole range so the smoother and filters keep moving */
|
||||
aqs_thruster_set_rpm(t, 300.f + 5700.f * (0.5f + 0.5f * (float)((i % 997) - 498) / 498.f));
|
||||
struct timespec a, b;
|
||||
clock_gettime(CLOCK_MONOTONIC, &a);
|
||||
aqs_thruster_process(t, out, frames);
|
||||
clock_gettime(CLOCK_MONOTONIC, &b);
|
||||
if (i >= warm) ms[i - warm] = (b.tv_sec - a.tv_sec) * 1e3 + (b.tv_nsec - a.tv_nsec) / 1e6;
|
||||
}
|
||||
double deadline = 1e3 * frames / rate, sum = 0;
|
||||
int over = 0;
|
||||
for (int i = 0; i < blocks; ++i) { sum += ms[i]; if (ms[i] > deadline) ++over; }
|
||||
qsort(ms, blocks, sizeof *ms, cmp);
|
||||
double med = ms[blocks / 2], p99 = ms[(int)(blocks * 0.99)], mx = ms[blocks - 1];
|
||||
printf("rate=%d frames=%d blocks=%d deadline_ms=%.4f\n", rate, frames, blocks, deadline);
|
||||
printf("median_ms=%.4f p99_ms=%.4f max_ms=%.4f mean_ms=%.4f\n", med, p99, mx, sum / blocks);
|
||||
printf("median_pct_deadline=%.2f p99_pct_deadline=%.2f max_pct_deadline=%.2f over_deadline=%d\n",
|
||||
100 * med / deadline, 100 * p99 / deadline, 100 * mx / deadline, over);
|
||||
free(out); free(ms); aqs_thruster_destroy(t);
|
||||
return 0; /* timing is reported, not gated: a shared host preempts */
|
||||
}
|
||||
21
spikes/faust-aot-thruster/run.sh
Executable file
21
spikes/faust-aot-thruster/run.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
# Build the AOT thruster spike, run the boundary test, then the per-block timing report.
|
||||
# Linux only. usage: run.sh [--bench-only] ; env: FAUST (faust CLI), FAUST_PREFIX (has include/faust),
|
||||
# FAUST_LIBS (dir with stdfaust.lib), OUT (build dir), BLOCKS, RATE, FRAMES.
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
FAUST=${FAUST:-faust}
|
||||
FAUST_PREFIX=${FAUST_PREFIX:-$(dirname "$(dirname "$(command -v "$FAUST")")")}
|
||||
FAUST_LIBS=${FAUST_LIBS:-$FAUST_PREFIX/share/faust}
|
||||
OUT=${OUT:-$here/build}
|
||||
mkdir -p "$OUT"
|
||||
[ -f "$FAUST_LIBS/stdfaust.lib" ] || { echo "no stdfaust.lib in FAUST_LIBS=$FAUST_LIBS" >&2; exit 2; }
|
||||
"$FAUST" -lang cpp -cn ThrusterDsp -I "$FAUST_LIBS" "$here/thruster.dsp" -o "$OUT/thruster_dsp.h"
|
||||
"$FAUST" --version | head -1
|
||||
CXXF="-O2 -std=c++17 -fvisibility=hidden -I$OUT -I$here -I$FAUST_PREFIX/include"
|
||||
g++ $CXXF -shared -fPIC -o "$OUT/libaqs_thruster.so" "$here/aqs_thruster.cpp"
|
||||
gcc -O2 -I"$here" -o "$OUT/test_thruster" "$here/test_thruster.c" -L"$OUT" -laqs_thruster -lm -Wl,-rpath,"$OUT"
|
||||
gcc -O2 -I"$here" -o "$OUT/bench_thruster" "$here/bench_thruster.c" -L"$OUT" -laqs_thruster -lm -Wl,-rpath,"$OUT"
|
||||
"$OUT/test_thruster"
|
||||
echo "--- timing (Linux $(uname -r), $(grep -m1 'model name' /proc/cpuinfo | cut -d: -f2 | xargs)); Windows/Unity: unverified"
|
||||
"$OUT/bench_thruster" "${BLOCKS:-20000}" "${RATE:-48000}" "${FRAMES:-512}"
|
||||
94
spikes/faust-aot-thruster/test_thruster.c
Normal file
94
spikes/faust-aot-thruster/test_thruster.c
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/* Behaviour test for the bounded-parameter boundary. Plain C: proves the ABI is callable without C++. */
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "aqs_thruster.h"
|
||||
|
||||
static int fails;
|
||||
#define CHECK(c) do { if (!(c)) { printf("FAIL line %d: %s\n", __LINE__, #c); ++fails; } } while (0)
|
||||
|
||||
static float peak_after(aqs_thruster* t, float rpm, int* finite) {
|
||||
static float buf[512];
|
||||
float pk = 0;
|
||||
*finite = 1;
|
||||
aqs_thruster_set_rpm(t, rpm);
|
||||
for (int b = 0; b < 200; ++b) { /* ~2 s: lets the 0.2 s rpm smoother settle */
|
||||
CHECK(aqs_thruster_process(t, buf, 512) == 512);
|
||||
for (int i = 0; i < 512; ++i) {
|
||||
if (!isfinite(buf[i])) *finite = 0;
|
||||
if (fabsf(buf[i]) > pk) pk = fabsf(buf[i]);
|
||||
}
|
||||
}
|
||||
return pk;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
CHECK(aqs_thruster_create(100) == NULL);
|
||||
CHECK(aqs_thruster_create(1000000) == NULL);
|
||||
aqs_thruster* t = aqs_thruster_create(48000);
|
||||
CHECK(t != NULL);
|
||||
if (!t) return 1;
|
||||
|
||||
/* bounds come from the .dsp hslider("rpm", 1200, 300, 6000, 1) */
|
||||
CHECK(aqs_thruster_rpm_min(t) == 300.f);
|
||||
CHECK(aqs_thruster_rpm_max(t) == 6000.f);
|
||||
CHECK(aqs_thruster_rpm_default(t) == 1200.f);
|
||||
CHECK(aqs_thruster_rpm(t) == 1200.f);
|
||||
|
||||
CHECK(aqs_thruster_set_rpm(t, 4800.f) == AQS_PARAM_OK && aqs_thruster_rpm(t) == 4800.f);
|
||||
CHECK(aqs_thruster_set_rpm(t, 300.f) == AQS_PARAM_OK && aqs_thruster_rpm(t) == 300.f);
|
||||
CHECK(aqs_thruster_set_rpm(t, 6000.f) == AQS_PARAM_OK && aqs_thruster_rpm(t) == 6000.f);
|
||||
CHECK(aqs_thruster_clamp_count(t) == 0 && aqs_thruster_nan_count(t) == 0);
|
||||
|
||||
CHECK(aqs_thruster_set_rpm(t, 299.9f) == AQS_PARAM_CLAMPED && aqs_thruster_rpm(t) == 300.f);
|
||||
CHECK(aqs_thruster_set_rpm(t, -50.f) == AQS_PARAM_CLAMPED && aqs_thruster_rpm(t) == 300.f);
|
||||
CHECK(aqs_thruster_set_rpm(t, 6000.1f) == AQS_PARAM_CLAMPED && aqs_thruster_rpm(t) == 6000.f);
|
||||
CHECK(aqs_thruster_set_rpm(t, INFINITY) == AQS_PARAM_CLAMPED && aqs_thruster_rpm(t) == 6000.f);
|
||||
CHECK(aqs_thruster_set_rpm(t, -INFINITY) == AQS_PARAM_CLAMPED && aqs_thruster_rpm(t) == 300.f);
|
||||
CHECK(aqs_thruster_clamp_count(t) == 5);
|
||||
|
||||
aqs_thruster_set_rpm(t, 5000.f);
|
||||
CHECK(aqs_thruster_set_rpm(t, NAN) == AQS_PARAM_NAN && aqs_thruster_rpm(t) == 1200.f);
|
||||
CHECK(aqs_thruster_nan_count(t) == 1);
|
||||
|
||||
CHECK(aqs_thruster_set_rpm(NULL, 1000.f) < 0);
|
||||
float buf[16];
|
||||
CHECK(aqs_thruster_process(t, buf, -1) == -1);
|
||||
CHECK(aqs_thruster_process(t, buf, AQS_MAX_BLOCK + 1) == -1);
|
||||
CHECK(aqs_thruster_process(t, NULL, 16) == -1);
|
||||
CHECK(aqs_thruster_process(NULL, buf, 16) == -1);
|
||||
CHECK(aqs_thruster_process(t, buf, 0) == 0);
|
||||
|
||||
/* hostile inputs never reach the DSP: output stays finite and under the patch's own peak bound */
|
||||
float hostile[] = {NAN, INFINITY, -INFINITY, 1e30f, -1e30f, 0.f};
|
||||
for (unsigned i = 0; i < sizeof hostile / sizeof *hostile; ++i) {
|
||||
aqs_thruster* h = aqs_thruster_create(48000);
|
||||
int fin;
|
||||
float pk = peak_after(h, hostile[i], &fin);
|
||||
CHECK(fin);
|
||||
CHECK(pk > 0.01f && pk < 1.0f);
|
||||
aqs_thruster_destroy(h);
|
||||
}
|
||||
|
||||
/* the patch is audibly rpm-dependent and loud at high rpm (guards against a stuck parameter) */
|
||||
int fin;
|
||||
aqs_thruster* lo = aqs_thruster_create(48000);
|
||||
aqs_thruster* hi = aqs_thruster_create(48000);
|
||||
float plo = peak_after(lo, 300.f, &fin), phi = peak_after(hi, 4800.f, &fin);
|
||||
CHECK(phi > plo);
|
||||
CHECK(phi < 0.45f); /* patch comment: peak under 0.4 at rpm 4800, small margin */
|
||||
aqs_thruster_destroy(lo); aqs_thruster_destroy(hi);
|
||||
|
||||
/* same rpm, same sample rate: two instances render identical bytes (noise is seeded) */
|
||||
aqs_thruster* a = aqs_thruster_create(48000);
|
||||
aqs_thruster* b = aqs_thruster_create(48000);
|
||||
static float xa[2048], xb[2048];
|
||||
aqs_thruster_set_rpm(a, 2000.f); aqs_thruster_set_rpm(b, 2000.f);
|
||||
aqs_thruster_process(a, xa, 2048); aqs_thruster_process(b, xb, 2048);
|
||||
CHECK(memcmp(xa, xb, sizeof xa) == 0);
|
||||
aqs_thruster_destroy(a); aqs_thruster_destroy(b);
|
||||
|
||||
aqs_thruster_destroy(t);
|
||||
printf(fails ? "FAILED (%d)\n" : "ok\n", fails);
|
||||
return fails != 0;
|
||||
}
|
||||
30
spikes/faust-aot-thruster/thruster.dsp
Normal file
30
spikes/faust-aot-thruster/thruster.dsp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// thruster: sustained, heavy, brittle-hull thruster with an RPM control.
|
||||
// Compile as Faust source (AquaSynthPatchCompiler.CompileSource); it is not a .aqua script.
|
||||
// Control: rpm (300..6000). Rotor tone = 28 Hz + rpm*0.025 (about 36..180 Hz); three blades chop the rasp at 3x that.
|
||||
declare name "thruster";
|
||||
import("stdfaust.lib");
|
||||
|
||||
rpm = hslider("rpm", 1200, 300, 6000, 1) : si.smooth(ba.tau2pole(0.2));
|
||||
load = (rpm - 300) / 5700;
|
||||
shaft = 28 + rpm * 0.025;
|
||||
|
||||
// effort: slow random wander of the shaft speed
|
||||
wander = no.noise : fi.lowpass(2, 5) : *(0.35);
|
||||
f0 = shaft * (1 + 0.04 * wander);
|
||||
|
||||
// low rumble: saw at shaft speed plus a square a sub-octave down, low-passed
|
||||
// the low-pass opens up as load falls, so at low rpm the rotor tone reaches the 150-300 Hz range a small speaker can show
|
||||
rumble = (os.sawtooth(f0) + 0.7 * os.square(f0 * 0.5)) : fi.lowpass(3, 60 + 2.5 * shaft + 140 * (1 - load));
|
||||
|
||||
// blade pass: rasp noise chopped at 3x shaft, band tracks rpm
|
||||
chop = 0.5 + 0.5 * os.osc(f0 * 3) ^ 2;
|
||||
rasp = no.noise : fi.resonbp(700 + rpm * 0.6, 1.5, 1) : *(chop);
|
||||
|
||||
// brittle hull: high-Q modes rattled by noise, louder with load (a 1.5% floor at idle, so low rpm is tone-led); tanh on the rattle alone keeps ring-up spikes from setting the peak
|
||||
mode(f, q) = no.noise : fi.resonbp(f, q, 1);
|
||||
rattle = (mode(173, 20) * (0.3 + 0.7 * load) + 0.8 * mode(311, 18) + 0.6 * mode(467, 16) + 0.4 * mode(1130, 14)) * (0.015 + 0.985 * load ^ 2) * 3 : *(4) : ma.tanh : /(4);
|
||||
|
||||
mix = rumble * (0.5 + 0.5 * load) + rasp * (0.05 + 1.75 * load) + rattle;
|
||||
// drive falls only gently with load so tanh stays out of saturation while high rpm still ends up louder than low rpm
|
||||
// final 0.425 trim keeps peak under 0.4 at rpm 4800
|
||||
process = mix * (0.4 + 0.6 * load) * (0.9 - 0.5 * load) : ma.tanh : *(0.425);
|
||||
474
spikes/faust-aot-thruster/thruster_dsp.h
Normal file
474
spikes/faust-aot-thruster/thruster_dsp.h
Normal file
|
|
@ -0,0 +1,474 @@
|
|||
/* ------------------------------------------------------------
|
||||
name: "thruster"
|
||||
Code generated with Faust 2.90.20 (https://faust.grame.fr)
|
||||
Compilation options: -lang cpp -i -fpga-mem-th 4 -ct 1 -cn ThrusterDsp -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0
|
||||
------------------------------------------------------------ */
|
||||
|
||||
#ifndef __ThrusterDsp_H__
|
||||
#define __ThrusterDsp_H__
|
||||
|
||||
#ifndef FAUSTFLOAT
|
||||
#define FAUSTFLOAT float
|
||||
#endif
|
||||
|
||||
/* link with : "" */
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <math.h>
|
||||
#ifndef FAUST_INT_WRAP
|
||||
#define FAUST_INT_WRAP
|
||||
inline int faust_wrap_add(int a, int b) { return int((unsigned int)a + (unsigned int)b); }
|
||||
inline int faust_wrap_sub(int a, int b) { return int((unsigned int)a - (unsigned int)b); }
|
||||
inline int faust_wrap_mul(int a, int b) { return int((unsigned int)a * (unsigned int)b); }
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FAUSTCLASS
|
||||
#define FAUSTCLASS ThrusterDsp
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define exp10f __exp10f
|
||||
#define exp10 __exp10
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define RESTRICT __restrict
|
||||
#else
|
||||
#define RESTRICT __restrict__
|
||||
#endif
|
||||
|
||||
class ThrusterDspSIG0 {
|
||||
|
||||
private:
|
||||
|
||||
int iVec4[2];
|
||||
int iRec13[2];
|
||||
int fSampleRate;
|
||||
|
||||
public:
|
||||
|
||||
int getNumInputsThrusterDspSIG0() {
|
||||
return 0;
|
||||
}
|
||||
int getNumOutputsThrusterDspSIG0() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void instanceInitThrusterDspSIG0(int sample_rate) {
|
||||
fSampleRate = sample_rate;
|
||||
for (int l17 = 0; l17 < 2; l17 = faust_wrap_add(l17, 1)) {
|
||||
iVec4[l17] = 0;
|
||||
}
|
||||
for (int l18 = 0; l18 < 2; l18 = faust_wrap_add(l18, 1)) {
|
||||
iRec13[l18] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void fillThrusterDspSIG0(int count, float* table) {
|
||||
for (int i1 = 0; i1 < count; i1 = faust_wrap_add(i1, 1)) {
|
||||
iVec4[0] = 1;
|
||||
iRec13[0] = (faust_wrap_add(iVec4[1], iRec13[1])) % 65536;
|
||||
table[i1] = std::sin(9.58738e-05f * static_cast<float>(iRec13[0]));
|
||||
iVec4[1] = iVec4[0];
|
||||
iRec13[1] = iRec13[0];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static ThrusterDspSIG0* newThrusterDspSIG0() { return (ThrusterDspSIG0*)new ThrusterDspSIG0(); }
|
||||
static void deleteThrusterDspSIG0(ThrusterDspSIG0* dsp) { delete dsp; }
|
||||
|
||||
static float ThrusterDsp_faustpower2_f(float value_f) {
|
||||
return value_f * value_f;
|
||||
}
|
||||
static float ftbl0ThrusterDspSIG0[65536];
|
||||
|
||||
class ThrusterDsp : public dsp {
|
||||
|
||||
private:
|
||||
|
||||
int iVec0[2];
|
||||
int fSampleRate;
|
||||
float fConst0;
|
||||
float fConst1;
|
||||
FAUSTFLOAT fHslider0;
|
||||
float fVec1[2];
|
||||
float fConst2;
|
||||
float fRec2[2];
|
||||
float fConst3;
|
||||
float fConst4;
|
||||
float fConst5;
|
||||
float fConst6;
|
||||
float fConst7;
|
||||
int iRec6[2];
|
||||
float fRec4[2];
|
||||
float fConst8;
|
||||
float fRec5[2];
|
||||
int iRec8[2];
|
||||
int iRec7[2];
|
||||
float fConst9;
|
||||
int iRec10[2];
|
||||
int iRec9[2];
|
||||
float fVec2[2];
|
||||
int IOTA0;
|
||||
float fVec3[4096];
|
||||
float fConst10;
|
||||
float fRec3[2];
|
||||
float fRec0[2];
|
||||
float fRec1[2];
|
||||
float fRec11[2];
|
||||
float fRec12[2];
|
||||
float fConst11;
|
||||
int iRec15[2];
|
||||
int iRec14[2];
|
||||
float fConst12;
|
||||
float fConst13;
|
||||
float fConst14;
|
||||
float fRec16[2];
|
||||
float fRec17[2];
|
||||
float fConst15;
|
||||
float fConst16;
|
||||
float fConst17;
|
||||
float fRec18[2];
|
||||
float fRec19[2];
|
||||
float fConst18;
|
||||
float fConst19;
|
||||
float fConst20;
|
||||
float fRec20[2];
|
||||
float fRec21[2];
|
||||
float fConst21;
|
||||
float fConst22;
|
||||
float fConst23;
|
||||
float fRec22[2];
|
||||
float fRec23[2];
|
||||
|
||||
public:
|
||||
ThrusterDsp() {
|
||||
}
|
||||
|
||||
ThrusterDsp(const ThrusterDsp&) = default;
|
||||
|
||||
virtual ~ThrusterDsp() = default;
|
||||
|
||||
ThrusterDsp& operator=(const ThrusterDsp&) = default;
|
||||
|
||||
void metadata(Meta* m) {
|
||||
m->declare("basics.lib/name", "Faust Basic Element Library");
|
||||
m->declare("basics.lib/version", "1.23.9");
|
||||
m->declare("compile_options", "-lang cpp -i -fpga-mem-th 4 -ct 1 -cn ThrusterDsp -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0");
|
||||
m->declare("filename", "thruster.dsp");
|
||||
m->declare("filters.lib/_tanhalf:author", "Julius O. Smith III");
|
||||
m->declare("filters.lib/_tanhalf:license", "MIT");
|
||||
m->declare("filters.lib/lowpass0_highpass1:author", "Julius O. Smith III");
|
||||
m->declare("filters.lib/lowpass0_highpass1:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
|
||||
m->declare("filters.lib/lowpass0_highpass1:license", "LicenseRef-STK-4.3");
|
||||
m->declare("filters.lib/lowpass:author", "Julius O. Smith III");
|
||||
m->declare("filters.lib/lowpass:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
|
||||
m->declare("filters.lib/lowpass:license", "LicenseRef-STK-4.3");
|
||||
m->declare("filters.lib/name", "Faust Filters Library");
|
||||
m->declare("filters.lib/resonbp:author", "Julius O. Smith III");
|
||||
m->declare("filters.lib/resonbp:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
|
||||
m->declare("filters.lib/resonbp:license", "LicenseRef-STK-4.3");
|
||||
m->declare("filters.lib/svf:author", "Oleg Nesterov");
|
||||
m->declare("filters.lib/svf:copyright", "Copyright (C) 2020 Oleg Nesterov <oleg@redhat.com>");
|
||||
m->declare("filters.lib/svf:license", "LicenseRef-STK-4.3");
|
||||
m->declare("filters.lib/tf1s:author", "Julius O. Smith III");
|
||||
m->declare("filters.lib/tf1s:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
|
||||
m->declare("filters.lib/tf1s:license", "LicenseRef-STK-4.3");
|
||||
m->declare("filters.lib/tf2s:author", "Julius O. Smith III");
|
||||
m->declare("filters.lib/tf2s:copyright", "Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
|
||||
m->declare("filters.lib/tf2s:license", "LicenseRef-STK-4.3");
|
||||
m->declare("filters.lib/version", "1.13.4");
|
||||
m->declare("maths.lib/author", "GRAME");
|
||||
m->declare("maths.lib/copyright", "GRAME");
|
||||
m->declare("maths.lib/license", "LicenseRef-LGPL-2.1-or-later-with-Faust-exception");
|
||||
m->declare("maths.lib/name", "Faust Math Library");
|
||||
m->declare("maths.lib/version", "2.9.5");
|
||||
m->declare("name", "thruster");
|
||||
m->declare("noises.lib/name", "Faust Noise Generator Library");
|
||||
m->declare("noises.lib/version", "1.9.2");
|
||||
m->declare("oscillators.lib/lf_sawpos:author", "Bart Brouns, revised by Stéphane Letz");
|
||||
m->declare("oscillators.lib/lf_sawpos:licence", "LicenseRef-STK-4.3");
|
||||
m->declare("oscillators.lib/name", "Faust Oscillator Library");
|
||||
m->declare("oscillators.lib/saw2ptr:author", "Julius O. Smith III");
|
||||
m->declare("oscillators.lib/saw2ptr:license", "LicenseRef-STK-4.3");
|
||||
m->declare("oscillators.lib/sawN:author", "Julius O. Smith III");
|
||||
m->declare("oscillators.lib/sawN:license", "LicenseRef-STK-4.3");
|
||||
m->declare("oscillators.lib/version", "1.9.6");
|
||||
m->declare("platform.lib/name", "Generic Platform Library");
|
||||
m->declare("platform.lib/version", "1.3.2");
|
||||
m->declare("routes.lib/name", "Faust Signal Routing Library");
|
||||
m->declare("routes.lib/version", "1.4.1");
|
||||
m->declare("signals.lib/name", "Faust Routing Library");
|
||||
m->declare("signals.lib/version", "1.8.2");
|
||||
}
|
||||
|
||||
virtual int getNumInputs() {
|
||||
return 0;
|
||||
}
|
||||
virtual int getNumOutputs() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void classInit(int sample_rate) {
|
||||
ThrusterDspSIG0* sig0 = newThrusterDspSIG0();
|
||||
sig0->instanceInitThrusterDspSIG0(sample_rate);
|
||||
sig0->fillThrusterDspSIG0(65536, ftbl0ThrusterDspSIG0);
|
||||
deleteThrusterDspSIG0(sig0);
|
||||
}
|
||||
|
||||
virtual void instanceConstants(int sample_rate) {
|
||||
fSampleRate = sample_rate;
|
||||
fConst0 = std::min<float>(1.92e+05f, std::max<float>(5e+01f, static_cast<float>(fSampleRate)));
|
||||
fConst1 = 3.1415927f / fConst0;
|
||||
fConst2 = std::exp(-(5.0f / fConst0));
|
||||
fConst3 = 1.0f / fConst0;
|
||||
fConst4 = std::tan(std::max<float>(0.0f, std::min<float>(15.707963f / fConst0, 1.5676547f)));
|
||||
fConst5 = fConst4 + 1.4142135f;
|
||||
fConst6 = fConst4 * std::min<float>(3.4028235e+38f, 1.0f / (fConst4 * fConst5 + 1.0f));
|
||||
fConst7 = 2.0f * fConst6;
|
||||
fConst8 = 2.0f * fConst4;
|
||||
fConst9 = 0.175f * fConst0;
|
||||
fConst10 = 0.5f * fConst0;
|
||||
fConst11 = 3.0f / fConst0;
|
||||
fConst12 = std::tan(std::max<float>(0.0f, std::min<float>(543.49554f / fConst0, 1.5676547f)));
|
||||
fConst13 = fConst12 * std::min<float>(3.4028235e+38f, 1.0f / (fConst12 * (fConst12 + 0.05f) + 1.0f));
|
||||
fConst14 = -0.05f - fConst12;
|
||||
fConst15 = std::tan(std::max<float>(0.0f, std::min<float>(977.03534f / fConst0, 1.5676547f)));
|
||||
fConst16 = fConst15 * std::min<float>(3.4028235e+38f, 1.0f / (fConst15 * (fConst15 + 0.055555556f) + 1.0f));
|
||||
fConst17 = -0.055555556f - fConst15;
|
||||
fConst18 = std::tan(std::max<float>(0.0f, std::min<float>(1467.1238f / fConst0, 1.5676547f)));
|
||||
fConst19 = fConst18 * std::min<float>(3.4028235e+38f, 1.0f / (fConst18 * (fConst18 + 0.0625f) + 1.0f));
|
||||
fConst20 = -0.0625f - fConst18;
|
||||
fConst21 = std::tan(std::max<float>(0.0f, std::min<float>(3549.9998f / fConst0, 1.5676547f)));
|
||||
fConst22 = fConst21 * std::min<float>(3.4028235e+38f, 1.0f / (fConst21 * (fConst21 + 0.071428575f) + 1.0f));
|
||||
fConst23 = -0.071428575f - fConst21;
|
||||
}
|
||||
|
||||
virtual void instanceResetUserInterface() {
|
||||
fHslider0 = static_cast<FAUSTFLOAT>(1.2e+03f);
|
||||
}
|
||||
|
||||
virtual void instanceClear() {
|
||||
for (int l0 = 0; l0 < 2; l0 = faust_wrap_add(l0, 1)) {
|
||||
iVec0[l0] = 0;
|
||||
}
|
||||
for (int l1 = 0; l1 < 2; l1 = faust_wrap_add(l1, 1)) {
|
||||
fVec1[l1] = 0.0f;
|
||||
}
|
||||
for (int l2 = 0; l2 < 2; l2 = faust_wrap_add(l2, 1)) {
|
||||
fRec2[l2] = 0.0f;
|
||||
}
|
||||
for (int l3 = 0; l3 < 2; l3 = faust_wrap_add(l3, 1)) {
|
||||
iRec6[l3] = 0;
|
||||
}
|
||||
for (int l4 = 0; l4 < 2; l4 = faust_wrap_add(l4, 1)) {
|
||||
fRec4[l4] = 0.0f;
|
||||
}
|
||||
for (int l5 = 0; l5 < 2; l5 = faust_wrap_add(l5, 1)) {
|
||||
fRec5[l5] = 0.0f;
|
||||
}
|
||||
for (int l6 = 0; l6 < 2; l6 = faust_wrap_add(l6, 1)) {
|
||||
iRec8[l6] = 0;
|
||||
}
|
||||
for (int l7 = 0; l7 < 2; l7 = faust_wrap_add(l7, 1)) {
|
||||
iRec7[l7] = 0;
|
||||
}
|
||||
for (int l8 = 0; l8 < 2; l8 = faust_wrap_add(l8, 1)) {
|
||||
iRec10[l8] = 0;
|
||||
}
|
||||
for (int l9 = 0; l9 < 2; l9 = faust_wrap_add(l9, 1)) {
|
||||
iRec9[l9] = 0;
|
||||
}
|
||||
for (int l10 = 0; l10 < 2; l10 = faust_wrap_add(l10, 1)) {
|
||||
fVec2[l10] = 0.0f;
|
||||
}
|
||||
IOTA0 = 0;
|
||||
for (int l11 = 0; l11 < 4096; l11 = faust_wrap_add(l11, 1)) {
|
||||
fVec3[l11] = 0.0f;
|
||||
}
|
||||
for (int l12 = 0; l12 < 2; l12 = faust_wrap_add(l12, 1)) {
|
||||
fRec3[l12] = 0.0f;
|
||||
}
|
||||
for (int l13 = 0; l13 < 2; l13 = faust_wrap_add(l13, 1)) {
|
||||
fRec0[l13] = 0.0f;
|
||||
}
|
||||
for (int l14 = 0; l14 < 2; l14 = faust_wrap_add(l14, 1)) {
|
||||
fRec1[l14] = 0.0f;
|
||||
}
|
||||
for (int l15 = 0; l15 < 2; l15 = faust_wrap_add(l15, 1)) {
|
||||
fRec11[l15] = 0.0f;
|
||||
}
|
||||
for (int l16 = 0; l16 < 2; l16 = faust_wrap_add(l16, 1)) {
|
||||
fRec12[l16] = 0.0f;
|
||||
}
|
||||
for (int l19 = 0; l19 < 2; l19 = faust_wrap_add(l19, 1)) {
|
||||
iRec15[l19] = 0;
|
||||
}
|
||||
for (int l20 = 0; l20 < 2; l20 = faust_wrap_add(l20, 1)) {
|
||||
iRec14[l20] = 0;
|
||||
}
|
||||
for (int l21 = 0; l21 < 2; l21 = faust_wrap_add(l21, 1)) {
|
||||
fRec16[l21] = 0.0f;
|
||||
}
|
||||
for (int l22 = 0; l22 < 2; l22 = faust_wrap_add(l22, 1)) {
|
||||
fRec17[l22] = 0.0f;
|
||||
}
|
||||
for (int l23 = 0; l23 < 2; l23 = faust_wrap_add(l23, 1)) {
|
||||
fRec18[l23] = 0.0f;
|
||||
}
|
||||
for (int l24 = 0; l24 < 2; l24 = faust_wrap_add(l24, 1)) {
|
||||
fRec19[l24] = 0.0f;
|
||||
}
|
||||
for (int l25 = 0; l25 < 2; l25 = faust_wrap_add(l25, 1)) {
|
||||
fRec20[l25] = 0.0f;
|
||||
}
|
||||
for (int l26 = 0; l26 < 2; l26 = faust_wrap_add(l26, 1)) {
|
||||
fRec21[l26] = 0.0f;
|
||||
}
|
||||
for (int l27 = 0; l27 < 2; l27 = faust_wrap_add(l27, 1)) {
|
||||
fRec22[l27] = 0.0f;
|
||||
}
|
||||
for (int l28 = 0; l28 < 2; l28 = faust_wrap_add(l28, 1)) {
|
||||
fRec23[l28] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void init(int sample_rate) {
|
||||
classInit(sample_rate);
|
||||
instanceInit(sample_rate);
|
||||
}
|
||||
|
||||
virtual void instanceInit(int sample_rate) {
|
||||
instanceConstants(sample_rate);
|
||||
instanceResetUserInterface();
|
||||
instanceClear();
|
||||
}
|
||||
|
||||
virtual ThrusterDsp* clone() {
|
||||
return new ThrusterDsp(*this);
|
||||
}
|
||||
|
||||
virtual int getSampleRate() {
|
||||
return fSampleRate;
|
||||
}
|
||||
|
||||
virtual void buildUserInterface(UI* ui_interface) {
|
||||
ui_interface->openVerticalBox("thruster");
|
||||
ui_interface->addHorizontalSlider("rpm", &fHslider0, FAUSTFLOAT(1.2e+03f), FAUSTFLOAT(3e+02f), FAUSTFLOAT(6e+03f), FAUSTFLOAT(1.0f));
|
||||
ui_interface->closeBox();
|
||||
}
|
||||
|
||||
virtual void compute(int count, FAUSTFLOAT** RESTRICT inputs, FAUSTFLOAT** RESTRICT outputs) {
|
||||
FAUSTFLOAT* output0 = outputs[0];
|
||||
float fSlow0 = static_cast<float>(fHslider0);
|
||||
float fSlow1 = fSlow0 + -3e+02f;
|
||||
for (int i0 = 0; i0 < count; i0 = faust_wrap_add(i0, 1)) {
|
||||
iVec0[0] = 1;
|
||||
fVec1[0] = fSlow0;
|
||||
fRec2[0] = fConst2 * (std::min<float>(3.4028235e+38f, fVec1[1] - fSlow0) + fRec2[1]);
|
||||
float fTemp0 = fSlow0 + fRec2[0];
|
||||
float fTemp1 = 28.0f + 0.025f * fTemp0;
|
||||
float fTemp2 = fSlow1 + fRec2[0];
|
||||
float fTemp3 = 0.0001754386f * fTemp2;
|
||||
float fTemp4 = std::tan(std::max<float>(0.0f, std::min<float>(fConst1 * (6e+01f + 2.5f * fTemp1 + 1.4e+02f * (1.0f - fTemp3)), 1.5676547f)));
|
||||
iRec6[0] = faust_wrap_add(12345, faust_wrap_mul(1103515245, iRec6[1]));
|
||||
float fTemp5 = 4.656613e-10f * static_cast<float>(iRec6[0]);
|
||||
float fTemp6 = fTemp5 - (fConst5 * fRec4[1] + fRec5[1]);
|
||||
fRec4[0] = fRec4[1] + fConst7 * fTemp6;
|
||||
float fTemp7 = fRec4[1] + fConst6 * fTemp6;
|
||||
fRec5[0] = fRec5[1] + fConst8 * fTemp7;
|
||||
float fTemp8 = fTemp1 * (1.0f + 0.014f * (fRec5[1] + fConst4 * fTemp7));
|
||||
float fTemp9 = std::fabs(fTemp8);
|
||||
float fTemp10 = fConst3 * fTemp9;
|
||||
float fTemp11 = 1.0737418e+09f * (fTemp10 - std::floor(fTemp10));
|
||||
float fTemp12 = std::floor(fTemp11);
|
||||
int iTemp13 = faust_wrap_add(iRec8[1], static_cast<int>(16777216.0f * (fTemp11 - fTemp12)));
|
||||
iRec8[0] = iTemp13 & 16777215;
|
||||
int iTemp14 = faust_wrap_add(faust_wrap_add(iRec7[1], static_cast<int>(fTemp12)), iTemp13 >> 24);
|
||||
int iTemp15 = iTemp14 & 1073741823;
|
||||
iRec7[0] = iTemp15;
|
||||
float fTemp16 = static_cast<float>(iTemp15);
|
||||
int iTemp17 = faust_wrap_sub(1, iVec0[1]);
|
||||
float fTemp18 = std::max<float>(0.5f * fTemp8, 23.44895f);
|
||||
float fTemp19 = std::max<float>(2e+01f, std::fabs(fTemp18));
|
||||
float fTemp20 = fConst3 * fTemp19;
|
||||
float fTemp21 = 1.0737418e+09f * (fTemp20 - std::rint(fTemp20));
|
||||
float fTemp22 = std::floor(fTemp21);
|
||||
int iTemp23 = faust_wrap_add(iRec10[1], static_cast<int>(16777216.0f * (fTemp21 - fTemp22)));
|
||||
iRec10[0] = ((iTemp17) ? 0 : iTemp23 & 16777215);
|
||||
iRec9[0] = ((iTemp17) ? 0 : (faust_wrap_add(faust_wrap_add(iRec9[1], static_cast<int>(fTemp22)), iTemp23 >> 24)) & 1073741823);
|
||||
float fTemp24 = ThrusterDsp_faustpower2_f(-1.0f + 1.1920929e-07f * static_cast<float>(iRec9[0] >> 6));
|
||||
fVec2[0] = fTemp24;
|
||||
float fTemp25 = static_cast<float>(iVec0[1]) * (fTemp24 - fVec2[1]) / fTemp19;
|
||||
fVec3[IOTA0 & 4095] = fTemp25;
|
||||
float fTemp26 = std::max<float>(0.0f, std::min<float>(8191.0f, fConst10 / fTemp18));
|
||||
int iTemp27 = static_cast<int>(fTemp26);
|
||||
float fTemp28 = std::floor(fTemp26);
|
||||
float fTemp29 = 1.0f + fTemp4;
|
||||
float fTemp30 = fTemp4 * (-1.0f - (fTemp10 + fRec3[1]) + 2.0f * ((iTemp14 > 1073741823) ? 1.0f + 9.313226e-10f * fTemp16 * (1.0f - fConst0 / std::max<float>(1.1920929e-07f, fTemp9)) : 9.313226e-10f * fTemp16) + fConst9 * (fTemp25 - fVec3[(faust_wrap_sub(IOTA0, iTemp27)) & 4095] * (1.0f - fTemp26 + fTemp28) - (fTemp26 - fTemp28) * fVec3[(faust_wrap_sub(IOTA0, faust_wrap_add(1, iTemp27))) & 4095])) * std::min<float>(3.4028235e+38f, 1.0f / fTemp29);
|
||||
fRec3[0] = fRec3[1] + 2.0f * fTemp30;
|
||||
float fTemp31 = fTemp4 * (fRec3[1] + fTemp30 - (fTemp29 * fRec0[1] + fRec1[1])) * std::min<float>(3.4028235e+38f, 1.0f / (1.0f + fTemp4 * fTemp29));
|
||||
fRec0[0] = fRec0[1] + 2.0f * fTemp31;
|
||||
float fTemp32 = fTemp4 * (fRec0[1] + fTemp31);
|
||||
fRec1[0] = fRec1[1] + 2.0f * fTemp32;
|
||||
float fTemp33 = 8.77193e-05f * fTemp2;
|
||||
float fTemp34 = std::tan(std::max<float>(0.0f, std::min<float>(fConst1 * (7e+02f + 0.6f * fTemp0), 1.5676547f)));
|
||||
float fTemp35 = fRec11[1] + fTemp34 * (fTemp5 + fRec11[1] * (-0.6666667f - fTemp34) - fRec12[1]) * std::min<float>(3.4028235e+38f, 1.0f / (1.0f + fTemp34 * (0.6666667f + fTemp34)));
|
||||
fRec11[0] = 2.0f * fTemp35 - fRec11[1];
|
||||
fRec12[0] = 2.0f * (fRec12[1] + fTemp34 * fTemp35) - fRec12[1];
|
||||
float fTemp36 = fConst11 * fTemp8;
|
||||
float fTemp37 = 1.0737418e+09f * (fTemp36 - std::rint(fTemp36));
|
||||
float fTemp38 = std::floor(fTemp37);
|
||||
int iTemp39 = faust_wrap_add(iRec15[1], static_cast<int>(16777216.0f * (fTemp37 - fTemp38)));
|
||||
iRec15[0] = ((iTemp17) ? 0 : iTemp39 & 16777215);
|
||||
iRec14[0] = ((iTemp17) ? 0 : (faust_wrap_add(faust_wrap_add(iRec14[1], static_cast<int>(fTemp38)), iTemp39 >> 24)) & 1073741823);
|
||||
float fTemp40 = fRec16[1] + fConst13 * (fTemp5 + fConst14 * fRec16[1] - fRec17[1]);
|
||||
fRec16[0] = 2.0f * fTemp40 - fRec16[1];
|
||||
fRec17[0] = 2.0f * (fRec17[1] + fConst12 * fTemp40) - fRec17[1];
|
||||
float fTemp41 = fRec18[1] + fConst16 * (fTemp5 + fConst17 * fRec18[1] - fRec19[1]);
|
||||
fRec18[0] = 2.0f * fTemp41 - fRec18[1];
|
||||
fRec19[0] = 2.0f * (fRec19[1] + fConst15 * fTemp41) - fRec19[1];
|
||||
float fTemp42 = fRec20[1] + fConst19 * (fTemp5 + fConst20 * fRec20[1] - fRec21[1]);
|
||||
fRec20[0] = 2.0f * fTemp42 - fRec20[1];
|
||||
fRec21[0] = 2.0f * (fRec21[1] + fConst18 * fTemp42) - fRec21[1];
|
||||
float fTemp43 = fRec22[1] + fConst22 * (fTemp5 + fConst23 * fRec22[1] - fRec23[1]);
|
||||
fRec22[0] = 2.0f * fTemp43 - fRec22[1];
|
||||
fRec23[0] = 2.0f * (fRec23[1] + fConst21 * fTemp43) - fRec23[1];
|
||||
output0[i0] = static_cast<FAUSTFLOAT>(0.425f * tanhf(((fRec1[1] + fTemp32) * (0.5f + fTemp33) + 0.5f * fTemp35 * (1.0f + ThrusterDsp_faustpower2_f(ftbl0ThrusterDspSIG0[std::max<int>(0, std::min<int>(static_cast<int>(0.00390625f * static_cast<float>(iRec14[0] >> 6)), 65535))])) * (0.05f + 0.00030701753f * fTemp2) + 0.25f * tanhf(12.0f * (fTemp40 * (0.3f + 0.00012280702f * fTemp2) + 0.8f * fTemp41 + 0.6f * fTemp42 + 0.4f * fTemp43) * (0.015f + 0.985f * ThrusterDsp_faustpower2_f(fTemp3)))) * (0.4f + 0.000105263156f * fTemp2) * (0.9f - fTemp33)));
|
||||
iVec0[1] = iVec0[0];
|
||||
fVec1[1] = fVec1[0];
|
||||
fRec2[1] = fRec2[0];
|
||||
iRec6[1] = iRec6[0];
|
||||
fRec4[1] = fRec4[0];
|
||||
fRec5[1] = fRec5[0];
|
||||
iRec8[1] = iRec8[0];
|
||||
iRec7[1] = iRec7[0];
|
||||
iRec10[1] = iRec10[0];
|
||||
iRec9[1] = iRec9[0];
|
||||
fVec2[1] = fVec2[0];
|
||||
IOTA0 = faust_wrap_add(IOTA0, 1);
|
||||
fRec3[1] = fRec3[0];
|
||||
fRec0[1] = fRec0[0];
|
||||
fRec1[1] = fRec1[0];
|
||||
fRec11[1] = fRec11[0];
|
||||
fRec12[1] = fRec12[0];
|
||||
iRec15[1] = iRec15[0];
|
||||
iRec14[1] = iRec14[0];
|
||||
fRec16[1] = fRec16[0];
|
||||
fRec17[1] = fRec17[0];
|
||||
fRec18[1] = fRec18[0];
|
||||
fRec19[1] = fRec19[0];
|
||||
fRec20[1] = fRec20[0];
|
||||
fRec21[1] = fRec21[0];
|
||||
fRec22[1] = fRec22[0];
|
||||
fRec23[1] = fRec23[0];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue