Define NETWORK_PROTOCOL.

This commit is contained in:
Stephane Letz 2013-05-15 19:37:16 +02:00
parent 12b20854be
commit 5936f2fbeb
7 changed files with 17 additions and 15 deletions

View File

@ -209,8 +209,9 @@ int JackAudioDriver::Write()
jack_default_audio_sample_t* buffer = GetOutputBuffer(i);
int size = sizeof(jack_default_audio_sample_t) * fEngineControl->fBufferSize;
// Monitor ports
if (fWithMonitorPorts && fGraphManager->GetConnectionsNum(fMonitorPortList[i]) > 0)
if (fWithMonitorPorts && fGraphManager->GetConnectionsNum(fMonitorPortList[i]) > 0) {
memcpy(GetMonitorBuffer(i), buffer, size);
}
}
}
return 0;

View File

@ -47,16 +47,19 @@ void JackEngineControl::CalcCPULoad(JackClientInterface** table,
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)
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)
if (last_cycle_end > 0) {
fRollingClientUsecs[fRollingClientUsecsIndex++] = last_cycle_end - fPrevCycleTime;
if (fRollingClientUsecsIndex >= JACK_ENGINE_ROLLING_COUNT)
}
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.
@ -65,8 +68,7 @@ void JackEngineControl::CalcCPULoad(JackClientInterface** table,
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
avg_usecs += fRollingClientUsecs[i]; // This is really a running total to be averaged later
max_usecs = JACK_MAX(fRollingClientUsecs[i], max_usecs);
}

View File

@ -263,7 +263,7 @@ struct JackNetExtMaster : public JackNetMasterInterface {
int InitMaster(jack_slave_t* result)
{
// Check MASTER <==> SLAVE network protocol coherency
if (fParams.fProtocolVersion != MASTER_PROTOCOL) {
if (fParams.fProtocolVersion != NETWORK_PROTOCOL) {
jack_error("Error : slave is running with a different protocol %s", fParams.fName);
return -1;
}

View File

@ -612,7 +612,7 @@ namespace Jack
// set the parameters to send
strcpy(fParams.fPacketType, "params");
fParams.fProtocolVersion = SLAVE_PROTOCOL;
fParams.fProtocolVersion = NETWORK_PROTOCOL;
SetPacketType(&fParams, SLAVE_AVAILABLE);
// init loop : get a master and start, do it until connection is ok
@ -647,7 +647,7 @@ namespace Jack
// set the parameters to send
strcpy(fParams.fPacketType, "params");
fParams.fProtocolVersion = SLAVE_PROTOCOL;
fParams.fProtocolVersion = NETWORK_PROTOCOL;
SetPacketType(&fParams, SLAVE_AVAILABLE);
net_status_t status;

View File

@ -841,8 +841,8 @@ namespace Jack
jack_log("JackNetMasterManager::InitMaster slave : %s", params.fName);
//check MASTER <<==> SLAVE network protocol coherency
if (params.fProtocolVersion != MASTER_PROTOCOL) {
jack_error("Error : slave %s is running with a different protocol %d != %d", params.fName, params.fProtocolVersion, MASTER_PROTOCOL);
if (params.fProtocolVersion != NETWORK_PROTOCOL) {
jack_error("Error : slave %s is running with a different protocol %d != %d", params.fName, params.fProtocolVersion, NETWORK_PROTOCOL);
return NULL;
}

View File

@ -38,8 +38,7 @@ using namespace std;
#endif
#endif
#define MASTER_PROTOCOL 6
#define SLAVE_PROTOCOL 6
#define NETWORK_PROTOCOL 6
#define NET_SYNCHING 0
#define NET_PACKET_ERROR -2

View File

@ -36,7 +36,7 @@ SERVER_EXPORT void InitTime()
{
mach_timebase_info_data_t info;
mach_timebase_info(&info);
__jack_time_ratio = ((float)info.numer / info.denom) / 1000;
__jack_time_ratio = ((double)info.numer / (double)info.denom) / 1000;
}
SERVER_EXPORT void EndTime()
@ -44,7 +44,7 @@ SERVER_EXPORT void EndTime()
SERVER_EXPORT jack_time_t GetMicroSeconds(void)
{
return (jack_time_t) (mach_absolute_time () * __jack_time_ratio);
return (jack_time_t) (mach_absolute_time() * __jack_time_ratio);
}
void SetClockSource(jack_timer_type_t source)