Set the clientdlg window title and jack client name

This commit is contained in:
newlaurent62 2020-04-30 20:48:48 +02:00
parent 1494de7b05
commit 0d517654d6
15 changed files with 84 additions and 43 deletions

View file

@ -29,8 +29,9 @@
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
void* arg, void* arg,
const int iCtrlMIDIChannel, const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect ) : const bool bNoAutoJackConnect,
CSoundBase ( "OpenSL", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect ) const QString& strJackClientName ) :
CSoundBase ( "OpenSL", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect, strJackClientName )
{ {
} }

View file

@ -38,7 +38,8 @@ public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
void* arg, void* arg,
const int iCtrlMIDIChannel, const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect ); const bool bNoAutoJackConnect,
const QString& strJackClientName );
virtual ~CSound() {} virtual ~CSound() {}
virtual int Init ( const int iNewPrefMonoBufferSize ); virtual int Init ( const int iNewPrefMonoBufferSize );

View file

@ -27,12 +27,12 @@
#include "sound.h" #include "sound.h"
#ifdef WITH_SOUND #ifdef WITH_SOUND
void CSound::OpenJack() void CSound::OpenJack(char* jackClientName)
{ {
jack_status_t JackStatus; jack_status_t JackStatus;
// try to become a client of the JACK server // try to become a client of the JACK server
pJackClient = jack_client_open ( APP_NAME, JackNullOption, &JackStatus ); pJackClient = jack_client_open ( jackClientName, JackNullOption, &JackStatus );
if ( pJackClient == nullptr ) if ( pJackClient == nullptr )
{ {

View file

@ -63,9 +63,9 @@ public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
void* arg, void* arg,
const int iCtrlMIDIChannel, const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect ) : const bool bNoAutoJackConnect,
CSoundBase ( "Jack", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect ), iJACKBufferSizeMono ( 0 ), const QString& strJackClientName ) :
iJACKBufferSizeStero ( 0 ) { OpenJack(); } CSoundBase ( "Jack", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect, strJackClientName ), iJACKBufferSizeMono ( 0 ) { OpenJack( strJackClientName.toLocal8Bit().data() ); }
virtual ~CSound() { CloseJack(); } virtual ~CSound() { CloseJack(); }
virtual int Init ( const int iNewPrefMonoBufferSize ); virtual int Init ( const int iNewPrefMonoBufferSize );
@ -85,7 +85,7 @@ public:
jack_port_t* input_port_midi; jack_port_t* input_port_midi;
protected: protected:
void OpenJack(); void OpenJack(char* jackClientName);
void CloseJack(); void CloseJack();
// callbacks // callbacks
@ -102,8 +102,9 @@ public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ), CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ),
void* pParg, void* pParg,
const int iCtrlMIDIChannel, const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect ) : const bool bNoAutoJackConnect,
CSoundBase ( "nosound", false, fpNewProcessCallback, pParg, iCtrlMIDIChannel, bNoAutoJackConnect ) {} const QString& strJackClientName ) :
CSoundBase ( "nosound", false, fpNewProcessCallback, pParg, iCtrlMIDIChannel, bNoAutoJackConnect, strJackClientName ) {}
virtual ~CSound() {} virtual ~CSound() {}
}; };
#endif // WITH_SOUND #endif // WITH_SOUND

View file

@ -29,8 +29,9 @@
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
void* arg, void* arg,
const int iCtrlMIDIChannel, const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect ) : const bool bNoAutoJackConnect,
CSoundBase ( "CoreAudio", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect ), QString& strJackClientName ) :
CSoundBase ( "CoreAudio", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect, strJackClientName ),
midiInPortRef ( static_cast<MIDIPortRef> ( NULL ) ) midiInPortRef ( static_cast<MIDIPortRef> ( NULL ) )
{ {
// Apple Mailing Lists: Subject: GUI Apps should set kAudioHardwarePropertyRunLoop // Apple Mailing Lists: Subject: GUI Apps should set kAudioHardwarePropertyRunLoop

View file

@ -39,7 +39,8 @@ public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
void* arg, void* arg,
const int iCtrlMIDIChannel, const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect ); const bool bNoAutoJackConnect,
const QString& strJackClientName );
virtual int Init ( const int iNewPrefMonoBufferSize ); virtual int Init ( const int iNewPrefMonoBufferSize );
virtual void Start(); virtual void Start();

