本文整理汇总了C++中JackClientInterface类的典型用法代码示例。如果您正苦于以下问题:C++ JackClientInterface类的具体用法?C++ JackClientInterface怎么用?C++ JackClientInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JackClientInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NotifyClient
void JackEngine::NotifyClient(int refnum, int event, int sync, const char* message, int value1, int value2)
{
JackClientInterface* client = fClientTable[refnum];
if (client) {
ClientNotify(client, refnum, client->GetClientControl()->fName, event, sync, message, value1, value2);
}
}
示例2: ClientActivate
int JackEngine::ClientActivate(int refnum, bool is_real_time)
{
JackClientInterface* client = fClientTable[refnum];
jack_log("JackEngine::ClientActivate ref = %ld name = %s", refnum, client->GetClientControl()->fName);
if (is_real_time) {
fGraphManager->Activate(refnum);
}
// Wait for graph state change to be effective
if (!fSignal.LockedTimedWait(fEngineControl->fTimeOutUsecs * 10)) {
jack_error("JackEngine::ClientActivate wait error ref = %ld name = %s", refnum, client->GetClientControl()->fName);
return -1;
} else {
jack_int_t input_ports[PORT_NUM_FOR_CLIENT];
jack_int_t output_ports[PORT_NUM_FOR_CLIENT];
fGraphManager->GetInputPorts(refnum, input_ports);
fGraphManager->GetOutputPorts(refnum, output_ports);
// Notify client
NotifyActivate(refnum);
// Then issue port registration notification
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
NotifyPortRegistation(input_ports[i], true);
}
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (output_ports[i] != EMPTY); i++) {
NotifyPortRegistation(output_ports[i], true);
}
return 0;
}
}
示例3: GetInternalClientName
int JackEngine::GetInternalClientName(int refnum, char* name_res)
{
JackClientInterface* client = fClientTable[refnum];
assert(client);
strncpy(name_res, client->GetClientControl()->fName, JACK_CLIENT_NAME_SIZE);
return 0;
}
示例4: jack_log
// Used for external clients
int JackEngine::ClientExternalClose(int refnum)
{
jack_log("JackEngine::ClientExternalClose ref = %ld", refnum);
JackClientInterface* client = fClientTable[refnum];
int res = ClientCloseAux(refnum, true);
client->Close();
delete client;
return res;
}
示例5: GetClientRefNum
int JackEngine::GetClientRefNum(const char* name)
{
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client && (strcmp(client->GetClientControl()->fName, name) == 0)) {
return client->GetClientControl()->fRefNum;
}
}
return -1;
}
示例6: CalcCPULoad
void JackEngineControl::CalcCPULoad(JackClientInterface** table,
JackGraphManager* manager,
jack_time_t cur_cycle_begin,
jack_time_t prev_cycle_end)
{
fPrevCycleTime = fCurCycleTime;
fCurCycleTime = cur_cycle_begin;
jack_time_t last_cycle_end = prev_cycle_end;
// In Asynchronous mode, last cycle end is the max of client end dates
if (!fSyncMode) {
for (int i = fDriverNum; i < CLIENT_NUM; i++) {
JackClientInterface* client = table[i];
JackClientTiming* timing = manager->GetClientTiming(i);
if (client && client->GetClientControl()->fActive && timing->fStatus == Finished) {
last_cycle_end = JACK_MAX(last_cycle_end, timing->fFinishedAt);
}
}
}
// Store the execution time for later averaging
if (last_cycle_end > 0) {
fRollingClientUsecs[fRollingClientUsecsIndex++] = last_cycle_end - fPrevCycleTime;
}
if (fRollingClientUsecsIndex >= JACK_ENGINE_ROLLING_COUNT) {
fRollingClientUsecsIndex = 0;
}
// Each time we have a full set of iterations, recompute the current
// usage from the latest JACK_ENGINE_ROLLING_COUNT client entries.
if (fRollingClientUsecsCnt && (fRollingClientUsecsIndex == 0)) {
jack_time_t avg_usecs = 0;
jack_time_t max_usecs = 0;
for (int i = 0; i < JACK_ENGINE_ROLLING_COUNT; i++) {
avg_usecs += fRollingClientUsecs[i]; // This is really a running total to be averaged later
max_usecs = JACK_MAX(fRollingClientUsecs[i], max_usecs);
}
fMaxUsecs = JACK_MAX(fMaxUsecs, max_usecs);
if (max_usecs < ((fPeriodUsecs * 95) / 100)) {
// Average the values from our JACK_ENGINE_ROLLING_COUNT array
fSpareUsecs = (jack_time_t)(fPeriodUsecs - (avg_usecs / JACK_ENGINE_ROLLING_COUNT));
} else {
// Use the 'worst case' value (or zero if we exceeded 'fPeriodUsecs')
fSpareUsecs = jack_time_t((max_usecs < fPeriodUsecs) ? fPeriodUsecs - max_usecs : 0);
}
fCPULoad = ((1.f - (float(fSpareUsecs) / float(fPeriodUsecs))) * 50.f + (fCPULoad * 0.5f));
}
fRollingClientUsecsCnt++;
}
示例7: CheckAllRolling
// RT
bool JackTransportEngine::CheckAllRolling(JackClientInterface** table)
{
for (int i = GetEngineControl()->fDriverNum; i < CLIENT_NUM; i++) {
JackClientInterface* client = table[i];
if (client && client->GetClientControl()->fTransportState != JackTransportRolling) {
jack_log("CheckAllRolling ref = %ld is not rolling", i);
return false;
}
}
jack_log("CheckAllRolling");
return true;
}
示例8: InternalClientUnload
int JackEngine::InternalClientUnload(int refnum, int* status)
{
JackClientInterface* client = fClientTable[refnum];
if (client) {
int res = client->Close();
delete client;
*status = 0;
return res;
} else {
*status = (JackNoSuchClient | JackFailure);
return -1;
}
}
示例9: EnsureUUID
void JackEngine::EnsureUUID(int uuid)
{
if (uuid > fMaxUUID) {
fMaxUUID = uuid + 1;
}
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client && (client->GetClientControl()->fSessionID == uuid)) {
client->GetClientControl()->fSessionID = GetNewUUID();
}
}
}
示例10: GetUUIDForClientName
int JackEngine::GetUUIDForClientName(const char *client_name, char *uuid_res)
{
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client && (strcmp(client_name, client->GetClientControl()->fName) == 0)) {
snprintf(uuid_res, JACK_UUID_SIZE, "%d", client->GetClientControl()->fSessionID);
return 0;
}
}
// Did not find name.
return -1;
}
示例11: MakeAllLocating
// RT
void JackTransportEngine::MakeAllLocating(JackClientInterface** table)
{
for (int i = GetEngineControl()->fDriverNum; i < CLIENT_NUM; i++) {
JackClientInterface* client = table[i];
if (client) {
JackClientControl* control = client->GetClientControl();
control->fTransportState = JackTransportStopped;
control->fTransportSync = true;
control->fTransportTimebase = true;
jack_log("MakeAllLocating ref = %ld", i);
}
}
}
示例12: MakeAllStartingLocating
// RT
void JackTransportEngine::MakeAllStartingLocating(JackClientInterface** table)
{
for (int i = GetEngineControl()->fDriverNum; i < CLIENT_NUM; i++) {
JackClientInterface* client = table[i];
if (client) {
JackClientControl* control = client->GetClientControl();
// Inactive clients don't have their process function called at all, so they must appear as already "rolling" for the transport....
control->fTransportState = (control->fActive && control->fCallback[kRealTimeCallback]) ? JackTransportStarting : JackTransportRolling;
control->fTransportSync = true;
control->fTransportTimebase = true;
jack_log("MakeAllStartingLocating ref = %ld", i);
}
}
}
示例13: ClientHasSessionCallback
int JackEngine::ClientHasSessionCallback(const char *name)
{
JackClientInterface* client = NULL;
for (int i = 0; i < CLIENT_NUM; i++) {
client = fClientTable[i];
if (client && (strcmp(client->GetClientControl()->fName, name) == 0)) {
break;
}
}
if (client) {
return client->GetClientControl()->fCallback[kSessionCallback];
} else {
return -1;
}
}
示例14: ClientCheckName
bool JackEngine::ClientCheckName(const char* name)
{
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client && (strcmp(client->GetClientControl()->fName, name) == 0)) {
return true;
}
}
for (std::map<int,std::string>::iterator i = fReservationMap.begin(); i != fReservationMap.end(); i++) {
if (i->second == name) {
return true;
}
}
return false;
}
示例15: InternalClientHandle
int JackEngine::InternalClientHandle(const char* client_name, int* status, int* int_ref)
{
// Clear status
*status = 0;
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client && dynamic_cast<JackLoadableInternalClient*>(client) && (strcmp(client->GetClientControl()->fName, client_name) == 0)) {
jack_log("InternalClientHandle found client name = %s ref = %ld", client_name, i);
*int_ref = i;
return 0;
}
}
*status |= (JackNoSuchClient | JackFailure);
return -1;
}