本文整理汇总了C++中Preferences::getJackSessionUUID方法的典型用法代码示例。如果您正苦于以下问题:C++ Preferences::getJackSessionUUID方法的具体用法?C++ Preferences::getJackSessionUUID怎么用?C++ Preferences::getJackSessionUUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::getJackSessionUUID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
int JackOutput::init( unsigned /*nBufferSize*/ )
{
Preferences* pref = Preferences::get_instance();
output_port_name_1 = pref->m_sJackPortName1;
output_port_name_2 = pref->m_sJackPortName2;
QString sClientName = "Hydrogen";
#ifdef H2CORE_HAVE_NSMSESSION
QString nsmClientId = pref->getNsmClientId();
if(!nsmClientId.isEmpty()){
sClientName = nsmClientId;
}
#endif
jack_status_t status;
int tries = 2; // Sometimes jackd doesn't stop and start fast enough.
while ( tries > 0 ) {
--tries;
#ifdef H2CORE_HAVE_JACKSESSION
if (pref->getJackSessionUUID().isEmpty()){
client = jack_client_open(
sClientName.toLocal8Bit(),
JackNullOption,
&status);
} else {
const QByteArray uuid = pref->getJackSessionUUID().toLocal8Bit();
client = jack_client_open(
sClientName.toLocal8Bit(),
JackSessionID,
&status,
uuid.constData());
}
#else
client = jack_client_open(
sClientName.toLocal8Bit(),
JackNullOption,
&status);
#endif
switch(status) {
case JackFailure:
CLIENT_FAILURE("unknown error");
break;
case JackInvalidOption:
CLIENT_FAILURE("invalid option");
break;
case JackNameNotUnique:
if (client) {
sClientName = jack_get_client_name(client);
CLIENT_SUCCESS(QString("Jack assigned the client name '%1'").arg(sClientName));
} else {
CLIENT_FAILURE("name not unique");
}
break;
case JackServerStarted:
CLIENT_SUCCESS("JACK Server started for Hydrogen.");
break;
case JackServerFailed:
CLIENT_FAILURE("unable to connect");
break;
case JackServerError:
CLIENT_FAILURE("communication error");
break;
case JackNoSuchClient:
CLIENT_FAILURE("unknown client type");
break;
case JackLoadFailure:
CLIENT_FAILURE("can't load internal client");
break;
case JackInitFailure:
CLIENT_FAILURE("can't initialize client");
break;
case JackShmFailure:
CLIENT_FAILURE("unable to access shared memory");
break;
case JackVersionError:
CLIENT_FAILURE("client/server protocol version mismatch");
default:
if (status) {
ERRORLOG("Unknown status with JACK server.");
if (client) {
CLIENT_SUCCESS("Client pointer is *not* null..."
" assuming we're OK");
}
} else {
CLIENT_SUCCESS("Connected to JACK server");
}
}
}
if (client == 0) return -1;
// Here, client should either be valid, or NULL.
jack_server_sampleRate = jack_get_sample_rate ( client );
jack_server_bufferSize = jack_get_buffer_size ( client );
pref->m_nSampleRate = jack_server_sampleRate;
//.........这里部分代码省略.........
示例2: init
int JackAudioDriver::init( unsigned bufferSize )
{
// Destination ports the output of Hydrogen will be connected
// to.
Preferences* pPref = Preferences::get_instance();
output_port_name_1 = pPref->m_sJackPortName1;
output_port_name_2 = pPref->m_sJackPortName2;
QString sClientName = "Hydrogen";
#ifdef H2CORE_HAVE_OSC
QString sNsmClientId = pPref->getNsmClientId();
if(!sNsmClientId.isEmpty()){
sClientName = sNsmClientId;
}
#endif
// The address of the status object will be used by JACK to
// return information from the open operation.
jack_status_t status;
// Sometimes jackd doesn't stop and start fast enough.
int nTries = 2;
while ( nTries > 0 ) {
--nTries;
// Open an external client session with the JACK
// server. The `jack_client_open' function is defined
// in the jack/jack.h header. With it, clients may
// choose which of several servers to connect, and
// control whether and how to start the server
// automatically, if it was not already running. Its
// first argument _client_name_ of is at most
// jack_client_name_size() characters. The name scope
// is local to each server. Unless forbidden by the
// JackUseExactName option, the server will modify
// this name to create a unique variant, if
// needed. The second argument _options_ is formed by
// OR-ing together JackOptions bits. Only the
// JackOpenOptions bits are allowed. _status_ (if
// non-NULL) is an address for JACK to return
// information from the open operation. This status
// word is formed by OR-ing together the relevant
// JackStatus bits. Depending on the _status_, an
// optional argument _server_name_ selects from among
// several possible concurrent server
// instances. Server names are unique to each user. It
// returns an opaque client handle if successful. If
// this is NULL, the open operation failed, *status
// includes JackFailure and the caller is not a JACK
// client.
#ifdef H2CORE_HAVE_JACKSESSION
if (pPref->getJackSessionUUID().isEmpty()){
m_pClient = jack_client_open( sClientName.toLocal8Bit(),
JackNullOption,
&status);
} else {
// Unique name of the JACK server used within
// the JACK session.
const QByteArray uuid = pPref->getJackSessionUUID().toLocal8Bit();
// Using the JackSessionID option and the
// supplied SessionID Token the sessionmanager
// is able to identify the client again.
m_pClient = jack_client_open( sClientName.toLocal8Bit(),
JackSessionID,
&status,
uuid.constData());
}
#else
m_pClient = jack_client_open( sClientName.toLocal8Bit(),
JackNullOption,
&status);
#endif
// Check what did happen during the opening of the
// client. CLIENT_SUCCESS sets the nTries variable
// to 0 while CLIENT_FAILURE resets m_pClient to the
// nullptr.
switch(status) {
case JackFailure:
CLIENT_FAILURE("unknown error");
break;
case JackInvalidOption:
CLIENT_FAILURE("invalid option");
break;
case JackNameNotUnique:
if (m_pClient) {
sClientName = jack_get_client_name(m_pClient);
CLIENT_SUCCESS(QString("Jack assigned the client name '%1'").arg(sClientName));
} else {
CLIENT_FAILURE("name not unique");
}
break;
case JackServerStarted:
CLIENT_SUCCESS("JACK Server started for Hydrogen.");
break;
case JackServerFailed:
CLIENT_FAILURE("unable to connect");
break;
case JackServerError:
CLIENT_FAILURE("communication error");
//.........这里部分代码省略.........