View file

@ -29,7 +29,8 @@
CClient::CClient ( const quint16 iPortNumber, CClient::CClient ( const quint16 iPortNumber,
const QString& strConnOnStartupAddress, const QString& strConnOnStartupAddress,
const int iCtrlMIDIChannel, const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect ) : const bool bNoAutoJackConnect,
const QString& strClientName ) :
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ), vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ),
ChannelInfo (), ChannelInfo (),
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ), vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
@ -59,7 +60,7 @@ CClient::CClient ( const quint16 iPortNumber,
bIsInitializationPhase ( true ), bIsInitializationPhase ( true ),
bMuteOutStream ( false ), bMuteOutStream ( false ),
Socket ( &Channel, iPortNumber ), Socket ( &Channel, iPortNumber ),
Sound ( AudioCallback, this, iCtrlMIDIChannel, bNoAutoJackConnect ), Sound ( AudioCallback, this, iCtrlMIDIChannel, bNoAutoJackConnect, strClientName ),
iAudioInFader ( AUD_FADER_IN_MIDDLE ), iAudioInFader ( AUD_FADER_IN_MIDDLE ),
bReverbOnLeftChan ( false ), bReverbOnLeftChan ( false ),
iReverbLevel ( 0 ), iReverbLevel ( 0 ),
@ -76,8 +77,12 @@ CClient::CClient ( const quint16 iPortNumber,
bJitterBufferOK ( true ), bJitterBufferOK ( true ),
strCentralServerAddress ( "" ), strCentralServerAddress ( "" ),
eCentralServerAddressType ( AT_DEFAULT ), eCentralServerAddressType ( AT_DEFAULT ),
iServerSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL ) iServerSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL ),
strClientName ( APP_NAME )
{ {
SetClientName ( strClientName );
int iOpusError; int iOpusError;
OpusMode = opus_custom_mode_create ( SYSTEM_SAMPLE_RATE_HZ, OpusMode = opus_custom_mode_create ( SYSTEM_SAMPLE_RATE_HZ,

View file

@ -107,13 +107,19 @@ public:
CClient ( const quint16 iPortNumber, CClient ( const quint16 iPortNumber,
const QString& strConnOnStartupAddress, const QString& strConnOnStartupAddress,
const int iCtrlMIDIChannel, const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect ); const bool bNoAutoJackConnect,
const QString& strClientName );
void Start(); void Start();
void Stop(); void Stop();
bool IsRunning() { return Sound.IsRunning(); } bool IsRunning() { return Sound.IsRunning(); }
bool SetServerAddr ( QString strNAddr ); bool SetServerAddr ( QString strNAddr );
QString GetClientName() const { return this->strClientName; }
void SetClientName ( const QString& strClientName ) {
this->strClientName = strClientName;
}
double MicLeveldB_L() { return SignalLevelMeter.MicLeveldBLeft(); } double MicLeveldB_L() { return SignalLevelMeter.MicLeveldBLeft(); }
double MicLeveldB_R() { return SignalLevelMeter.MicLeveldBRight(); } double MicLeveldB_R() { return SignalLevelMeter.MicLeveldBRight(); }
@ -384,6 +390,8 @@ protected:
// for ping measurement // for ping measurement
CPreciseTime PreciseTime; CPreciseTime PreciseTime;
QString strClientName;
public slots: public slots:
void OnSendProtMessage ( CVector<uint8_t> vecMessage ); void OnSendProtMessage ( CVector<uint8_t> vecMessage );
void OnInvalidPacketReceived ( CHostAddress RecHostAddr ); void OnInvalidPacketReceived ( CHostAddress RecHostAddr );

View file

@ -809,17 +809,17 @@ void CClientDlg::SetMyWindowTitle ( const int iNumClients )
if ( iNumClients == 0 ) if ( iNumClients == 0 )
{ {
// only application name // only application name
setWindowTitle ( APP_NAME ); setWindowTitle ( pClient->GetClientName() );
} }
else else
{ {
if ( iNumClients == 1 ) if ( iNumClients == 1 )
{ {
setWindowTitle ( QString ( APP_NAME ) + " (1 user)" ); setWindowTitle ( QString ( pClient->GetClientName() ) + " (1 user)" );
} }
else else
{ {
setWindowTitle ( QString ( APP_NAME ) + setWindowTitle ( QString ( pClient->GetClientName() ) +
QString ( " (%1 users)" ).arg ( iNumClients ) ); QString ( " (%1 users)" ).arg ( iNumClients ) );
} }
} }

View file

@ -95,6 +95,7 @@ protected:
CClient* pClient; CClient* pClient;
CSettings* pSettings; CSettings* pSettings;
QString strClientName;
bool bConnected; bool bConnected;
bool bConnectDlgWasShown; bool bConnectDlgWasShown;
QTimer TimerSigMet; QTimer TimerSigMet;

View file

@ -76,6 +76,7 @@ int main ( int argc, char** argv )
QString strCentralServer = ""; QString strCentralServer = "";
QString strServerInfo = ""; QString strServerInfo = "";
QString strWelcomeMessage = ""; QString strWelcomeMessage = "";
QString strClientName = APP_NAME;
// QT docu: argv()[0] is the program name, argv()[1] is the first // QT docu: argv()[0] is the program name, argv()[1] is the first
// argument and argv()[argc()-1] is the last argument. // argument and argv()[argc()-1] is the last argument.
@ -431,6 +432,19 @@ int main ( int argc, char** argv )
continue; continue;
} }
// Client Name ---------------------------------------------------------
if ( GetStringArgument ( tsConsole,
argc,
argv,
i,
"--clientname",
"--clientname",
strArgument ) )
{
strClientName = strArgument;
tsConsole << "- client name: " << strClientName << endl;
continue;
}
// Version number ------------------------------------------------------ // Version number ------------------------------------------------------
if ( ( !strcmp ( argv[i], "--version" ) ) || if ( ( !strcmp ( argv[i], "--version" ) ) ||
@ -473,7 +487,6 @@ int main ( int argc, char** argv )
strCentralServer = DEFAULT_SERVER_ADDRESS; strCentralServer = DEFAULT_SERVER_ADDRESS;
} }
// Application/GUI setup --------------------------------------------------- // Application/GUI setup ---------------------------------------------------
// Application object // Application object
if ( !bUseGUI && !strHistoryFileName.isEmpty() ) if ( !bUseGUI && !strHistoryFileName.isEmpty() )
@ -523,7 +536,8 @@ int main ( int argc, char** argv )
CClient Client ( iPortNumber, CClient Client ( iPortNumber,
strConnOnStartupAddress, strConnOnStartupAddress,
iCtrlMIDIChannel, iCtrlMIDIChannel,
bNoAutoJackConnect ); bNoAutoJackConnect,
strClientName );
// load settings from init-file // load settings from init-file
CSettings Settings ( &Client, strIniFileName ); CSettings Settings ( &Client, strIniFileName );
@ -672,7 +686,8 @@ QString UsageArguments ( char **argv )
" name (server only)\n" " name (server only)\n"
" -D, --histdays number of days of history to display (server only)\n" " -D, --histdays number of days of history to display (server only)\n"
" -z, --startminimized start minimizied (server only)\n" " -z, --startminimized start minimizied (server only)\n"
" --ctrlmidich MIDI controller channel to listen (client only)" " --ctrlmidich MIDI controller channel to listen (client only)\n"
" --clientname Jamulus client name (windows title and jack client name)\n"
"\nExample: " + QString ( argv[0] ) + " -l -inifile myinifile.ini\n"; "\nExample: " + QString ( argv[0] ) + " -l -inifile myinifile.ini\n";
} }

