Merge m11-debug-cleanup: remove routine console chatter
This commit is contained in:
+2
-29
@@ -524,7 +524,6 @@ void doBankCreate() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
persistBook();
|
persistBook();
|
||||||
ShowConsoleMsg(("ReaSampler: created bank \"" + name + "\".\n").c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rename a bank: prompt for which bank (by current display name) and the new name.
|
// Rename a bank: prompt for which bank (by current display name) and the new name.
|
||||||
@@ -550,8 +549,6 @@ void doBankRename() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
persistBook();
|
persistBook();
|
||||||
ShowConsoleMsg(("ReaSampler: renamed \"" + which + "\" -> \"" + newName + "\".\n")
|
|
||||||
.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a named bank. Bindable safe-form of the confirm-on-non-empty guardrail:
|
// Delete a named bank. Bindable safe-form of the confirm-on-non-empty guardrail:
|
||||||
@@ -594,7 +591,6 @@ void doBankDelete() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
persistBook();
|
persistBook();
|
||||||
ShowConsoleMsg(("ReaSampler: deleted bank \"" + which + "\".\n").c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Evacuate a named bank: move every member back to the pool (index-only, collapse by
|
// Evacuate a named bank: move every member back to the pool (index-only, collapse by
|
||||||
@@ -616,7 +612,6 @@ void doBankEvacuate() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
persistBook();
|
persistBook();
|
||||||
ShowConsoleMsg(("ReaSampler: evacuated \"" + which + "\" to the pool.\n").c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cycle the active bank forward in ordinal order (pool -> named -> ... -> pool),
|
// Cycle the active bank forward in ordinal order (pool -> named -> ... -> pool),
|
||||||
@@ -631,10 +626,6 @@ void doBankActivateNext() {
|
|||||||
if (target.empty()) return; // degenerate (no banks) — cannot happen (pool seeded)
|
if (target.empty()) return; // degenerate (no banks) — cannot happen (pool seeded)
|
||||||
if (!g_session->book().setActiveBank(target)) return;
|
if (!g_session->book().setActiveBank(target)) return;
|
||||||
persistBook();
|
persistBook();
|
||||||
const Bank* b = g_session->book().bank(target);
|
|
||||||
ShowConsoleMsg(("ReaSampler: active bank -> \"" +
|
|
||||||
(b ? b->displayName : target) + "\".\n")
|
|
||||||
.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activate the pool directly (the common "back to the default target" jump). Bindable
|
// Activate the pool directly (the common "back to the default target" jump). Bindable
|
||||||
@@ -642,7 +633,6 @@ void doBankActivateNext() {
|
|||||||
void doBankActivatePool() {
|
void doBankActivatePool() {
|
||||||
if (!g_session->book().setActiveBank(kPoolBankId)) return;
|
if (!g_session->book().setActiveBank(kPoolBankId)) return;
|
||||||
persistBook();
|
persistBook();
|
||||||
ShowConsoleMsg("ReaSampler: active bank -> \"Pool\".\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move or copy the panel's selected samples into a named destination bank (prompted
|
// Move or copy the panel's selected samples into a named destination bank (prompted
|
||||||
@@ -677,28 +667,11 @@ void doBankTransferSelected(bool copy) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ok = 0, collapsed = 0, absent = 0;
|
|
||||||
for (const std::string& sampleId : selected) {
|
for (const std::string& sampleId : selected) {
|
||||||
const TransferResult r =
|
if (copy) g_session->book().copySample(sampleId, srcId, destId);
|
||||||
copy ? g_session->book().copySample(sampleId, srcId, destId)
|
else g_session->book().moveSample(sampleId, srcId, destId);
|
||||||
: g_session->book().moveSample(sampleId, srcId, destId);
|
|
||||||
switch (r) {
|
|
||||||
case TransferResult::Moved:
|
|
||||||
case TransferResult::Copied: ++ok; break;
|
|
||||||
case TransferResult::Collapsed: ++collapsed; break;
|
|
||||||
case TransferResult::RejectedSampleAbsent: ++absent; break;
|
|
||||||
// Unknown-bank / same-bank are pre-checked above; treat defensively as no-ops.
|
|
||||||
case TransferResult::RejectedUnknownBank:
|
|
||||||
case TransferResult::RejectedSameBank: break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
persistBook();
|
persistBook();
|
||||||
std::string log = std::string("ReaSampler: ") + verb + " -> \"" + destName +
|
|
||||||
"\": " + std::to_string(ok) + " " + verb + "d";
|
|
||||||
if (collapsed) log += ", " + std::to_string(collapsed) + " collapsed on hash";
|
|
||||||
if (absent) log += ", " + std::to_string(absent) + " no longer present";
|
|
||||||
log += ".\n";
|
|
||||||
ShowConsoleMsg(log.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -52,7 +52,6 @@
|
|||||||
#define REAPERAPI_WANT_Main_OnCommand
|
#define REAPERAPI_WANT_Main_OnCommand
|
||||||
#define REAPERAPI_WANT_Main_SaveProject
|
#define REAPERAPI_WANT_Main_SaveProject
|
||||||
#define REAPERAPI_WANT_Master_GetTempo
|
#define REAPERAPI_WANT_Master_GetTempo
|
||||||
#define REAPERAPI_WANT_ShowConsoleMsg
|
|
||||||
#include "reaper_plugin_functions.h"
|
#include "reaper_plugin_functions.h"
|
||||||
|
|
||||||
namespace reasampler {
|
namespace reasampler {
|
||||||
|
|||||||
+7
-37
@@ -135,7 +135,7 @@ static ReaProject* g_rtCaptureProject = nullptr;
|
|||||||
|
|
||||||
// Commit a finished realtime capture (a Done tick/abort with an Ok result): add the
|
// Commit a finished realtime capture (a Done tick/abort with an Ok result): add the
|
||||||
// Sample to the ACTIVE bank (g_session.bank() resolves to book.activeIndex() — B2),
|
// Sample to the ACTIVE bank (g_session.bank() resolves to book.activeIndex() — B2),
|
||||||
// persist + MarkProjectDirty, log. Shared by the tick-completion path and the abort
|
// persist + MarkProjectDirty. Shared by the tick-completion path and the abort
|
||||||
// paths. On a non-Ok result, logs the failure only.
|
// paths. On a non-Ok result, logs the failure only.
|
||||||
static void CommitRealtimeResult(const reasampler::CaptureResult& res)
|
static void CommitRealtimeResult(const reasampler::CaptureResult& res)
|
||||||
{
|
{
|
||||||
@@ -144,15 +144,8 @@ static void CommitRealtimeResult(const reasampler::CaptureResult& res)
|
|||||||
ShowConsoleMsg(("ReaSampler realtime capture failed: " + res.message + "\n").c_str());
|
ShowConsoleMsg(("ReaSampler realtime capture failed: " + res.message + "\n").c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reasampler::AddResult added = g_session.bank().add(res.sample);
|
g_session.bank().add(res.sample);
|
||||||
g_session.saveToActiveProject(); // persist + MarkProjectDirty (travels with .rpp)
|
g_session.saveToActiveProject(); // persist + MarkProjectDirty (travels with .rpp)
|
||||||
|
|
||||||
std::string log = "ReaSampler: " + res.message + "\n";
|
|
||||||
log += " bank size now " + std::to_string(g_session.bank().size()) +
|
|
||||||
(added == reasampler::AddResult::Added ? " (added)\n"
|
|
||||||
: added == reasampler::AddResult::Collapsed ? " (collapsed on hash)\n"
|
|
||||||
: " (rejected)\n");
|
|
||||||
ShowConsoleMsg(log.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Advance any in-flight realtime capture one tick. Cheap when none is running (a
|
// Advance any in-flight realtime capture one tick. Cheap when none is running (a
|
||||||
@@ -564,19 +557,12 @@ static void RunCapture(const reasampler::CaptureActionDef& def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add to the ACTIVE bank: g_session.bank() resolves to book.activeIndex() (B2).
|
// Add to the ACTIVE bank: g_session.bank() resolves to book.activeIndex() (B2).
|
||||||
reasampler::AddResult added = g_session.bank().add(res.sample);
|
g_session.bank().add(res.sample);
|
||||||
// Persist the updated book into the active project's ext state (the `banks` key)
|
// Persist the updated book into the active project's ext state (the `banks` key)
|
||||||
// so the capture survives Save / close+reopen (M4) and travels with the .rpp.
|
// so the capture survives Save / close+reopen (M4) and travels with the .rpp.
|
||||||
// saveToActiveProject also clears the retired legacy key and calls MarkProjectDirty.
|
// saveToActiveProject also clears the retired legacy key and calls MarkProjectDirty.
|
||||||
// Non-destructive: writes only our own ext-state keys.
|
// Non-destructive: writes only our own ext-state keys.
|
||||||
g_session.saveToActiveProject();
|
g_session.saveToActiveProject();
|
||||||
|
|
||||||
std::string log = "ReaSampler: " + res.message + "\n";
|
|
||||||
log += " bank size now " + std::to_string(g_session.bank().size()) +
|
|
||||||
(added == reasampler::AddResult::Added ? " (added)\n"
|
|
||||||
: added == reasampler::AddResult::Collapsed ? " (collapsed on hash)\n"
|
|
||||||
: " (rejected)\n");
|
|
||||||
ShowConsoleMsg(log.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// STARTS the REALTIME track capture and returns immediately — the record runs across
|
// STARTS the REALTIME track capture and returns immediately — the record runs across
|
||||||
@@ -648,15 +634,6 @@ static void RunCaptureRealtimeTrack()
|
|||||||
// completion across ticks (UI stays responsive).
|
// completion across ticks (UI stays responsive).
|
||||||
g_rtCaptureProject = EnumProjects(-1, nullptr, 0);
|
g_rtCaptureProject = EnumProjects(-1, nullptr, 0);
|
||||||
g_rtCapture = std::move(st);
|
g_rtCapture = std::move(st);
|
||||||
// With a tail mode the recorded window runs PAST the range end (Auto: +8 s then
|
|
||||||
// decay-trim; Manual: +the set length), so the completion note names the window,
|
|
||||||
// not just the range end.
|
|
||||||
const char* doneWhen =
|
|
||||||
(tail.mode == reasampler::TailMode::None)
|
|
||||||
? "the bank updates when it reaches the range end."
|
|
||||||
: "the bank updates after the extra tail window (past the range end).";
|
|
||||||
ShowConsoleMsg((std::string("ReaSampler: realtime capture started — recording in "
|
|
||||||
"the background; ") + doneWhen + "\n").c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancels the in-flight realtime capture on demand (bindable action). Force-terminates
|
// Cancels the in-flight realtime capture on demand (bindable action). Force-terminates
|
||||||
@@ -698,27 +675,22 @@ static void RunInsertSelected(bool conform)
|
|||||||
|
|
||||||
reasampler::InsertResult res = reasampler::runInsert(&g_session, req);
|
reasampler::InsertResult res = reasampler::runInsert(&g_session, req);
|
||||||
|
|
||||||
std::string msg;
|
|
||||||
switch (res.status)
|
switch (res.status)
|
||||||
{
|
{
|
||||||
case reasampler::InsertStatus::Ok:
|
case reasampler::InsertStatus::Ok:
|
||||||
msg = "ReaSampler: inserted onto " + std::to_string(res.inserted) +
|
break; // success — no console chatter
|
||||||
(res.inserted == 1 ? " track" : " tracks") +
|
|
||||||
(conform ? " (conformed to tempo)" : " (native length)") + "\n";
|
|
||||||
break;
|
|
||||||
case reasampler::InsertStatus::NoSelection:
|
case reasampler::InsertStatus::NoSelection:
|
||||||
// "select a track first" is printed by runInsert when no track is
|
// "select a track first" is printed by runInsert when no track is
|
||||||
// selected; this branch covers the no-panel-selection case.
|
// selected; this branch covers the no-panel-selection case.
|
||||||
msg = "ReaSampler insert: nothing selected in the bank panel.\n";
|
ShowConsoleMsg("ReaSampler insert: nothing selected in the bank panel.\n");
|
||||||
break;
|
break;
|
||||||
case reasampler::InsertStatus::NoProject:
|
case reasampler::InsertStatus::NoProject:
|
||||||
msg = "ReaSampler insert: no saved project, so the bank has no location.\n";
|
ShowConsoleMsg("ReaSampler insert: no saved project, so the bank has no location.\n");
|
||||||
break;
|
break;
|
||||||
case reasampler::InsertStatus::NothingResolved:
|
case reasampler::InsertStatus::NothingResolved:
|
||||||
msg = "ReaSampler insert: selected sample(s) could not be resolved to a file.\n";
|
ShowConsoleMsg("ReaSampler insert: selected sample(s) could not be resolved to a file.\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ShowConsoleMsg(msg.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// REAPER calls this for EVERY action fired anywhere; claim only our own id,
|
// REAPER calls this for EVERY action fired anywhere; claim only our own id,
|
||||||
@@ -957,7 +929,5 @@ extern "C" REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(
|
|||||||
// state, on a Save-As it relocates the bank folder under the new .rpp.
|
// state, on a Save-As it relocates the bank folder under the new .rpp.
|
||||||
rec->Register("timer", (void*)&OnTimer);
|
rec->Register("timer", (void*)&OnTimer);
|
||||||
|
|
||||||
ShowConsoleMsg("ReaSampler loaded.\n");
|
|
||||||
|
|
||||||
return 1; // success — REAPER keeps us loaded
|
return 1; // success — REAPER keeps us loaded
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user