- 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>
46 lines
1.8 KiB
C++
46 lines
1.8 KiB
C++
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
#pragma once
|
|
|
|
// SampleStore.Sample (SampleStore.kt): decoded mono PCM at its own rate, shared by
|
|
// the Sampler / SoundFont voice (core/src/sampler) and the Grain Cloud's custom
|
|
// source (core/src/echofield).
|
|
|
|
#include <atomic>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
namespace sizzle {
|
|
|
|
struct Sample {
|
|
std::vector<float> data;
|
|
int sampleRate = 0;
|
|
/** Sample-loop points in frames (from an SF2/XI file), or -1 when the source has
|
|
* none; the SoundFont voice uses them for sustain looping. */
|
|
int loopStart = -1;
|
|
int loopEnd = -1;
|
|
/** Players currently holding this sample across audio blocks (SampleVoice pins
|
|
* it from noteOn until it lets go). sampler::SampleStore frees a removed sample
|
|
* only once this is 0, which is what "a voice keeps its own reference" means in
|
|
* the Kotlin. Not copied: a copy is a new, unpinned sample. */
|
|
mutable std::atomic<int> users{0};
|
|
|
|
Sample() = default;
|
|
Sample(std::vector<float> d, int rate, int ls = -1, int le = -1)
|
|
: data(std::move(d)), sampleRate(rate), loopStart(ls), loopEnd(le) {}
|
|
Sample(const Sample &o)
|
|
: data(o.data), sampleRate(o.sampleRate), loopStart(o.loopStart), loopEnd(o.loopEnd) {}
|
|
Sample(Sample &&o) noexcept
|
|
: data(std::move(o.data)), sampleRate(o.sampleRate), loopStart(o.loopStart), loopEnd(o.loopEnd) {}
|
|
Sample &operator=(const Sample &o) {
|
|
data = o.data; sampleRate = o.sampleRate; loopStart = o.loopStart; loopEnd = o.loopEnd;
|
|
return *this;
|
|
}
|
|
Sample &operator=(Sample &&o) noexcept {
|
|
data = std::move(o.data); sampleRate = o.sampleRate; loopStart = o.loopStart; loopEnd = o.loopEnd;
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
} // namespace sizzle
|