From a3c53afdcb94e3f3ae2328978ca63d64335b2dbc Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Fri, 7 Aug 2020 16:59:46 +0200 Subject: [PATCH] option to set "Mute Myself" on with a command line argument (#495) --- ChangeLog | 2 ++ src/clientdlg.cpp | 7 +++++++ src/clientdlg.h | 1 + src/main.cpp | 16 ++++++++++++++++ 4 files changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index 493fdaa4..5664158d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ - support multi-threading in the server to better support multi-core CPUs, use qmake "CONFIG+=multithreading" to enable the new multi-threading (#339) +- option to set "Mute Myself" on with a command line argument (#495) + - bug fix: added more mutex in the server (should fix #480) - bug fix: --showallservers ping column sort is alphabetic (#201) diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 73b3c99b..6f103a02 100755 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -32,6 +32,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP, const int iCtrlMIDIChannel, const bool bNewShowComplRegConnList, const bool bShowAnalyzerConsole, + const bool bMuteStream, QWidget* parent, Qt::WindowFlags f ) : QDialog ( parent, f ), @@ -506,6 +507,12 @@ CClientDlg::CClientDlg ( CClient* pNCliP, { ShowConnectionSetupDialog(); } + + // mute stream on startup (must be done after the signal connections) + if ( bMuteStream ) + { + chbLocalMute->setCheckState ( Qt::Checked ); + } } void CClientDlg::closeEvent ( QCloseEvent* Event ) diff --git a/src/clientdlg.h b/src/clientdlg.h index 882a88ca..54af92a0 100755 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -79,6 +79,7 @@ public: const int iCtrlMIDIChannel, const bool bNewShowComplRegConnList, const bool bShowAnalyzerConsole, + const bool bMuteStream, QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); diff --git a/src/main.cpp b/src/main.cpp index 1f3674d3..8cc8d158 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -66,6 +66,7 @@ int main ( int argc, char** argv ) bool bDisconnectAllClientsOnQuit = false; bool bUseDoubleSystemFrameSize = true; // default is 128 samples frame size bool bShowAnalyzerConsole = false; + bool bMuteStream = false; bool bCentServPingServerInList = false; bool bNoAutoJackConnect = false; bool bUseTranslation = true; @@ -468,6 +469,18 @@ int main ( int argc, char** argv ) } + // Mute stream on startup ---------------------------------------------- + if ( GetFlagArgument ( argv, + i, + "-M", + "--mutestream" ) ) + { + bMuteStream = true; + tsConsole << "- mute stream activated" << endl; + continue; + } + + // Version number ------------------------------------------------------ if ( ( !strcmp ( argv[i], "--version" ) ) || ( !strcmp ( argv[i], "-v" ) ) ) @@ -509,6 +522,7 @@ int main ( int argc, char** argv ) Q_UNUSED ( bStartMinimized ) // avoid compiler warnings Q_UNUSED ( bShowComplRegConnList ) // avoid compiler warnings Q_UNUSED ( bShowAnalyzerConsole ) // avoid compiler warnings + Q_UNUSED ( bMuteStream ) // avoid compiler warnings #endif @@ -619,6 +633,7 @@ int main ( int argc, char** argv ) iCtrlMIDIChannel, bShowComplRegConnList, bShowAnalyzerConsole, + bMuteStream, nullptr, Qt::Window ); @@ -768,6 +783,7 @@ QString UsageArguments ( char **argv ) " -y, --history enable connection history and set file name\n" " -z, --startminimized start minimizied\n" "\nClient only:\n" + " -M, --mutestream starts the application in muted state\n" " -c, --connect connect to given server address on startup\n" " -j, --nojackconnect disable auto Jack connections\n" " --ctrlmidich MIDI controller channel to listen\n"