0.41.1 (77): 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:
co-authored by
Claude Opus 5
parent
cdabf3018b
commit
dd04a61e22
@@ -19,7 +19,6 @@ public:
|
||||
bool resetOnBar = false;
|
||||
int genStamp = -1;
|
||||
|
||||
int noteCount() const { return noteCount_; }
|
||||
/** Active while it holds at least one note. */
|
||||
bool active() const { return noteCount_ > 0; }
|
||||
|
||||
|
||||
@@ -605,6 +605,24 @@ void Engine::Impl::fillBlock(float *out, int frames) {
|
||||
auditionCloudActive = auditionCloud->isActive();
|
||||
for (int i = 0; i < (int)auditionSampleVoices.size(); ++i) if (auditionSampleVoices[i]->isActive()) actASmp[actASmpN++] = i;
|
||||
|
||||
// Per-channel mixer state is read once per block, not once per sample: mute,
|
||||
// solo and volume cannot change inside a block (the UI's edits land through
|
||||
// syncProjectText between blocks), so this is the same audio with 4 loads and
|
||||
// 4 branches lifted out of a 48 000-iteration loop. The FX chain pointers come
|
||||
// out too, so the per-sample inner loop walks a plain pointer range.
|
||||
float chGain[TRACK_COUNT] = {0.f, 0.f, 0.f, 0.f};
|
||||
bool chLimit[TRACK_COUNT] = {false, false, false, false};
|
||||
FxUnit *chFxBegin[TRACK_COUNT] = {nullptr, nullptr, nullptr, nullptr};
|
||||
FxUnit *chFxEnd[TRACK_COUNT] = {nullptr, nullptr, nullptr, nullptr};
|
||||
if (proj) {
|
||||
for (int ch = 0; ch < TRACK_COUNT; ++ch) {
|
||||
const auto &mc = proj->mixer.channels[ch];
|
||||
chGain[ch] = mc.audible(anySolo) ? mc.volume : 0.f;
|
||||
chLimit[ch] = mc.limiter;
|
||||
chFxBegin[ch] = chains->ch[ch].data();
|
||||
chFxEnd[ch] = chFxBegin[ch] + chains->ch[ch].size();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < frames; ++i) {
|
||||
if (playing.load(std::memory_order_relaxed) && proj) advanceSequencer(*proj);
|
||||
|
||||
@@ -618,11 +636,10 @@ void Engine::Impl::fillBlock(float *out, int frames) {
|
||||
for (int k = 0; k < actBSmpN; ++k) { const int vi = actBSmp[k]; channelSum[vi / BUS_POLYPHONY] += busSampleVoices[vi]->render(); }
|
||||
for (int ch = 0; ch < TRACK_COUNT; ++ch) if (cloudOn[ch]) channelSum[ch] += clouds[ch]->render();
|
||||
for (int ch = 0; ch < TRACK_COUNT; ++ch) {
|
||||
const auto &mc = proj->mixer.channels[ch];
|
||||
float s = mc.audible(anySolo) ? channelSum[ch] * mc.volume : 0.f;
|
||||
for (FxUnit &u : chains->ch[ch]) s = u.effect->process(s);
|
||||
float s = channelSum[ch] * chGain[ch];
|
||||
for (FxUnit *u = chFxBegin[ch]; u != chFxEnd[ch]; ++u) s = u->effect->process(s);
|
||||
if (!std::isfinite(s)) s = 0.f;
|
||||
if (mc.limiter) s = softClip(s);
|
||||
if (chLimit[ch]) s = softClip(s);
|
||||
const float a = s < 0.f ? -s : s;
|
||||
if (a > chBlockPeak[ch]) chBlockPeak[ch] = a;
|
||||
mixL += s; mixR += s;
|
||||
@@ -636,6 +653,8 @@ void Engine::Impl::fillBlock(float *out, int frames) {
|
||||
const float oR = limOutR;
|
||||
out[2 * i] = oL;
|
||||
out[2 * i + 1] = oR;
|
||||
// Checked per sample, not hoisted: recordSample itself clears recCapturing
|
||||
// when a take's FX tail runs out, and must not be called again after that.
|
||||
if (recCapturing.load(std::memory_order_relaxed) && sink) recordSample(proj, oL, oR);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,8 +93,6 @@ public:
|
||||
void kill();
|
||||
/** Follow edits while sounding: the values glide there over ~25 ms. */
|
||||
void setPatch(const FrasilPatch &p) { patch = p; }
|
||||
/** A gliding engine value now (a defs index), for tests. */
|
||||
float valueForTest(int i) const { return cur[i]; }
|
||||
float render();
|
||||
|
||||
private:
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "sizzle/Effect.hpp"
|
||||
#include "sizzle/TestVoice.hpp"
|
||||
#include "voices/TestVoice.hpp"
|
||||
#include "wavetable/WaveTables.hpp"
|
||||
|
||||
using namespace sizzle;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <cmath>
|
||||
#include "frasil/FrasilVoice.hpp"
|
||||
#include "sizzle/TestVoice.hpp"
|
||||
#include "TestVoice.hpp"
|
||||
|
||||
namespace sizzle {
|
||||
namespace {
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "GrainCloud.hpp"
|
||||
#include "GrainSources.hpp"
|
||||
#include "sizzle/TestVoice.hpp"
|
||||
#include "echofield/GrainCloud.hpp"
|
||||
#include "echofield/GrainSources.hpp"
|
||||
#include "TestVoice.hpp"
|
||||
|
||||
namespace sizzle {
|
||||
namespace {
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "SampleStore.hpp"
|
||||
#include "SampleVoice.hpp"
|
||||
#include "sizzle/TestVoice.hpp"
|
||||
#include "sampler/SampleStore.hpp"
|
||||
#include "sampler/SampleVoice.hpp"
|
||||
#include "TestVoice.hpp"
|
||||
|
||||
namespace sizzle {
|
||||
namespace {
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include "frasil/FrasilVoice.hpp"
|
||||
#include "sizzle/TestVoice.hpp"
|
||||
#include "TestVoice.hpp"
|
||||
#include "synth/SynthVoice.hpp"
|
||||
#include "wavetable/WaveTables.hpp"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// definition replaces its placeholder at link time.
|
||||
|
||||
#include <cstring>
|
||||
#include "sizzle/TestVoice.hpp"
|
||||
#include "TestVoice.hpp"
|
||||
|
||||
#define SIZZLE_TEST_MAKER(fn) \
|
||||
__attribute__((weak)) std::unique_ptr<TestVoice> fn(const TestVoiceSetup &) { return nullptr; }
|
||||
@@ -5,9 +5,9 @@
|
||||
// WaveVoice alone, patch from the slot, factory tables built up front.
|
||||
|
||||
#include <memory>
|
||||
#include "sizzle/TestVoice.hpp"
|
||||
#include "WaveTables.hpp"
|
||||
#include "WaveVoice.hpp"
|
||||
#include "TestVoice.hpp"
|
||||
#include "wavetable/WaveTables.hpp"
|
||||
#include "wavetable/WaveVoice.hpp"
|
||||
|
||||
namespace sizzle {
|
||||
namespace {
|
||||
Reference in New Issue
Block a user