S4 Tier 0: the bank plays — VST3 marshals MIDI to the S3 core, reads the live bank + resolves WAV the M4 way, mono downmix, lock-free load handoff, LICE sample-pick

This commit is contained in:
2026-07-26 16:43:04 -04:00
parent b0fc052113
commit 0cde457224
24 changed files with 1239 additions and 302 deletions
+21 -9
View File
@@ -13,21 +13,27 @@
#pragma once
#include <string>
#include <vector>
#include "public.sdk/source/common/pluginview.h"
#include "sample_map.h" // SampleChoice (the list the editor draws)
#ifdef _WIN32
#include <windows.h>
#endif
namespace reasampler::vst {
class ReaperBridge;
class ReaSamplerProcessor;
class ReaSamplerEditor : public Steinberg::CPluginView {
public:
// `bridge` is owned by the processor and outlives the editor; the editor reads
// (never mutates) it to show a live-state readout. May be null (non-REAPER host).
explicit ReaSamplerEditor(ReaperBridge* bridge);
// `processor` owns this editor's lifetime domain and outlives it; the editor reads
// the live bank through it (the sample list) and drives selection + reload when the
// user clicks a row. May be null (defensive — a real host always supplies one).
explicit ReaSamplerEditor(ReaSamplerProcessor* processor);
~ReaSamplerEditor() override;
// Accept only the Windows HWND platform type (D5: Windows-only).
@@ -48,7 +54,7 @@ private:
#ifdef _WIN32
// Draw the current surface into the child window's DC via a LICE bitmap.
void paint(HDC hdc);
// Route a client-space click through editor_geometry::hitTest.
// Route a client-space click: select the sample row under (x, y), if any.
void onClick(int x, int y);
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -56,10 +62,16 @@ private:
HWND childHwnd_ = nullptr;
#endif
ReaperBridge* bridge_ = nullptr;
// Latched on click so the paint reflects the last hit-test result — the spike's
// proof that host->click->draw routing round-trips.
bool buttonHit_ = false;
// Re-read the bank's sample list from the live bridge into `samples_`. Main/UI
// thread only (reads ext-state); called on attach and after a selection reload.
void refreshSampleList();
ReaSamplerProcessor* processor_ = nullptr;
// The bank's samples, snapshotted for the current paint. Refreshed off the audio
// thread; the paint just draws it.
std::vector<SampleChoice> samples_;
// The currently-selected sample id, mirrored for the paint's highlight.
std::string selectedId_;
};
} // namespace reasampler::vst