From beceefd34b7fe72190b9e5b9aef2d317e90935f2 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 18 Dec 2021 04:26:17 -0500 Subject: [PATCH] only output playback status in console mode --- src/engine/engine.cpp | 4 ++++ src/engine/engine.h | 5 +++++ src/engine/playback.cpp | 4 ++-- src/log.cpp | 18 +++++++++++++++++- src/main.cpp | 29 +++++++++++++++++------------ 5 files changed, 45 insertions(+), 15 deletions(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index f77ba395c..100ee7c23 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1484,6 +1484,10 @@ void DivEngine::setView(DivStatusView which) { view=which; } +void DivEngine::setConsoleMode(bool enable) { + consoleMode=enable; +} + void DivEngine::initDispatch() { if (dispatch!=NULL) return; isBusy.lock(); diff --git a/src/engine/engine.h b/src/engine/engine.h index abdd810a9..2ba7e182e 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -72,6 +72,7 @@ class DivEngine { bool playing; bool speedAB; bool endOfSong; + bool consoleMode; int ticks, cycles, curRow, curOrder, remainingLoops, nextSpeed, clockDrift; int changeOrd, changePos, totalTicks, totalCmds, lastCmds, cmdsPerSecond; DivStatusView view; @@ -208,6 +209,9 @@ class DivEngine { // set the view mode. void setView(DivStatusView which); + // set the console mode. + void setConsoleMode(bool enable); + // public render samples void renderSamplesP(); @@ -233,6 +237,7 @@ class DivEngine { playing(false), speedAB(false), endOfSong(false), + consoleMode(false), ticks(0), cycles(0), curRow(0), diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 01bcae575..ac708bd51 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -505,7 +505,7 @@ void DivEngine::processRow(int i, bool afterDelay) { } break; case 0xee: // external command - printf("\x1b[1;36m%d: extern command %d\x1b[m\n",i,effectVal); + //printf("\x1b[1;36m%d: extern command %d\x1b[m\n",i,effectVal); break; } } @@ -772,7 +772,7 @@ bool DivEngine::nextTick() { } else { hz=50; } - fprintf(stderr,"\x1b[2K> %d:%.2d:%.2d.%.2d %.2x/%.2x:%.3d/%.3d %4dcmd/s\x1b[G",totalTicks/(hz*3600),(totalTicks/(hz*60))%60,(totalTicks/hz)%60,totalTicks%hz,curOrder,song.ordersLen,curRow,song.patLen,cmdsPerSecond); + if (consoleMode) fprintf(stderr,"\x1b[2K> %d:%.2d:%.2d.%.2d %.2x/%.2x:%.3d/%.3d %4dcmd/s\x1b[G",totalTicks/(hz*3600),(totalTicks/(hz*60))%60,(totalTicks/hz)%60,totalTicks%hz,curOrder,song.ordersLen,curRow,song.patLen,cmdsPerSecond); if ((totalTicks%hz)==0) { cmdsPerSecond=totalCmds-lastCmds; diff --git a/src/log.cpp b/src/log.cpp index 20942b959..e27cb3673 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -6,7 +6,11 @@ int logD(const char* format, ...) { va_list va; int ret; if (logLevel