0.41.2 (78): cleanup and optimisation round (Android and iOS)

Nothing user-visible changes, except that the Android app is half the size and
both are lighter on the battery.

R8 is on for release builds (21.5 MB -> 10.1 MB); only the two JNI classes are
pinned by name, since the app reflects over nothing of its own, and `make dist`
keeps the mapping beside the APK. The Kotlin DSP that core/ replaced in 0.37.0
was still compiled into every APK with nothing calling it — it moves to the test
source set, where it belongs as the reference the C++ is checked against — and
the golden tests' TestVoice wrappers leave core/src for core/tests/voices, so
neither app compiles them either.

Speed: channel gain, mute/solo and the FX chain are read once per audio block
instead of once per frame in Engine::fillBlock (both platforms, bit-identical —
all 61 reference scenarios still match); the transport pollers idle at 100 ms
(Android) and 10 Hz (iOS) instead of polling flat out while a song is stopped,
woken by any transport call; ProjectIo.save builds into one pre-sized buffer and
a burst of edits is coalesced into one engine sync; the Kotlin grain sources and
factory wavetables are built when their editor opens rather than at launch, where
they duplicated ~6 MB the engine already renders in core/; and Xcode builds the
DSP core at -O2, the level the golden tests measure, not -Os.

Fix: `make lint` failed on a manifest asking for ACCESS_FINE_LOCATION without
ACCESS_COARSE_LOCATION (the BLE MIDI scan on Android 8-11), so `make check`
passes again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Reactorcoremeltdown
2026-11-18 21:01:29 +01:00
co-authored by Claude Opus 5
parent 634dd05486
commit ba98ec56f4
46 changed files with 508 additions and 192 deletions
+57
View File
@@ -0,0 +1,57 @@
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
// The hook the reference tests use to play a note script through one instrument
// voice (see IosGoldenInstruments.kt and tests/golden_test.cpp). Each instrument
// port provides its maker (strong definition) in its own source file; the weak
// placeholders in src/TestVoices.cpp return nullptr for kinds not ported yet.
#include <memory>
#include "sizzle/Params.hpp"
namespace sizzle {
class TestVoice {
public:
virtual ~TestVoice() = default;
/** Called before each block of [frames] (AudioEngine advances shared clocks
* such as the Morph Pad's FrasilClock here). */
virtual void blockStart(int frames) { (void)frames; }
virtual void noteOn(int midi, int velocity) = 0;
virtual void noteOff(int midi) = 0;
virtual float render() = 0;
};
struct TestVoiceSetup {
const char *type; // ToolboxType name, e.g. "MORPH_PAD"
const Params *params; // the slot's values
int sampleRate;
float tempoBpm;
double clock0; // FrasilClock.seconds when the scenario started
// kind "SAMPLE": the test sample (mono), its rate and loop points (-1 = none)
const float *sample = nullptr;
int sampleLength = 0;
int sampleRate2 = 0;
int loopStart = -1, loopEnd = -1;
// Kotlin's global seed counters right before the scenario built its voices
// (FrasilVoice, GrainCloud): a SynthVoice's Morph Pad voice takes the next
// Frasil seed, then the FRASIL kind's voice, then the GrainCloud the next grain one.
uint32_t frasilSeeds = 0, grainSeeds = 0;
};
/** kind "SYNTH": SynthVoice with the engine's patch for [setup.type]. */
std::unique_ptr<TestVoice> makeSynthTestVoice(const TestVoiceSetup &setup);
/** kind "FRASIL": FrasilVoice alone (Morph Pad). */
std::unique_ptr<TestVoice> makeFrasilTestVoice(const TestVoiceSetup &setup);
/** kind "WAVE": WaveVoice alone (Wavetable). */
std::unique_ptr<TestVoice> makeWaveTestVoice(const TestVoiceSetup &setup);
/** kind "GRAIN": GrainCloud (Grain Cloud), notes owned by live input. */
std::unique_ptr<TestVoice> makeGrainTestVoice(const TestVoiceSetup &setup);
/** kind "SAMPLE": SampleVoice with the engine's voiceSample() settings for
* [setup.type] (SAMPLER: pads by note; SOUNDFONT: sfRoot, envelope, loop). */
std::unique_ptr<TestVoice> makeSampleTestVoice(const TestVoiceSetup &setup);
std::unique_ptr<TestVoice> makeTestVoice(const char *kind, const TestVoiceSetup &setup);
} // namespace sizzle