@@ -209,8 +209,9 @@ int JackAudioDriver::Write() | |||||
jack_default_audio_sample_t* buffer = GetOutputBuffer(i); | jack_default_audio_sample_t* buffer = GetOutputBuffer(i); | ||||
int size = sizeof(jack_default_audio_sample_t) * fEngineControl->fBufferSize; | int size = sizeof(jack_default_audio_sample_t) * fEngineControl->fBufferSize; | ||||
// Monitor ports | // Monitor ports | ||||
if (fWithMonitorPorts && fGraphManager->GetConnectionsNum(fMonitorPortList[i]) > 0) | |||||
if (fWithMonitorPorts && fGraphManager->GetConnectionsNum(fMonitorPortList[i]) > 0) { | |||||
memcpy(GetMonitorBuffer(i), buffer, size); | memcpy(GetMonitorBuffer(i), buffer, size); | ||||
} | |||||
} | } | ||||
} | } | ||||
return 0; | return 0; | ||||
@@ -47,16 +47,19 @@ void JackEngineControl::CalcCPULoad(JackClientInterface** table, | |||||
for (int i = fDriverNum; i < CLIENT_NUM; i++) { | for (int i = fDriverNum; i < CLIENT_NUM; i++) { | ||||
JackClientInterface* client = table[i]; | JackClientInterface* client = table[i]; | ||||
JackClientTiming* timing = manager->GetClientTiming(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); | last_cycle_end = JACK_MAX(last_cycle_end, timing->fFinishedAt); | ||||
} | |||||
} | } | ||||
} | } | ||||
// Store the execution time for later averaging | // Store the execution time for later averaging | ||||
if (last_cycle_end > 0) | |||||
if (last_cycle_end > 0) { | |||||
fRollingClientUsecs[fRollingClientUsecsIndex++] = last_cycle_end - fPrevCycleTime; | fRollingClientUsecs[fRollingClientUsecsIndex++] = last_cycle_end - fPrevCycleTime; | ||||
if (fRollingClientUsecsIndex >= JACK_ENGINE_ROLLING_COUNT) | |||||
} | |||||
if (fRollingClientUsecsIndex >= JACK_ENGINE_ROLLING_COUNT) { | |||||
fRollingClientUsecsIndex = 0; | fRollingClientUsecsIndex = 0; | ||||
} | |||||
// Each time we have a full set of iterations, recompute the current | // Each time we have a full set of iterations, recompute the current | ||||
// usage from the latest JACK_ENGINE_ROLLING_COUNT client entries. | // 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; | jack_time_t max_usecs = 0; | ||||
for (int i = 0; i < JACK_ENGINE_ROLLING_COUNT; i++) { | 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); | max_usecs = JACK_MAX(fRollingClientUsecs[i], max_usecs); | ||||
} | } | ||||
@@ -263,7 +263,7 @@ struct JackNetExtMaster : public JackNetMasterInterface { | |||||
int InitMaster(jack_slave_t* result) | int InitMaster(jack_slave_t* result) | ||||
{ | { | ||||
// Check MASTER <==> SLAVE network protocol coherency | // 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); | jack_error("Error : slave is running with a different protocol %s", fParams.fName); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -612,7 +612,7 @@ namespace Jack | |||||
// set the parameters to send | // set the parameters to send | ||||
strcpy(fParams.fPacketType, "params"); | strcpy(fParams.fPacketType, "params"); | ||||
fParams.fProtocolVersion = SLAVE_PROTOCOL; | |||||
fParams.fProtocolVersion = NETWORK_PROTOCOL; | |||||
SetPacketType(&fParams, SLAVE_AVAILABLE); | SetPacketType(&fParams, SLAVE_AVAILABLE); | ||||
// init loop : get a master and start, do it until connection is ok | // init loop : get a master and start, do it until connection is ok | ||||
@@ -647,7 +647,7 @@ namespace Jack | |||||
// set the parameters to send | // set the parameters to send | ||||
strcpy(fParams.fPacketType, "params"); | strcpy(fParams.fPacketType, "params"); | ||||
fParams.fProtocolVersion = SLAVE_PROTOCOL; | |||||
fParams.fProtocolVersion = NETWORK_PROTOCOL; | |||||
SetPacketType(&fParams, SLAVE_AVAILABLE); | SetPacketType(&fParams, SLAVE_AVAILABLE); | ||||
net_status_t status; | net_status_t status; | ||||
@@ -841,8 +841,8 @@ namespace Jack | |||||
jack_log("JackNetMasterManager::InitMaster slave : %s", params.fName); | jack_log("JackNetMasterManager::InitMaster slave : %s", params.fName); | ||||
//check MASTER <<==> SLAVE network protocol coherency | //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; | return NULL; | ||||
} | } | ||||
@@ -38,8 +38,7 @@ using namespace std; | |||||
#endif | #endif | ||||
#endif | #endif | ||||
#define MASTER_PROTOCOL 6 | |||||
#define SLAVE_PROTOCOL 6 | |||||
#define NETWORK_PROTOCOL 6 | |||||
#define NET_SYNCHING 0 | #define NET_SYNCHING 0 | ||||
#define NET_PACKET_ERROR -2 | #define NET_PACKET_ERROR -2 | ||||
@@ -36,7 +36,7 @@ SERVER_EXPORT void InitTime() | |||||
{ | { | ||||
mach_timebase_info_data_t info; | mach_timebase_info_data_t info; | ||||
mach_timebase_info(&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() | SERVER_EXPORT void EndTime() | ||||
@@ -44,7 +44,7 @@ SERVER_EXPORT void EndTime() | |||||
SERVER_EXPORT jack_time_t GetMicroSeconds(void) | 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) | void SetClockSource(jack_timer_type_t source) | ||||