added command line argument for disabling auto jack connection (Ticket #49)
This commit is contained in:
parent
25d06b7e82
commit
81b5cf7861
14 changed files with 110 additions and 85 deletions
|
@ -5,6 +5,8 @@
|
|||
|
||||
- added support for controlling the audio mixer faders with a MIDI controller (MacOS only)
|
||||
|
||||
- added command line argument for disabling auto jack connection (Ticket #49)
|
||||
|
||||
- audio recording for the server, coded by pljones
|
||||
|
||||
- SVG server history graph, coded by pljones
|
||||
|
|
|
@ -26,10 +26,11 @@
|
|||
|
||||
|
||||
/* Implementation *************************************************************/
|
||||
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel ) :
|
||||
CSoundBase ( "OpenSL", true, fpNewProcessCallback, arg, iCtrlMIDIChannel )
|
||||
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel,
|
||||
const bool bNoAutoJackConnect ) :
|
||||
CSoundBase ( "OpenSL", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect )
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -35,9 +35,10 @@
|
|||
class CSound : public CSoundBase
|
||||
{
|
||||
public:
|
||||
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel );
|
||||
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel,
|
||||
const bool bNoAutoJackConnect );
|
||||
virtual ~CSound() {}
|
||||
|
||||
virtual int Init ( const int iNewPrefMonoBufferSize );
|
||||
|
|
|
@ -87,73 +87,67 @@ void CSound::OpenJack()
|
|||
throw CGenErr ( tr ( "The Jack port registering failed." ) );
|
||||
}
|
||||
|
||||
const char** ports;
|
||||
|
||||
// tell the JACK server that we are ready to roll
|
||||
if ( jack_activate ( pJackClient ) )
|
||||
{
|
||||
throw CGenErr ( tr ( "Cannot activate the Jack client." ) );
|
||||
}
|
||||
|
||||
// connect the ports, note: you cannot do this before
|
||||
// the client is activated, because we cannot allow
|
||||
// connections to be made to clients that are not
|
||||
// running
|
||||
|
||||
// try to connect physical input ports
|
||||
if ( ( ports = jack_get_ports ( pJackClient,
|
||||
NULL,
|
||||
NULL,
|
||||
JackPortIsPhysical | JackPortIsOutput ) ) != NULL )
|
||||
if ( !bNoAutoJackConnect )
|
||||
{
|
||||
if ( jack_connect ( pJackClient, ports[0], jack_port_name ( input_port_left ) ) )
|
||||
// connect the ports, note: you cannot do this before
|
||||
// the client is activated, because we cannot allow
|
||||
// connections to be made to clients that are not
|
||||
// running
|
||||
const char** ports;
|
||||
|
||||
// try to connect physical input ports
|
||||
if ( ( ports = jack_get_ports ( pJackClient,
|
||||
NULL,
|
||||
NULL,
|
||||
JackPortIsPhysical | JackPortIsOutput ) ) != NULL )
|
||||
{
|
||||
throw CGenErr ( tr ( "Cannot connect the Jack input ports" ) );
|
||||
}
|
||||
|
||||
// before connecting the second stereo channel, check if the input is not
|
||||
// mono
|
||||
|
||||
// TODO who checks if ports[1] actually exists??? I assume that if we have mono, the
|
||||
// ports array is only one item long...?
|
||||
|
||||
if ( ports[1] )
|
||||
{
|
||||
if ( jack_connect ( pJackClient, ports[1], jack_port_name ( input_port_right ) ) )
|
||||
if ( jack_connect ( pJackClient, ports[0], jack_port_name ( input_port_left ) ) )
|
||||
{
|
||||
throw CGenErr ( tr ( "Cannot connect the Jack input ports" ) );
|
||||
}
|
||||
|
||||
// before connecting the second stereo channel, check if the input is not
|
||||
// mono
|
||||
if ( ports[1] )
|
||||
{
|
||||
if ( jack_connect ( pJackClient, ports[1], jack_port_name ( input_port_right ) ) )
|
||||
{
|
||||
throw CGenErr ( tr ( "Cannot connect the Jack input ports" ) );
|
||||
}
|
||||
}
|
||||
|
||||
jack_free ( ports );
|
||||
}
|
||||
|
||||
jack_free ( ports );
|
||||
}
|
||||
|
||||
// try to connect physical output ports
|
||||
if ( ( ports = jack_get_ports ( pJackClient,
|
||||
NULL,
|
||||
NULL,
|
||||
JackPortIsPhysical | JackPortIsInput ) ) != NULL )
|
||||
{
|
||||
if ( jack_connect ( pJackClient, jack_port_name ( output_port_left ), ports[0] ) )
|
||||
// try to connect physical output ports
|
||||
if ( ( ports = jack_get_ports ( pJackClient,
|
||||
NULL,
|
||||
NULL,
|
||||
JackPortIsPhysical | JackPortIsInput ) ) != NULL )
|
||||
{
|
||||
throw CGenErr ( tr ( "Cannot connect the Jack output ports." ) );
|
||||
}
|
||||
|
||||
// before connecting the second stereo channel, check if the output is not
|
||||
// mono
|
||||
|
||||
// TODO who checks if ports[1] actually exists??? I assume that if we have mono, the
|
||||
// ports array is only one item long...?
|
||||
|
||||
if ( ports[1] )
|
||||
{
|
||||
if ( jack_connect ( pJackClient, jack_port_name ( output_port_right ), ports[1] ) )
|
||||
if ( jack_connect ( pJackClient, jack_port_name ( output_port_left ), ports[0] ) )
|
||||
{
|
||||
throw CGenErr ( tr ( "Cannot connect the Jack output ports." ) );
|
||||
}
|
||||
}
|
||||
|
||||
jack_free ( ports );
|
||||
// before connecting the second stereo channel, check if the output is not
|
||||
// mono
|
||||
if ( ports[1] )
|
||||
{
|
||||
if ( jack_connect ( pJackClient, jack_port_name ( output_port_right ), ports[1] ) )
|
||||
{
|
||||
throw CGenErr ( tr ( "Cannot connect the Jack output ports." ) );
|
||||
}
|
||||
}
|
||||
|
||||
jack_free ( ports );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,10 +59,11 @@
|
|||
class CSound : public CSoundBase
|
||||
{
|
||||
public:
|
||||
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel ) :
|
||||
CSoundBase ( "Jack", true, fpNewProcessCallback, arg, iCtrlMIDIChannel ), iJACKBufferSizeMono ( 0 ),
|
||||
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel,
|
||||
const bool bNoAutoJackConnect ) :
|
||||
CSoundBase ( "Jack", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect ), iJACKBufferSizeMono ( 0 ),
|
||||
iJACKBufferSizeStero ( 0 ) { OpenJack(); }
|
||||
virtual ~CSound() { CloseJack(); }
|
||||
|
||||
|
@ -96,10 +97,11 @@ protected:
|
|||
class CSound : public CSoundBase
|
||||
{
|
||||
public:
|
||||
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ),
|
||||
void* pParg,
|
||||
const int iCtrlMIDIChannel ) :
|
||||
CSoundBase ( "nosound", false, fpNewProcessCallback, pParg, iCtrlMIDIChannel ) {}
|
||||
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ),
|
||||
void* pParg,
|
||||
const int iCtrlMIDIChannel,
|
||||
const bool bNoAutoJackConnect ) :
|
||||
CSoundBase ( "nosound", false, fpNewProcessCallback, pParg, iCtrlMIDIChannel, bNoAutoJackConnect ) {}
|
||||
virtual ~CSound() {}
|
||||
};
|
||||
#endif // WITH_SOUND
|
||||
|
|
|
@ -26,10 +26,11 @@
|
|||
|
||||
|
||||
/* Implementation *************************************************************/
|
||||
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel ) :
|
||||
CSoundBase ( "CoreAudio", true, fpNewProcessCallback, arg, iCtrlMIDIChannel ),
|
||||
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel,
|
||||
const bool bNoAutoJackConnect ) :
|
||||
CSoundBase ( "CoreAudio", true, fpNewProcessCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect ),
|
||||
midiInPortRef ( static_cast<MIDIPortRef> ( NULL ) )
|
||||
{
|
||||
// Apple Mailing Lists: Subject: GUI Apps should set kAudioHardwarePropertyRunLoop
|
||||
|
|
|
@ -35,9 +35,10 @@
|
|||
class CSound : public CSoundBase
|
||||
{
|
||||
public:
|
||||
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel );
|
||||
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel,
|
||||
const bool bNoAutoJackConnect );
|
||||
|
||||
virtual int Init ( const int iNewPrefMonoBufferSize );
|
||||
virtual void Start();
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
/* Implementation *************************************************************/
|
||||
CClient::CClient ( const quint16 iPortNumber,
|
||||
const QString& strConnOnStartupAddress,
|
||||
const int iCtrlMIDIChannel ) :
|
||||
const int iCtrlMIDIChannel,
|
||||
const bool bNoAutoJackConnect ) :
|
||||
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ),
|
||||
ChannelInfo (),
|
||||
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
|
||||
|
@ -51,7 +52,7 @@ CClient::CClient ( const quint16 iPortNumber,
|
|||
eAudioChannelConf ( CC_MONO ),
|
||||
bIsInitializationPhase ( true ),
|
||||
Socket ( &Channel, iPortNumber ),
|
||||
Sound ( AudioCallback, this, iCtrlMIDIChannel ),
|
||||
Sound ( AudioCallback, this, iCtrlMIDIChannel, bNoAutoJackConnect ),
|
||||
iAudioInFader ( AUD_FADER_IN_MIDDLE ),
|
||||
bReverbOnLeftChan ( false ),
|
||||
iReverbLevel ( 0 ),
|
||||
|
|
|
@ -100,7 +100,8 @@ class CClient : public QObject
|
|||
public:
|
||||
CClient ( const quint16 iPortNumber,
|
||||
const QString& strConnOnStartupAddress,
|
||||
const int iCtrlMIDIChannel );
|
||||
const int iCtrlMIDIChannel,
|
||||
const bool bNoAutoJackConnect );
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
|
|
17
src/main.cpp
17
src/main.cpp
|
@ -51,6 +51,7 @@ int main ( int argc, char** argv )
|
|||
bool bDisconnectAllClients = false;
|
||||
bool bShowAnalyzerConsole = false;
|
||||
bool bCentServPingServerInList = false;
|
||||
bool bNoAutoJackConnect = false;
|
||||
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
|
||||
int iCtrlMIDIChannel = INVALID_MIDI_CH;
|
||||
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
|
||||
|
@ -153,6 +154,18 @@ int main ( int argc, char** argv )
|
|||
}
|
||||
|
||||
|
||||
// Disabling auto Jack connections -------------------------------------
|
||||
if ( GetFlagArgument ( argv,
|
||||
i,
|
||||
"-j",
|
||||
"--nojackconnect" ) )
|
||||
{
|
||||
bNoAutoJackConnect = true;
|
||||
tsConsole << "- disable auto Jack connections" << 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
|
||||
|
@ -448,7 +461,8 @@ int main ( int argc, char** argv )
|
|||
// actual client object
|
||||
CClient Client ( iPortNumber,
|
||||
strConnOnStartupAddress,
|
||||
iCtrlMIDIChannel );
|
||||
iCtrlMIDIChannel,
|
||||
bNoAutoJackConnect );
|
||||
|
||||
// load settings from init-file
|
||||
CSettings Settings ( &Client, strIniFileName );
|
||||
|
@ -575,6 +589,7 @@ QString UsageArguments ( char **argv )
|
|||
" (central server only)\n"
|
||||
" -h, -?, --help this help text\n"
|
||||
" -i, --inifile initialization file name (client only)\n"
|
||||
" -j, --nojackconnect disable auto Jack connections (client only)\n"
|
||||
" -l, --log enable logging, set file name\n"
|
||||
" -L, --licence a licence must be accepted on a new\n"
|
||||
" connection (server only)\n"
|
||||
|
|
|
@ -30,12 +30,14 @@ CSoundBase::CSoundBase ( const QString& strNewSystemDriverTechniqueName,
|
|||
const bool bNewIsCallbackAudioInterface,
|
||||
void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ),
|
||||
void* pParg,
|
||||
const int iNewCtrlMIDIChannel ) :
|
||||
const int iNewCtrlMIDIChannel,
|
||||
const bool bNewNoAutoJackConnect ) :
|
||||
fpProcessCallback ( fpNewProcessCallback ),
|
||||
pProcessCallbackArg ( pParg ), bRun ( false ),
|
||||
bIsCallbackAudioInterface ( bNewIsCallbackAudioInterface ),
|
||||
strSystemDriverTechniqueName ( strNewSystemDriverTechniqueName ),
|
||||
iCtrlMIDIChannel ( iNewCtrlMIDIChannel )
|
||||
iCtrlMIDIChannel ( iNewCtrlMIDIChannel ),
|
||||
bNoAutoJackConnect ( bNewNoAutoJackConnect )
|
||||
{
|
||||
// initializations for the sound card names (default)
|
||||
lNumDevs = 1;
|
||||
|
|
|
@ -51,7 +51,8 @@ public:
|
|||
const bool bNewIsCallbackAudioInterface,
|
||||
void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ),
|
||||
void* pParg,
|
||||
const int iNewCtrlMIDIChannel );
|
||||
const int iNewCtrlMIDIChannel,
|
||||
const bool bNewNoAutoJackConnect );
|
||||
|
||||
virtual int Init ( const int iNewPrefMonoBufferSize );
|
||||
virtual void Start();
|
||||
|
@ -120,6 +121,7 @@ protected:
|
|||
bool bIsCallbackAudioInterface;
|
||||
QString strSystemDriverTechniqueName;
|
||||
int iCtrlMIDIChannel;
|
||||
bool bNoAutoJackConnect;
|
||||
|
||||
CVector<int16_t> vecsAudioSndCrdStereo;
|
||||
|
||||
|
|
|
@ -449,10 +449,11 @@ void CSound::Stop()
|
|||
}
|
||||
}
|
||||
|
||||
CSound::CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel ) :
|
||||
CSoundBase ( "ASIO", true, fpNewCallback, arg, iCtrlMIDIChannel ),
|
||||
CSound::CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel,
|
||||
const bool bNoAutoJackConnect) :
|
||||
CSoundBase ( "ASIO", true, fpNewCallback, arg, iCtrlMIDIChannel, bNoAutoJackConnect ),
|
||||
vSelectedInputChannels ( NUM_IN_OUT_CHANNELS ),
|
||||
vSelectedOutputChannels ( NUM_IN_OUT_CHANNELS ),
|
||||
lNumInChan ( 0 ),
|
||||
|
|
|
@ -46,9 +46,10 @@
|
|||
class CSound : public CSoundBase
|
||||
{
|
||||
public:
|
||||
CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int );
|
||||
CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ),
|
||||
void* arg,
|
||||
const int iCtrlMIDIChannel,
|
||||
const bool bNoAutoJackConnect );
|
||||
virtual ~CSound() { UnloadCurrentDriver(); }
|
||||
|
||||
virtual int Init ( const int iNewPrefMonoBufferSize );
|
||||
|
|
Loading…
Reference in a new issue