diff --git a/src/main.cpp b/src/main.cpp index 07929d09..03e14981 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -80,7 +80,6 @@ int main ( int argc, char** argv ) bool bDisconnectAllClients = false; bool bShowAnalyzerConsole = false; bool bCentServPingServerInList = false; - bool bEnableRecording = false; int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS; int iCtrlMIDIChannel = INVALID_MIDI_CH; quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER; @@ -184,18 +183,6 @@ int main ( int argc, char** argv ) } - // Enable recording at the server -------------------------------------- - if ( GetFlagArgument ( argv, - i, - "-r", - "--enablerecording" ) ) - { - bEnableRecording = true; - tsConsole << "- enabling recording" << endl; - continue; - } - - // Show all registered servers in the server list ---------------------- // Undocumented debugging command line argument: Show all registered // servers in the server list regardless if a ping to the server is @@ -556,7 +543,6 @@ int main ( int argc, char** argv ) strServerInfo, strWelcomeMessage, strRecordingDirName, - bEnableRecording, bCentServPingServerInList, bDisconnectAllClients, eLicenceType ); @@ -654,9 +640,8 @@ QString UsageArguments ( char **argv ) " [server1 country as QLocale ID]; ...\n" " [server2 address]; ... (server only)\n" " -p, --port local port number (server only)\n" - " -r --enablerecording create recordings of jam sessions (server only)\n" - " -R, --recordingdirectory\n" - " directory to contain recorded jams (server only)\n" + " -R, --recording enables recording and sets directory to contain\n" + " recorded jams (server only)\n" " -s, --server start server\n" " -T, --toreaper create Reaper project from session in named directory\n" " -u, --numchannels maximum number of channels (server only)\n" diff --git a/src/recorder/jamrecorder.cpp b/src/recorder/jamrecorder.cpp index 14696eaa..503e147a 100755 --- a/src/recorder/jamrecorder.cpp +++ b/src/recorder/jamrecorder.cpp @@ -291,13 +291,10 @@ QMap> CJamSession::TracksFromSessionDir(const QString * ********************************************************************************************************/ /** - * @brief CJamRecorder::CJamRecorder Create recording directory, if necessary, and connect signal handlers + * @brief CJamRecorder::Init Create recording directory, if necessary, and connect signal handlers * @param server Server object emiting signals - * @param recordingDirName Requested recording directory name */ -CJamRecorder::CJamRecorder(const CServer* server, const QString recordingDirName) : - recordBaseDir (recordingDirName), - isRecording (false) +void CJamRecorder::Init(const CServer* server) { const QFileInfo fi(recordBaseDir.absolutePath()); @@ -323,7 +320,7 @@ CJamRecorder::CJamRecorder(const CServer* server, const QString recordingDirName Qt::ConnectionType::QueuedConnection); qRegisterMetaType>(); - QObject::connect((const QObject *)server, SIGNAL ( Frame(const int, const QString, const CHostAddress, const int, const CVector) ), + QObject::connect((const QObject *)server, SIGNAL ( AudioFrame(const int, const QString, const CHostAddress, const int, const CVector) ), this, SLOT( OnFrame(const int, const QString, const CHostAddress, const int, const CVector) ), Qt::ConnectionType::QueuedConnection); } diff --git a/src/recorder/jamrecorder.h b/src/recorder/jamrecorder.h index 6e35600b..42443509 100755 --- a/src/recorder/jamrecorder.h +++ b/src/recorder/jamrecorder.h @@ -138,7 +138,9 @@ class CJamRecorder : public QThread Q_OBJECT public: - CJamRecorder(const CServer* server, const QString recordingDirName); + CJamRecorder(const QString recordingDirName) : + recordBaseDir (recordingDirName), isRecording (false) {} + void Init(const CServer* server); static void SessionDirToReaper(QString& strSessionDirName); diff --git a/src/server.cpp b/src/server.cpp index ee6ec754..4437d242 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -207,12 +207,13 @@ CServer::CServer ( const int iNewMaxNumChan, const QString& strServerInfo, const QString& strNewWelcomeMessage, const QString& strRecordingDirName, - const bool bEnableRecording, const bool bNCentServPingServerInList, const bool bNDisconnectAllClients, const ELicenceType eNLicenceType ) : iMaxNumChannels ( iNewMaxNumChan ), Socket ( this, iPortNumber ), + JamRecorder ( strRecordingDirName ), + bEnableRecording ( !strRecordingDirName.isEmpty() ), bWriteStatusHTMLFile ( false ), ServerListManager ( iPortNumber, strCentralServer, @@ -362,8 +363,8 @@ CServer::CServer ( const int iNewMaxNumChan, // Enable jam recording (if requested) if ( bEnableRecording ) { - JamRecorder = new CJamRecorder(this, strRecordingDirName); - JamRecorder->start(); + JamRecorder.Init ( this ); + JamRecorder.start(); } // enable all channels (for the server all channel must be enabled the @@ -751,7 +752,11 @@ JitterMeas.Measure(); // and emit the client disconnected signal if ( eGetStat == GS_CHAN_NOW_DISCONNECTED ) { - emit ClientDisconnected(iCurChanID); //? do outside mutex lock? + if ( bEnableRecording ) + { + emit ClientDisconnected ( iCurChanID ); // TODO do this outside the mutex lock? + } + bChannelIsNowDisconnected = true; } @@ -836,7 +841,15 @@ JitterMeas.Measure(); // get number of audio channels of current channel const int iCurNumAudChan = vecNumAudioChannels[i]; - emit Frame(iCurChanID, vecChannels[iCurChanID].GetName(), vecChannels[iCurChanID].GetAddress(), iCurNumAudChan, vecvecsData[i]); + // export the audio data for recording purpose + if ( bEnableRecording ) + { + emit AudioFrame ( iCurChanID, + vecChannels[iCurChanID].GetName(), + vecChannels[iCurChanID].GetAddress(), + iCurNumAudChan, + vecvecsData[i] ); + } // generate a sparate mix for each channel // actual processing of audio data -> mix diff --git a/src/server.h b/src/server.h index a14cf45c..92308f39 100755 --- a/src/server.h +++ b/src/server.h @@ -131,7 +131,6 @@ public: const QString& strServerInfo, const QString& strNewWelcomeMessage, const QString& strRecordingDirName, - const bool bEnableRecording, const bool bNCentServPingServerInList, const bool bNDisconnectAllClients, const ELicenceType eNLicenceType ); @@ -253,7 +252,8 @@ protected: CServerLogging Logging; // recording thread - CJamRecorder* JamRecorder; + CJamRecorder JamRecorder; + bool bEnableRecording; // HTML file server status bool bWriteStatusHTMLFile; @@ -276,8 +276,12 @@ protected: signals: void Started(); void Stopped(); - void ClientDisconnected(const int iChID); - void Frame(const int, const QString, const CHostAddress, const int, const CVector); + void ClientDisconnected ( const int iChID ); + void AudioFrame ( const int iChID, + const QString stChName, + const CHostAddress RecHostAddr, + const int iNumAudChan, + const CVector vecsData ); public slots: void OnTimer();