From 2ee2b375323bf1ae12a719468d02855741fdd3d0 Mon Sep 17 00:00:00 2001 From: daniel-c-harvey Date: Sun, 26 Jul 2026 05:48:41 -0400 Subject: [PATCH] chore: remove routine console chatter, keep error reporting Strip ShowConsoleMsg from all normal-success paths (loaded, captured, bank create/rename/delete/evacuate/activate, realtime started, insert ok, transfer summary). Remove dead REAPERAPI_WANT_ShowConsoleMsg in capture.cpp. Error/failure/malformed-data paths and modal confirms untouched. --- src/actions.cpp | 31 ++----------------------------- src/capture.cpp | 1 - src/main.cpp | 44 +++++++------------------------------------- 3 files changed, 9 insertions(+), 67 deletions(-) diff --git a/src/actions.cpp b/src/actions.cpp index 0754cd8..29bd91f 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -524,7 +524,6 @@ void doBankCreate() { return; } persistBook(); - ShowConsoleMsg(("ReaSampler: created bank \"" + name + "\".\n").c_str()); } // Rename a bank: prompt for which bank (by current display name) and the new name. @@ -550,8 +549,6 @@ void doBankRename() { return; } persistBook(); - ShowConsoleMsg(("ReaSampler: renamed \"" + which + "\" -> \"" + newName + "\".\n") - .c_str()); } // Delete a named bank. Bindable safe-form of the confirm-on-non-empty guardrail: @@ -594,7 +591,6 @@ void doBankDelete() { return; } persistBook(); - ShowConsoleMsg(("ReaSampler: deleted bank \"" + which + "\".\n").c_str()); } // Evacuate a named bank: move every member back to the pool (index-only, collapse by @@ -616,7 +612,6 @@ void doBankEvacuate() { return; } persistBook(); - ShowConsoleMsg(("ReaSampler: evacuated \"" + which + "\" to the pool.\n").c_str()); } // 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 (!g_session->book().setActiveBank(target)) return; 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 @@ -642,7 +633,6 @@ void doBankActivateNext() { void doBankActivatePool() { if (!g_session->book().setActiveBank(kPoolBankId)) return; persistBook(); - ShowConsoleMsg("ReaSampler: active bank -> \"Pool\".\n"); } // Move or copy the panel's selected samples into a named destination bank (prompted @@ -677,28 +667,11 @@ void doBankTransferSelected(bool copy) { return; } - int ok = 0, collapsed = 0, absent = 0; for (const std::string& sampleId : selected) { - const TransferResult r = - copy ? g_session->book().copySample(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; - } + if (copy) g_session->book().copySample(sampleId, srcId, destId); + else g_session->book().moveSample(sampleId, srcId, destId); } 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 diff --git a/src/capture.cpp b/src/capture.cpp index 183baf6..85d1b42 100644 --- a/src/capture.cpp +++ b/src/capture.cpp @@ -52,7 +52,6 @@ #define REAPERAPI_WANT_Main_OnCommand #define REAPERAPI_WANT_Main_SaveProject #define REAPERAPI_WANT_Master_GetTempo -#define REAPERAPI_WANT_ShowConsoleMsg #include "reaper_plugin_functions.h" namespace reasampler { diff --git a/src/main.cpp b/src/main.cpp index 2223f07..f69aff7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -135,7 +135,7 @@ static ReaProject* g_rtCaptureProject = nullptr; // 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), -// 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. 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()); return; } - reasampler::AddResult added = g_session.bank().add(res.sample); + g_session.bank().add(res.sample); 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 @@ -564,19 +557,12 @@ static void RunCapture(const reasampler::CaptureActionDef& def) } // 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) // so the capture survives Save / close+reopen (M4) and travels with the .rpp. // saveToActiveProject also clears the retired legacy key and calls MarkProjectDirty. // Non-destructive: writes only our own ext-state keys. 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 @@ -648,15 +634,6 @@ static void RunCaptureRealtimeTrack() // completion across ticks (UI stays responsive). g_rtCaptureProject = EnumProjects(-1, nullptr, 0); 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 @@ -698,27 +675,22 @@ static void RunInsertSelected(bool conform) reasampler::InsertResult res = reasampler::runInsert(&g_session, req); - std::string msg; switch (res.status) { case reasampler::InsertStatus::Ok: - msg = "ReaSampler: inserted onto " + std::to_string(res.inserted) + - (res.inserted == 1 ? " track" : " tracks") + - (conform ? " (conformed to tempo)" : " (native length)") + "\n"; - break; + break; // success — no console chatter case reasampler::InsertStatus::NoSelection: // "select a track first" is printed by runInsert when no track is // 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; 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; 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; } - ShowConsoleMsg(msg.c_str()); } // 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. rec->Register("timer", (void*)&OnTimer); - ShowConsoleMsg("ReaSampler loaded.\n"); - return 1; // success — REAPER keeps us loaded }