- remove unnecessary command line argument (if directory is given, the recording is enabled automatically

- jamrecorder is not a pointer in the class but an object now
- only call jamrecorder functions if it is enabled
This commit is contained in:
Volker Fischer 2019-04-11 22:25:36 +02:00
parent 0dbef268a3
commit 30b5833d3d
5 changed files with 34 additions and 33 deletions

View file

@ -80,7 +80,6 @@ int main ( int argc, char** argv )
bool bDisconnectAllClients = false; bool bDisconnectAllClients = false;
bool bShowAnalyzerConsole = false; bool bShowAnalyzerConsole = false;
bool bCentServPingServerInList = false; bool bCentServPingServerInList = false;
bool bEnableRecording = false;
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS; int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
int iCtrlMIDIChannel = INVALID_MIDI_CH; int iCtrlMIDIChannel = INVALID_MIDI_CH;
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER; 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 ---------------------- // Show all registered servers in the server list ----------------------
// Undocumented debugging command line argument: Show all registered // Undocumented debugging command line argument: Show all registered
// servers in the server list regardless if a ping to the server is // servers in the server list regardless if a ping to the server is
@ -556,7 +543,6 @@ int main ( int argc, char** argv )
strServerInfo, strServerInfo,
strWelcomeMessage, strWelcomeMessage,
strRecordingDirName, strRecordingDirName,
bEnableRecording,
bCentServPingServerInList, bCentServPingServerInList,
bDisconnectAllClients, bDisconnectAllClients,
eLicenceType ); eLicenceType );
@ -654,9 +640,8 @@ QString UsageArguments ( char **argv )
" [server1 country as QLocale ID]; ...\n" " [server1 country as QLocale ID]; ...\n"
" [server2 address]; ... (server only)\n" " [server2 address]; ... (server only)\n"
" -p, --port local port number (server only)\n" " -p, --port local port number (server only)\n"
" -r --enablerecording create recordings of jam sessions (server only)\n" " -R, --recording enables recording and sets directory to contain\n"
" -R, --recordingdirectory\n" " recorded jams (server only)\n"
" directory to contain recorded jams (server only)\n"
" -s, --server start server\n" " -s, --server start server\n"
" -T, --toreaper create Reaper project from session in named directory\n" " -T, --toreaper create Reaper project from session in named directory\n"
" -u, --numchannels maximum number of channels (server only)\n" " -u, --numchannels maximum number of channels (server only)\n"

View file

@ -291,13 +291,10 @@ QMap<QString, QList<STrackItem>> 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 server Server object emiting signals
* @param recordingDirName Requested recording directory name
*/ */
CJamRecorder::CJamRecorder(const CServer* server, const QString recordingDirName) : void CJamRecorder::Init(const CServer* server)
recordBaseDir (recordingDirName),
isRecording (false)
{ {
const QFileInfo fi(recordBaseDir.absolutePath()); const QFileInfo fi(recordBaseDir.absolutePath());
@ -323,7 +320,7 @@ CJamRecorder::CJamRecorder(const CServer* server, const QString recordingDirName
Qt::ConnectionType::QueuedConnection); Qt::ConnectionType::QueuedConnection);
qRegisterMetaType<CVector<int16_t>>(); qRegisterMetaType<CVector<int16_t>>();
QObject::connect((const QObject *)server, SIGNAL ( Frame(const int, const QString, const CHostAddress, const int, const CVector<int16_t>) ), QObject::connect((const QObject *)server, SIGNAL ( AudioFrame(const int, const QString, const CHostAddress, const int, const CVector<int16_t>) ),
this, SLOT( OnFrame(const int, const QString, const CHostAddress, const int, const CVector<int16_t>) ), this, SLOT( OnFrame(const int, const QString, const CHostAddress, const int, const CVector<int16_t>) ),
Qt::ConnectionType::QueuedConnection); Qt::ConnectionType::QueuedConnection);
} }

View file

@ -138,7 +138,9 @@ class CJamRecorder : public QThread
Q_OBJECT Q_OBJECT
public: 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); static void SessionDirToReaper(QString& strSessionDirName);

View file

@ -207,12 +207,13 @@ CServer::CServer ( const int iNewMaxNumChan,
const QString& strServerInfo, const QString& strServerInfo,
const QString& strNewWelcomeMessage, const QString& strNewWelcomeMessage,
const QString& strRecordingDirName, const QString& strRecordingDirName,
const bool bEnableRecording,
const bool bNCentServPingServerInList, const bool bNCentServPingServerInList,
const bool bNDisconnectAllClients, const bool bNDisconnectAllClients,
const ELicenceType eNLicenceType ) : const ELicenceType eNLicenceType ) :
iMaxNumChannels ( iNewMaxNumChan ), iMaxNumChannels ( iNewMaxNumChan ),
Socket ( this, iPortNumber ), Socket ( this, iPortNumber ),
JamRecorder ( strRecordingDirName ),
bEnableRecording ( !strRecordingDirName.isEmpty() ),
bWriteStatusHTMLFile ( false ), bWriteStatusHTMLFile ( false ),
ServerListManager ( iPortNumber, ServerListManager ( iPortNumber,
strCentralServer, strCentralServer,
@ -362,8 +363,8 @@ CServer::CServer ( const int iNewMaxNumChan,
// Enable jam recording (if requested) // Enable jam recording (if requested)
if ( bEnableRecording ) if ( bEnableRecording )
{ {
JamRecorder = new CJamRecorder(this, strRecordingDirName); JamRecorder.Init ( this );
JamRecorder->start(); JamRecorder.start();
} }
// enable all channels (for the server all channel must be enabled the // enable all channels (for the server all channel must be enabled the
@ -751,7 +752,11 @@ JitterMeas.Measure();
// and emit the client disconnected signal // and emit the client disconnected signal
if ( eGetStat == GS_CHAN_NOW_DISCONNECTED ) 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; bChannelIsNowDisconnected = true;
} }
@ -836,7 +841,15 @@ JitterMeas.Measure();
// get number of audio channels of current channel // get number of audio channels of current channel
const int iCurNumAudChan = vecNumAudioChannels[i]; 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 // generate a sparate mix for each channel
// actual processing of audio data -> mix // actual processing of audio data -> mix

View file

@ -131,7 +131,6 @@ public:
const QString& strServerInfo, const QString& strServerInfo,
const QString& strNewWelcomeMessage, const QString& strNewWelcomeMessage,
const QString& strRecordingDirName, const QString& strRecordingDirName,
const bool bEnableRecording,
const bool bNCentServPingServerInList, const bool bNCentServPingServerInList,
const bool bNDisconnectAllClients, const bool bNDisconnectAllClients,
const ELicenceType eNLicenceType ); const ELicenceType eNLicenceType );
@ -253,7 +252,8 @@ protected:
CServerLogging Logging; CServerLogging Logging;
// recording thread // recording thread
CJamRecorder* JamRecorder; CJamRecorder JamRecorder;
bool bEnableRecording;
// HTML file server status // HTML file server status
bool bWriteStatusHTMLFile; bool bWriteStatusHTMLFile;
@ -276,8 +276,12 @@ protected:
signals: signals:
void Started(); void Started();
void Stopped(); void Stopped();
void ClientDisconnected(const int iChID); void ClientDisconnected ( const int iChID );
void Frame(const int, const QString, const CHostAddress, const int, const CVector<int16_t>); void AudioFrame ( const int iChID,
const QString stChName,
const CHostAddress RecHostAddr,
const int iNumAudChan,
const CVector<int16_t> vecsData );
public slots: public slots:
void OnTimer(); void OnTimer();