Skip to content

Commit dfa18fc

Browse files
authored
Merge pull request #597 from pljones/feature/574-command-line-disable-recording
#574 Disable recording on start up
2 parents d37cea4 + f74507d commit dfa18fc

5 files changed

Lines changed: 28 additions & 7 deletions

File tree

src/main.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ int main ( int argc, char** argv )
6969
bool bUseMultithreading = false;
7070
bool bShowAnalyzerConsole = false;
7171
bool bMuteStream = false;
72+
bool bDisableRecording = false;
7273
bool bCentServPingServerInList = false;
7374
bool bNoAutoJackConnect = false;
7475
bool bUseTranslation = true;
@@ -392,6 +393,19 @@ int main ( int argc, char** argv )
392393
}
393394

394395

396+
// Disable recording on startup ----------------------------------------
397+
if ( GetFlagArgument ( argv,
398+
i,
399+
"--norecord",
400+
"--norecord" ) )
401+
{
402+
bDisableRecording = true;
403+
tsConsole << "- recording will not be enabled" << endl;
404+
CommandLineOptions << "--norecord";
405+
continue;
406+
}
407+
408+
395409
// Central server ------------------------------------------------------
396410
if ( GetStringArgument ( tsConsole,
397411
argc,
@@ -688,6 +702,7 @@ int main ( int argc, char** argv )
688702
bDisconnectAllClientsOnQuit,
689703
bUseDoubleSystemFrameSize,
690704
bUseMultithreading,
705+
bDisableRecording,
691706
eLicenceType );
692707

693708
#ifndef HEADLESS
@@ -798,8 +813,8 @@ QString UsageArguments ( char **argv )
798813
" [server1 city]; ...\n"
799814
" [server1 country as QLocale ID]; ...\n"
800815
" [server2 address]; ...\n"
801-
" -R, --recording enables recording and sets directory to contain\n"
802-
" recorded jams\n"
816+
" -R, --recording sets directory to contain recorded jams\n"
817+
" --norecord disables recording (when enabled by default by -R)\n"
803818
" -s, --server start server\n"
804819
" -T, --multithreading use multithreading to make better use of\n"
805820
" multi-core CPUs and support more clients\n"

src/recorder/jamcontroller.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ void CJamController::SetEnableRecording ( bool bNewEnableRecording, bool isRunn
7171
}
7272

7373
void CJamController::SetRecordingDir ( QString newRecordingDir,
74-
int iServerFrameSizeSamples )
74+
int iServerFrameSizeSamples,
75+
bool bDisableRecording )
7576
{
7677
if ( bRecorderInitialised && pthJamRecorder != nullptr )
7778
{
@@ -89,7 +90,7 @@ void CJamController::SetRecordingDir ( QString newRecordingDir,
8990
pJamRecorder = new recorder::CJamRecorder ( newRecordingDir, iServerFrameSizeSamples );
9091
strRecorderErrMsg = pJamRecorder->Init();
9192
bRecorderInitialised = ( strRecorderErrMsg == QString::null );
92-
bEnableRecording = bRecorderInitialised;
93+
bEnableRecording = bRecorderInitialised && !bDisableRecording;
9394

9495
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
9596
// TODO we should use the ConsoleWriterFactory() instead of qInfo()

src/recorder/jamcontroller.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ class CJamController : public QObject
4242
void RequestNewRecording();
4343
void SetEnableRecording ( bool bNewEnableRecording, bool isRunning );
4444
QString GetRecordingDir() { return strRecordingDir; }
45-
void SetRecordingDir ( QString newRecordingDir,
46-
int iServerFrameSizeSamples );
45+
void SetRecordingDir ( QString newRecordingDir, int iServerFrameSizeSamples, bool bDisableRecording );
4746
ERecorderState GetRecorderState();
4847

4948
private:

src/server.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ CServer::CServer ( const int iNewMaxNumChan,
233233
const bool bNDisconnectAllClientsOnQuit,
234234
const bool bNUseDoubleSystemFrameSize,
235235
const bool bNUseMultithreading,
236+
const bool bDisableRecording,
236237
const ELicenceType eNLicenceType ) :
237238
bUseDoubleSystemFrameSize ( bNUseDoubleSystemFrameSize ),
238239
bUseMultithreading ( bNUseMultithreading ),
@@ -249,6 +250,7 @@ CServer::CServer ( const int iNewMaxNumChan,
249250
iNewMaxNumChan,
250251
bNCentServPingServerInList,
251252
&ConnLessProtocol ),
253+
bDisableRecording ( bDisableRecording ),
252254
bAutoRunMinimized ( false ),
253255
eLicenceType ( eNLicenceType ),
254256
bDisconnectAllClientsOnQuit ( bNDisconnectAllClientsOnQuit ),
@@ -1578,6 +1580,8 @@ void CServer::SetEnableRecording ( bool bNewEnableRecording )
15781580
{
15791581
JamController.SetEnableRecording ( bNewEnableRecording, IsRunning() );
15801582

1583+
bDisableRecording = !bNewEnableRecording;
1584+
15811585
// the recording state may have changed, send recording state message
15821586
CreateAndSendRecorderStateForAllConChannels();
15831587
}

src/server.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ class CServer :
183183
const bool bNDisconnectAllClientsOnQuit,
184184
const bool bNUseDoubleSystemFrameSize,
185185
const bool bNUseMultithreading,
186+
const bool bDisableRecording,
186187
const ELicenceType eNLicenceType );
187188

188189
virtual ~CServer();
@@ -216,7 +217,7 @@ class CServer :
216217
QString GetRecordingDir() { return JamController.GetRecordingDir(); }
217218

218219
void SetRecordingDir( QString newRecordingDir )
219-
{ JamController.SetRecordingDir ( newRecordingDir, iServerFrameSizeSamples ); }
220+
{ JamController.SetRecordingDir ( newRecordingDir, iServerFrameSizeSamples, bDisableRecording ); }
220221

221222
void CreateAndSendRecorderStateForAllConChannels();
222223

@@ -388,6 +389,7 @@ class CServer :
388389

389390
// jam recorder
390391
recorder::CJamController JamController;
392+
bool bDisableRecording;
391393

392394
// GUI settings
393395
bool bAutoRunMinimized;

0 commit comments

Comments
 (0)