fix(drop-fx): inject via .vstpreset + TrackFX_SetPreset (vst_chunk is REAPER-framed, raw bytes silently no-op); FX hotspot now prefix tcp.fx*/mcp.fx*/fx_*

This commit is contained in:
2026-07-28 06:19:29 -04:00
parent 104a25f390
commit b4dd6dc9f1
11 changed files with 494 additions and 344 deletions
+7 -7
View File
@@ -22,8 +22,8 @@
#include "bank_model.h" // Sample, AddResult, findByHash
#include "bank_panel.h" // bankPanelRefresh
#include "capture_paths.h" // deriveBankPaths / projectDirOfRpp / hashWavContent
#include "instrument_drop.h" // pure buildInstrumentDropChunk (vst_chunk blob for a sampleId)
#include "instrument_drop_win.h" // shell loadInstrumentOntoTrack (FX add+inject, no own undo block)
#include "instrument_drop.h" // pure buildInstrumentDropPreset (.vstpreset image for a sampleId)
#include "instrument_drop_win.h" // shell loadInstrumentOntoTrack (FX add+apply, no own undo block)
#include "persist.h" // ReaSamplerSession
#include "wav_trim.h" // parseWavLayout — 32f-float WAV validator for the fast path
@@ -494,10 +494,10 @@ void doImportFromMediaExplorer() {
return;
}
// Build the pre-loaded instrument blob for the resolved sampleId. Valid for BOTH the fresh
// import and the dedup case (added == false but a real sampleId) — the user asked for a
// player, and a valid sampleId is sufficient to pre-select the sound.
const std::string chunk = buildInstrumentDropChunk(r.sampleId);
// Build the pre-loaded instrument payload (a .vstpreset image) for the resolved sampleId.
// Valid for BOTH the fresh import and the dedup case (added == false but a real sampleId)
// — the user asked for a player, and a valid sampleId is sufficient to pre-select the sound.
const std::vector<std::uint8_t> preset = buildInstrumentDropPreset(r.sampleId);
// One undo point for the whole gesture. Persist happens INSIDE the block and BEFORE the
// FX add so the new instance's setState -> reloadFromBank sees the just-persisted sample.
@@ -515,7 +515,7 @@ void doImportFromMediaExplorer() {
g_session->bumpBankGeneration();
persisted = g_session->saveToActiveProject();
}
const bool placed = loadInstrumentOntoTrack(target, chunk);
const bool placed = loadInstrumentOntoTrack(target, preset);
if (placed && persisted)
Undo_EndBlock2(nullptr, "ReaSampler: import from Media Explorer into selected track",
UNDO_STATE_MISCCFG);