Request new recording on SIGUSR1

This commit is contained in:
Peter L Jones 2020-05-15 21:52:13 +01:00
parent 376ce88f76
commit 4bf5176e6a
3 changed files with 19 additions and 0 deletions

View File

@ -314,6 +314,10 @@ void CJamRecorder::Init( const CServer* server,
throw std::runtime_error( (recordBaseDir.absolutePath() + " is a directory but cannot be written to").toStdString() );
}
QObject::connect( (const QObject *)server, SIGNAL ( RestartRecorder() ),
this, SLOT( OnTriggerSession() ),
Qt::ConnectionType::QueuedConnection );
QObject::connect( (const QObject *)server, SIGNAL ( Stopped() ),
this, SLOT( OnEnd() ),
Qt::ConnectionType::QueuedConnection );

View File

@ -678,6 +678,10 @@ void CServer::OnHandledSignal ( int sigNum )
switch ( sigNum )
{
case SIGUSR1:
RequestNewRecording();
break;
case SIGINT:
case SIGTERM:
// This should trigger OnAboutToQuit
@ -1586,3 +1590,11 @@ void CServer::CreateLevelsForAllConChannels ( const int i
vecLevelsOut[j] = static_cast<uint16_t> ( ceil ( dCurSigLevel ) );
}
}
void CServer::RequestNewRecording()
{
if ( bEnableRecording )
{
emit RestartRecorder();
}
}

View File

@ -285,6 +285,8 @@ protected:
const CVector<CVector<int16_t> > vecvecsData,
CVector<uint16_t>& vecLevelsOut );
void RequestNewRecording();
// do not use the vector class since CChannel does not have appropriate
// copy constructor/operator
CChannel vecChannels[MAX_NUM_CHANNELS];
@ -364,6 +366,7 @@ signals:
const CHostAddress RecHostAddr,
const int iNumAudChan,
const CVector<int16_t> vecsData );
void RestartRecorder();
public slots:
void OnTimer();