Update CONTEXT.md capture sections to two FX scopes (item/track, chain-independent, no master, always wet): build-order step 7, offline/realtime render API surface, the capture module sketch, and mark the realtime wet-master-routing open question resolved (track-tap).
ReaSampler
A native C++ REAPER extension that captures any arbitrary audio source into a per-project sample bank (cached files + a docked grid), decoupled from the arrange view, with keyboard/MIDI-bindable capture and placement. Built as a precision tool: deterministic, non-destructive, no clutter.
This is a skeleton: the loading contract, build system, and the testable pure-core library are wired up. The bank panel, capture backend, and remaining module set are stubbed with clearly marked seams.
Layout
src/main.cpp The REAPER<->extension contract: the single file that
#defines REAPERAPI_IMPLEMENT, resolves API pointers,
and holds the action-registration seam (commented,
ready to reinstate under the CEREBELLUM_REASAMPLER_
prefix). Logs "ReaSampler loaded." on startup.
src/bank_model.{h,cpp} Pure, REAPER-free core: the Sample metadata struct and
BankIndex (add / remove / query / tier moves /
dedup-by-hash + JSON round-trip). This is the heart;
everything else hangs off it. Currently an M0
placeholder — the full implementation is Milestone 1.
tests/test_bank_model.cpp Standalone tests for bank_model — no REAPER needed.
vendor/ git submodules go here (see below).
Target module set (milestones ahead — see PLAN.md):
bank_model Sample metadata + BankIndex + JSON (pure)
peaks Waveform min/max bins from raw PCM (pure)
capture ICaptureBackend: OfflineRenderBackend + RealtimeRecordBackend
insert InsertMedia-based placement (explicit tempo-conform flag)
bank_panel Docked LICE-drawn grid: thumbnails, audition, multi-select
persist Project ext state <-> bank_model JSON; project-relative paths
actions Bindable capture / placement / slot action family
One-time setup
git submodule update --init
Vendors two submodules:
vendor/reaper-sdk—sdk/reaper_plugin.h,sdk/reaper_plugin_functions.h, SWELL headersvendor/WDL— WDL utilities and the SWELL cross-platform Win32 layer
Build
cmake -B build -S .
cmake --build build
Targets:
bank_model_tests— run withctest --test-dir build(or run the binary). This is your fast loop: iterate the pure core without touching REAPER.reaper_reasampler— the extension binary.
macOS / Linux dialog resources
When bank_panel is added (Milestone 5), resource.rc will need SWELL's resgen
once (Win32 compiles it directly). Generate the SWELL dialog source and add it to
the non-Windows build:
php vendor/WDL/WDL/swell/mac_resgen.php src/resource.rc # macOS
# (Linux uses the same generated output.)
Then add the generated file to the APPLE / Linux target_sources blocks in
CMakeLists.txt. The SWS extension's build is the canonical reference if you get
stuck here — it's the fiddliest step and only bites once.
Install / test
Copy the built binary into REAPER's UserPlugins/ folder
(Options -> Show REAPER resource path), then restart REAPER (extensions load
at startup; there is no hot reload). The extension logs "ReaSampler loaded." to
the REAPER console on startup; no actions are registered yet.
Debug by attaching your debugger to the REAPER process. ShowConsoleMsg is a
quick printf.
Where to build next
See PLAN.md for the full milestone roadmap and TODO.md for the near-term slice.
The current first work is Milestone 1 — flesh out bank_model: define the full
Sample field set, implement BankIndex (add / remove / query / tier / dedup),
add JSON serialize/deserialize, and drive it all through the existing CTest harness.