View file

@ -31,13 +31,15 @@ CSoundBase::CSoundBase ( const QString& strNewSystemDriverTechniqueName,
void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ), void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ),
void* pParg, void* pParg,
const int iNewCtrlMIDIChannel, const int iNewCtrlMIDIChannel,
const bool bNewNoAutoJackConnect ) : const bool bNewNoAutoJackConnect,
const QString& strNewJackClientName ) :
fpProcessCallback ( fpNewProcessCallback ), fpProcessCallback ( fpNewProcessCallback ),
pProcessCallbackArg ( pParg ), bRun ( false ), pProcessCallbackArg ( pParg ), bRun ( false ),
bIsCallbackAudioInterface ( bNewIsCallbackAudioInterface ), bIsCallbackAudioInterface ( bNewIsCallbackAudioInterface ),
strSystemDriverTechniqueName ( strNewSystemDriverTechniqueName ), strSystemDriverTechniqueName ( strNewSystemDriverTechniqueName ),
iCtrlMIDIChannel ( iNewCtrlMIDIChannel ), iCtrlMIDIChannel ( iNewCtrlMIDIChannel ),
bNoAutoJackConnect ( bNewNoAutoJackConnect ) bNoAutoJackConnect ( bNewNoAutoJackConnect ),
strJackClientName ( strNewJackClientName )
{ {
// initializations for the sound card names (default) // initializations for the sound card names (default)
lNumDevs = 1; lNumDevs = 1;

View file

@ -52,7 +52,8 @@ public:
void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ), void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ),
void* pParg, void* pParg,
const int iNewCtrlMIDIChannel, const int iNewCtrlMIDIChannel,
const bool bNewNoAutoJackConnect ); const bool bNewNoAutoJackConnect,
const QString& strNewJackClientName );
virtual int Init ( const int iNewPrefMonoBufferSize ); virtual int Init ( const int iNewPrefMonoBufferSize );
virtual void Start(); virtual void Start();
@ -122,6 +123,7 @@ protected:
QString strSystemDriverTechniqueName; QString strSystemDriverTechniqueName;
int iCtrlMIDIChannel; int iCtrlMIDIChannel;
bool bNoAutoJackConnect; bool bNoAutoJackConnect;
QString strJackClientName;
CVector<int16_t> vecsAudioSndCrdStereo; CVector<int16_t> vecsAudioSndCrdStereo;

View file

@ -486,8 +486,9 @@ void CSound::Stop()
CSound::CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ), CSound::CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ),
void* arg, void* arg,
const int iCtrlMIDIChannel, const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect) : const bool bNoAutoJackConnect,
CSoundBase ( "ASIO", true, fpNewCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect ), const QString& strJackClientName ) :
CSoundBase ( "ASIO", true, fpNewCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect, strJackClientName ),
lNumInChan ( 0 ), lNumInChan ( 0 ),
lNumInChanPlusAddChan ( 0 ), lNumInChanPlusAddChan ( 0 ),
lNumOutChan ( 0 ), lNumOutChan ( 0 ),

View file

@ -49,7 +49,9 @@ public:
CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ), CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ),
void* arg, void* arg,
const int iCtrlMIDIChannel, const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect ); const bool bNoAutoJackConnect,
const QString& strJackClientName );
virtual ~CSound() { UnloadCurrentDriver(); } virtual ~CSound() { UnloadCurrentDriver(); }
virtual int Init ( const int iNewPrefMonoBufferSize ); virtual int Init ( const int iNewPrefMonoBufferSize );