Browse Source

Define NETWORK_PROTOCOL.

tags/v1.9.10
Stephane Letz 12 years ago
parent
commit
5936f2fbeb
7 changed files with 17 additions and 15 deletions
  1. +2
    -1
      common/JackAudioDriver.cpp
  2. +7
    -5
      common/JackEngineControl.cpp
  3. +1
    -1
      common/JackNetAPI.cpp
  4. +2
    -2
      common/JackNetInterface.cpp
  5. +2
    -2
      common/JackNetManager.cpp
  6. +1
    -2
      common/JackNetTool.h
  7. +2
    -2
      macosx/JackMachTime.c

+ 2
- 1
common/JackAudioDriver.cpp View File

@@ -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;


+ 7
- 5
common/JackEngineControl.cpp View File

@@ -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);
} }




+ 1
- 1
common/JackNetAPI.cpp View File

@@ -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;
} }


+ 2
- 2
common/JackNetInterface.cpp View File

@@ -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;


+ 2
- 2
common/JackNetManager.cpp View File

@@ -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;
} }




+ 1
- 2
common/JackNetTool.h View File

@@ -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


+ 2
- 2
macosx/JackMachTime.c View File

@@ -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)


Loading…
Cancel
Save