diff --git a/android/sound.cpp b/android/sound.cpp index 220a1ae9..f5c6e7b7 100644 --- a/android/sound.cpp +++ b/android/sound.cpp @@ -26,11 +26,11 @@ /* Implementation *************************************************************/ -CSound::CSound ( void (*fpNewProcessCallback) ( CVector& psData, void* arg ), - void* arg, - const int iCtrlMIDIChannel, - const bool bNoAutoJackConnect, - const QString& strJackClientName ) : +CSound::CSound ( void (*fpNewProcessCallback) ( CVector& psData, void* arg ), + void* arg, + const int iCtrlMIDIChannel, + const bool bNoAutoJackConnect, + const QString& strJackClientName ) : CSoundBase ( "OpenSL", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect, strJackClientName ) { diff --git a/linux/sound.cpp b/linux/sound.cpp index a84e4139..61100bae 100755 --- a/linux/sound.cpp +++ b/linux/sound.cpp @@ -27,7 +27,7 @@ #include "sound.h" #ifdef WITH_SOUND -void CSound::OpenJack(char* jackClientName) +void CSound::OpenJack ( const char* jackClientName ) { jack_status_t JackStatus; diff --git a/linux/sound.h b/linux/sound.h index 620ead89..332229e9 100755 --- a/linux/sound.h +++ b/linux/sound.h @@ -60,12 +60,14 @@ class CSound : public CSoundBase { public: - CSound ( void (*fpNewProcessCallback) ( CVector& psData, void* arg ), - void* arg, - const int iCtrlMIDIChannel, - const bool bNoAutoJackConnect, - const QString& strJackClientName ) : - CSoundBase ( "Jack", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect, strJackClientName ), iJACKBufferSizeMono ( 0 ) { OpenJack( strJackClientName.toLocal8Bit().data() ); } + CSound ( void (*fpNewProcessCallback) ( CVector& psData, void* arg ), + void* arg, + const int iCtrlMIDIChannel, + const bool bNoAutoJackConnect, + const QString& strJackClientName ) : + CSoundBase ( "Jack", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect, strJackClientName ), + iJACKBufferSizeMono ( 0 ) { OpenJack ( strJackClientName.toLocal8Bit().data() ); } + virtual ~CSound() { CloseJack(); } virtual int Init ( const int iNewPrefMonoBufferSize ); @@ -85,7 +87,7 @@ public: jack_port_t* input_port_midi; protected: - void OpenJack(char* jackClientName); + void OpenJack ( const char* jackClientName ); void CloseJack(); // callbacks diff --git a/mac/sound.h b/mac/sound.h index 6ef1093e..3ec81a07 100755 --- a/mac/sound.h +++ b/mac/sound.h @@ -36,11 +36,11 @@ class CSound : public CSoundBase { public: - CSound ( void (*fpNewProcessCallback) ( CVector& psData, void* arg ), - void* arg, - const int iCtrlMIDIChannel, - const bool bNoAutoJackConnect, - const QString& strJackClientName ); + CSound ( void (*fpNewProcessCallback) ( CVector& psData, void* arg ), + void* arg, + const int iCtrlMIDIChannel, + const bool bNoAutoJackConnect, + const QString& strJackClientName ); virtual int Init ( const int iNewPrefMonoBufferSize ); virtual void Start(); diff --git a/src/client.cpp b/src/client.cpp index 2c55d6b7..ecb56ce2 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -30,7 +30,7 @@ CClient::CClient ( const quint16 iPortNumber, const QString& strConnOnStartupAddress, const int iCtrlMIDIChannel, const bool bNoAutoJackConnect, - const QString& strClientName ) : + const QString& strNClientName ) : vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ), ChannelInfo (), vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ), @@ -60,7 +60,7 @@ CClient::CClient ( const quint16 iPortNumber, bIsInitializationPhase ( true ), bMuteOutStream ( false ), Socket ( &Channel, iPortNumber ), - Sound ( AudioCallback, this, iCtrlMIDIChannel, bNoAutoJackConnect, strClientName ), + Sound ( AudioCallback, this, iCtrlMIDIChannel, bNoAutoJackConnect, strNClientName ), iAudioInFader ( AUD_FADER_IN_MIDDLE ), bReverbOnLeftChan ( false ), iReverbLevel ( 0 ), @@ -78,11 +78,8 @@ CClient::CClient ( const quint16 iPortNumber, strCentralServerAddress ( "" ), eCentralServerAddressType ( AT_DEFAULT ), iServerSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL ), - strClientName ( APP_NAME ) + strClientName ( strNClientName ) { - - SetClientName ( strClientName ); - int iOpusError; OpusMode = opus_custom_mode_create ( SYSTEM_SAMPLE_RATE_HZ, diff --git a/src/client.h b/src/client.h index d552e194..76df0702 100755 --- a/src/client.h +++ b/src/client.h @@ -108,18 +108,13 @@ public: const QString& strConnOnStartupAddress, const int iCtrlMIDIChannel, const bool bNoAutoJackConnect, - const QString& strClientName ); + const QString& strNClientName ); void Start(); void Stop(); bool IsRunning() { return Sound.IsRunning(); } 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_R() { return SignalLevelMeter.MicLeveldBRight(); } @@ -288,6 +283,7 @@ public: CVector vecStoredFaderIsMute; int iNewClientFaderLevel; bool bConnectDlgShowAllMusicians; + QString strClientName; // window position/state settings QByteArray vecWindowPosMain; @@ -389,8 +385,6 @@ protected: // for ping measurement CPreciseTime PreciseTime; - - QString strClientName; public slots: void OnSendProtMessage ( CVector vecMessage ); diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 0217f7a0..9a510084 100755 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -802,24 +802,24 @@ void CClientDlg::OnNumClientsChanged ( int iNewNumClients ) SetMyWindowTitle ( iNewNumClients ); } -void CClientDlg::SetMyWindowTitle ( const int iNumClients) +void CClientDlg::SetMyWindowTitle ( const int iNumClients ) { // show number of connected clients in window title (and therefore also in // the task bar of the OS) if ( iNumClients == 0 ) { // only application name - setWindowTitle ( pClient->GetClientName() ); + setWindowTitle ( pClient->strClientName ); } else { if ( iNumClients == 1 ) { - setWindowTitle ( QString ( pClient->GetClientName() ) + " (1 user)" ); + setWindowTitle ( QString ( pClient->strClientName ) + " (1 user)" ); } else { - setWindowTitle ( QString ( pClient->GetClientName() ) + + setWindowTitle ( QString ( pClient->strClientName ) + QString ( " (%1 users)" ).arg ( iNumClients ) ); } } diff --git a/src/clientdlg.h b/src/clientdlg.h index 4cbf87b1..ddd284fd 100755 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -95,7 +95,6 @@ protected: CClient* pClient; CSettings* pSettings; - QString strClientName; bool bConnected; bool bConnectDlgWasShown; QTimer TimerSigMet; diff --git a/src/main.cpp b/src/main.cpp index 61ea2731..9fcc413f 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -328,7 +328,22 @@ int main ( int argc, char** argv ) } - // HTML status file ---------------------------------------------------- + // Client Name --------------------------------------------------------- + if ( GetStringArgument ( tsConsole, + argc, + argv, + i, + "--clientname", + "--clientname", + strArgument ) ) + { + strClientName = QString ( APP_NAME ) + " " + strArgument; + tsConsole << "- client name: " << strClientName << endl; + continue; + } + + + // Server history file name -------------------------------------------- if ( GetStringArgument ( tsConsole, argc, argv, @@ -432,19 +447,6 @@ int main ( int argc, char** argv ) continue; } - // Client Name --------------------------------------------------------- - if ( GetStringArgument ( tsConsole, - argc, - argv, - i, - "--clientname", - "--clientname", - strArgument ) ) - { - strClientName = strArgument; - tsConsole << "- client name: " << strClientName << endl; - continue; - } // Version number ------------------------------------------------------ if ( ( !strcmp ( argv[i], "--version" ) ) || @@ -487,6 +489,7 @@ int main ( int argc, char** argv ) strCentralServer = DEFAULT_SERVER_ADDRESS; } + // Application/GUI setup --------------------------------------------------- // Application object if ( !bUseGUI && !strHistoryFileName.isEmpty() ) @@ -687,7 +690,7 @@ QString UsageArguments ( char **argv ) " -D, --histdays number of days of history to display (server only)\n" " -z, --startminimized start minimizied (server only)\n" " --ctrlmidich MIDI controller channel to listen (client only)\n" - " --clientname Jamulus client name (windows title and jack client name)\n" + " --clientname client name (window title and jack client name)\n" "\nExample: " + QString ( argv[0] ) + " -l -inifile myinifile.ini\n"; } diff --git a/windows/sound.cpp b/windows/sound.cpp index 6bf6e448..5745c77d 100755 --- a/windows/sound.cpp +++ b/windows/sound.cpp @@ -483,12 +483,12 @@ void CSound::Stop() } } -CSound::CSound ( void (*fpNewCallback) ( CVector& psData, void* arg ), - void* arg, - const int iCtrlMIDIChannel, - const bool bNoAutoJackConnect, - const QString& strJackClientName ) : - CSoundBase ( "ASIO", true, fpNewCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect, strJackClientName ), +CSound::CSound ( void (*fpNewCallback) ( CVector& psData, void* arg ), + void* arg, + const int iCtrlMIDIChannel, + const bool bNoAutoJackConnect, + const QString& strJackClientName ) : + CSoundBase ( "ASIO", true, fpNewCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect, strJackClientName ), lNumInChan ( 0 ), lNumInChanPlusAddChan ( 0 ), lNumOutChan ( 0 ), diff --git a/windows/sound.h b/windows/sound.h index 6ff3a4dd..4a9dfaf0 100755 --- a/windows/sound.h +++ b/windows/sound.h @@ -46,11 +46,11 @@ class CSound : public CSoundBase { public: - CSound ( void (*fpNewCallback) ( CVector& psData, void* arg ), - void* arg, - const int iCtrlMIDIChannel, - const bool bNoAutoJackConnect, - const QString& strJackClientName ); + CSound ( void (*fpNewCallback) ( CVector& psData, void* arg ), + void* arg, + const int iCtrlMIDIChannel, + const bool bNoAutoJackConnect, + const QString& strJackClientName ); virtual ~CSound() { UnloadCurrentDriver(); }