- 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 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"

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 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<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>) ),
Qt::ConnectionType::QueuedConnection);
}

View file

@ -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);

View file

@ -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

View file

@ -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<int16_t>);
void ClientDisconnected ( const int iChID );
void AudioFrame ( const int iChID,
const QString stChName,
const CHostAddress RecHostAddr,
const int iNumAudChan,
const CVector<int16_t> vecsData );
public slots:
void OnTimer();