Take the read-back back out of the persist; a write verdict belongs only where evidence crosses the plugin boundary
Its false gated six undo points, so an unverified byte-equality assumption could have silently removed Ctrl-Z for a bank mutation that landed.
This commit is contained in:
@@ -305,6 +305,16 @@ ImportResult importFileIntoActiveBank(const std::string& absoluteSourcePath) {
|
||||
return out;
|
||||
}
|
||||
|
||||
// The clause an ingest success line needs when the persist no-opped. saveToActiveProject
|
||||
// returns false for exactly two reasons, no active project and an unsaved one, and in both
|
||||
// the copied file is on disk with its entry in memory while NOTHING stored the index — so
|
||||
// no message may report the import flatly.
|
||||
std::string unsavedProjectNote(bool persisted) {
|
||||
if (persisted) return {};
|
||||
return " The bank index is IN MEMORY ONLY -- there is no saved project to store it in, "
|
||||
"so save the project to keep it.";
|
||||
}
|
||||
|
||||
// Imports the Media Explorer's last-played/selected file into the active bank, then
|
||||
// adds a ReaSampler 9000 instrument to the FIRST SELECTED TRACK pre-loaded with that
|
||||
// sound — no new track, no routing changes. No assignment_request write.
|
||||
@@ -350,10 +360,11 @@ void doImportFromMediaExplorer() {
|
||||
if (!target) {
|
||||
// Bank import is kept (sound is in the bank browser); generation is bumped
|
||||
// so any open VST3 browser instances refresh to show the new sound.
|
||||
bool persisted = true; // true when nothing needed persisting (dedup)
|
||||
if (r.added) {
|
||||
Undo_BeginBlock2(nullptr);
|
||||
g_session->bumpBankGeneration();
|
||||
const bool persisted = g_session->saveToActiveProject();
|
||||
persisted = g_session->saveToActiveProject();
|
||||
if (persisted)
|
||||
Undo_EndBlock2(nullptr, "ReaSampler: import Media Explorer file into bank",
|
||||
UNDO_STATE_MISCCFG);
|
||||
@@ -364,7 +375,8 @@ void doImportFromMediaExplorer() {
|
||||
ShowConsoleMsg(("ReaSampler ingest: " + r.message +
|
||||
" -- select a track first, then import into it "
|
||||
"(sound is in the bank but no instrument was placed because "
|
||||
"no track was selected).\n").c_str());
|
||||
"no track was selected)." + unsavedProjectNote(persisted) +
|
||||
"\n").c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -392,10 +404,12 @@ void doImportFromMediaExplorer() {
|
||||
bankPanelRefresh();
|
||||
if (placed)
|
||||
ShowConsoleMsg(("ReaSampler ingest: " + r.message +
|
||||
" (loaded into a new instrument on the selected track).\n").c_str());
|
||||
" (loaded into a new instrument on the selected track)." +
|
||||
unsavedProjectNote(persisted) + "\n").c_str());
|
||||
else
|
||||
ShowConsoleMsg(("ReaSampler ingest: imported to the bank (" + r.message +
|
||||
") but could not add the instrument to the selected track.\n").c_str());
|
||||
") but could not add the instrument to the selected track." +
|
||||
unsavedProjectNote(persisted) + "\n").c_str());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -446,7 +460,8 @@ void ingestDroppedFiles(const std::vector<std::string>& absolutePaths) {
|
||||
bankPanelRefresh();
|
||||
const std::string msg =
|
||||
"ReaSampler ingest: imported " + std::to_string(importedTotal) +
|
||||
(importedTotal == 1 ? " file" : " files") + " into the bank.\n";
|
||||
(importedTotal == 1 ? " file" : " files") + " into the bank." +
|
||||
unsavedProjectNote(persisted) + "\n";
|
||||
ShowConsoleMsg(msg.c_str());
|
||||
} else if (importedTotal > 0) {
|
||||
bankPanelRefresh();
|
||||
|
||||
Reference in New Issue
Block a user