Fix drag-out losing audio and FX-container drops losing the capture; re-home ingest under shell/actions

This commit is contained in:
2026-07-29 23:49:53 -04:00
parent a689fb75eb
commit 0800760833
16 changed files with 269 additions and 45 deletions
+50
View File
@@ -0,0 +1,50 @@
#pragma once
// ingest — the "ingest through the bank" shell (EXTENSION side). REAPER-facing
// (PCM_Source metadata reads, Media-Explorer query, ext-state assignment write,
// action registration), so DAW-verified, not unit-tested; the pure serialization it
// drives lives in assignment_request (CTest).
//
// Loading a sample into the sampler is ONE gesture: capture/import-into-bank AND
// auto-assign to the active sampler instance. The EXTENSION owns ingest (arrange
// access, Media-Explorer access, drop-target surface); the instrument stays a
// READ-ONLY bank consumer. Three surfaces: (1) arrange capture -> bank -> assign,
// (2) Media-Explorer import -> bank -> assign (single-file, pull-on-action), (3)
// drop-onto-panel -> bank -> assign (multi-file: import all, assign the first).
//
// LOAD-BEARING: ingest NEVER inserts a timeline item — capture writes a file + index
// entry, import copies a file + adds an index entry, assignment is a bank-index +
// instance-selection act, not a placement. Any InsertMedia call here is a bug.
//
// Import is a FILE COPY into the project-relative bank folder + an index add
// (relative-paths-only, hash-dedup). If the active bank already holds the content
// (by hash), the import collapses onto the existing sample instead of duplicating.
#include <string>
#include <vector>
// Forward declarations keep this header REAPER-free (the .cpp pulls the SDK).
struct reaper_plugin_info_t;
namespace reasampler {
class ReaSamplerSession;
// `session` is shared with the capture / bank / Design-View families; the single
// hookcommand in main.cpp routes fired ids here via ingestHandleCommand.
void ingestRegisterActions(reaper_plugin_info_t* rec, ReaSamplerSession* session);
bool ingestHandleCommand(int command);
void ingestUnregisterActions(reaper_plugin_info_t* rec);
// "The active sampler instance should now play (bankId, sampleId)." Called by EVERY
// ingest surface after the sample lands in the bank. No-op-safe: an unsaved/no-active
// project silently drops the write; `sampleId` empty -> no write.
void ingestAssignActiveInstance(const std::string& bankId, const std::string& sampleId);
// Called by the bank_panel's WM_DROPFILES handler. Imports EVERY file into the
// active bank (hash-dedup) and assigns the FIRST successfully-imported sample to the
// active instance. No-op on an empty list or an unsaved/no-active project.
void ingestDroppedFiles(const std::vector<std::string>& absolutePaths);
} // namespace reasampler