diff --git a/common/JackNetAPI.cpp b/common/JackNetAPI.cpp index dc3d2557..72e525f4 100644 --- a/common/JackNetAPI.cpp +++ b/common/JackNetAPI.cpp @@ -372,7 +372,7 @@ struct JackNetExtMaster : public JackNetMasterInterface { if (frames < 0) frames = fParams.fPeriodSize; - int cycle_size; + int read_frames; assert(audio_input == fParams.fReturnAudioChannels); for (int audio_port_index = 0; audio_port_index < audio_input; audio_port_index++) { @@ -403,13 +403,12 @@ struct JackNetExtMaster : public JackNetMasterInterface { default: // decode sync - int cycle_size; - DecodeSyncPacket(cycle_size); + DecodeSyncPacket(read_frames); break; } int res2 = DataRecv(); - UseRingBuffer(audio_input, audio_input_buffer, cycle_size, frames); + UseRingBuffer(audio_input, audio_input_buffer, read_frames, frames); return res2; } catch (JackNetException& e) { @@ -492,7 +491,7 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf void* fSampleRateArg; int fConnectTimeOut; - int fCycleSize; + int fFrames; JackNetExtSlave(const char* ip, int port, @@ -664,8 +663,8 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf strcpy(result->master_name, fParams.fMasterNetName); } - // By default fCycleSize is fPeriodSize - fCycleSize = fParams.fPeriodSize; + // By default fFrames is fPeriodSize + fFrames = fParams.fPeriodSize; AllocPorts(); return 0; @@ -804,7 +803,7 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf default: // decode sync - DecodeSyncPacket(fCycleSize); + DecodeSyncPacket(fFrames); break; } @@ -817,7 +816,7 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf int Write() { - EncodeSyncPacket(fCycleSize); + EncodeSyncPacket(fFrames); if (SyncSend() == SOCKET_ERROR) { return SOCKET_ERROR; @@ -845,7 +844,7 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf return SOCKET_ERROR; } - fProcessCallback(fCycleSize, + fProcessCallback(fFrames, fParams.fSendAudioChannels, fAudioCaptureBuffer, fParams.fSendMidiChannels, diff --git a/common/JackNetAdapter.cpp b/common/JackNetAdapter.cpp index 50b764cd..9cea91ef 100644 --- a/common/JackNetAdapter.cpp +++ b/common/JackNetAdapter.cpp @@ -361,8 +361,8 @@ namespace Jack default: //decode sync - int unused_cycle_size; - DecodeSyncPacket(unused_cycle_size); + int unused_frames; + DecodeSyncPacket(unused_frames); break; } diff --git a/common/JackNetDriver.cpp b/common/JackNetDriver.cpp index 49a2cab7..c9a11a98 100644 --- a/common/JackNetDriver.cpp +++ b/common/JackNetDriver.cpp @@ -575,8 +575,8 @@ namespace Jack default: // decode sync - int unused_cycle_size; - DecodeSyncPacket(unused_cycle_size); + int unused_frames; + DecodeSyncPacket(unused_frames); break; } diff --git a/common/JackNetInterface.cpp b/common/JackNetInterface.cpp index 35278cfe..21bf178e 100644 --- a/common/JackNetInterface.cpp +++ b/common/JackNetInterface.cpp @@ -544,7 +544,7 @@ namespace Jack return rx_bytes; } - void JackNetMasterInterface::EncodeSyncPacket(int cycle_size) + void JackNetMasterInterface::EncodeSyncPacket(int frames) { // This method contains every step of sync packet informations coding // first of all, clear sync packet @@ -565,10 +565,10 @@ namespace Jack // Write active ports list fTxHeader.fActivePorts = (fNetAudioPlaybackBuffer) ? fNetAudioPlaybackBuffer->ActivePortsToNetwork(fTxData) : 0; - fTxHeader.fCycleSize = cycle_size; + fTxHeader.fFrames = frames; } - void JackNetMasterInterface::DecodeSyncPacket(int& cycle_size) + void JackNetMasterInterface::DecodeSyncPacket(int& frames) { // This method contains every step of sync packet informations decoding process @@ -592,7 +592,7 @@ namespace Jack fNetAudioCaptureBuffer->ActivePortsFromNetwork(fRxData, rx_head->fActivePorts); } - cycle_size = rx_head->fCycleSize; + frames = rx_head->fFrames; } // JackNetSlaveInterface ************************************************************************************************ @@ -949,7 +949,7 @@ namespace Jack } // network sync------------------------------------------------------------------------ - void JackNetSlaveInterface::EncodeSyncPacket(int cycle_size) + void JackNetSlaveInterface::EncodeSyncPacket(int frames) { // This method contains every step of sync packet informations coding // first of all, clear sync packet @@ -970,10 +970,10 @@ namespace Jack // Write active ports list fTxHeader.fActivePorts = (fNetAudioCaptureBuffer) ? fNetAudioCaptureBuffer->ActivePortsToNetwork(fTxData) : 0; - fTxHeader.fCycleSize = cycle_size; + fTxHeader.fFrames = frames; } - void JackNetSlaveInterface::DecodeSyncPacket(int& cycle_size) + void JackNetSlaveInterface::DecodeSyncPacket(int& frames) { // This method contains every step of sync packet informations decoding process @@ -997,7 +997,7 @@ namespace Jack fNetAudioPlaybackBuffer->ActivePortsFromNetwork(fRxData, rx_head->fActivePorts); } - cycle_size = rx_head->fCycleSize; + frames = rx_head->fFrames; } } diff --git a/common/JackNetInterface.h b/common/JackNetInterface.h index 1f33e266..8e258098 100644 --- a/common/JackNetInterface.h +++ b/common/JackNetInterface.h @@ -92,8 +92,8 @@ namespace Jack virtual void DecodeTransportData() = 0; // sync packet - virtual void EncodeSyncPacket(int cycle_size = -1) = 0; - virtual void DecodeSyncPacket(int& cycle_size) = 0; + virtual void EncodeSyncPacket(int frames = -1) = 0; + virtual void DecodeSyncPacket(int& frames) = 0; virtual int SyncRecv() = 0; virtual int SyncSend() = 0; @@ -160,8 +160,8 @@ namespace Jack int DataSend(); // sync packet - void EncodeSyncPacket(int cycle_size = -1); - void DecodeSyncPacket(int& cycle_size); + void EncodeSyncPacket(int frames = -1); + void DecodeSyncPacket(int& frames); int Send(size_t size, int flags); int Recv(size_t size, int flags); @@ -217,8 +217,8 @@ namespace Jack int DataSend(); // sync packet - void EncodeSyncPacket(int cycle_size = -1); - void DecodeSyncPacket(int& cycle_size); + void EncodeSyncPacket(int frames = -1); + void DecodeSyncPacket(int& frames); int Recv(size_t size, int flags); int Send(size_t size, int flags); diff --git a/common/JackNetManager.cpp b/common/JackNetManager.cpp index e1a72f2b..fd440e4e 100644 --- a/common/JackNetManager.cpp +++ b/common/JackNetManager.cpp @@ -543,8 +543,8 @@ namespace Jack default: // Decode sync - int unused_cycle_size; - DecodeSyncPacket(unused_cycle_size); + int unused_frames; + DecodeSyncPacket(unused_frames); break; } diff --git a/common/JackNetTool.cpp b/common/JackNetTool.cpp index bfa09176..b695b8b6 100644 --- a/common/JackNetTool.cpp +++ b/common/JackNetTool.cpp @@ -1216,7 +1216,7 @@ namespace Jack dst_header->fActivePorts = htonl(src_header->fActivePorts); dst_header->fCycle = htonl(src_header->fCycle); dst_header->fSubCycle = htonl(src_header->fSubCycle); - dst_header->fCycleSize = htonl(src_header->fCycleSize); + dst_header->fFrames = htonl(src_header->fFrames); dst_header->fIsLastPckt = htonl(src_header->fIsLastPckt); } @@ -1231,7 +1231,7 @@ namespace Jack dst_header->fActivePorts = ntohl(src_header->fActivePorts); dst_header->fCycle = ntohl(src_header->fCycle); dst_header->fSubCycle = ntohl(src_header->fSubCycle); - dst_header->fCycleSize = ntohl(src_header->fCycleSize); + dst_header->fFrames = ntohl(src_header->fFrames); dst_header->fIsLastPckt = ntohl(src_header->fIsLastPckt); } diff --git a/common/JackNetTool.h b/common/JackNetTool.h index 99b720db..4222363e 100644 --- a/common/JackNetTool.h +++ b/common/JackNetTool.h @@ -172,15 +172,15 @@ namespace Jack struct _packet_header { char fPacketType[8]; //packet type ('headr') - uint32_t fDataType; //a for audio, m for midi and s for sync - uint32_t fDataStream; //s for send, r for return + uint32_t fDataType; //'a' for audio, 'm' for midi and 's' for sync + uint32_t fDataStream; //'s' for send, 'r' for return uint32_t fID; //unique ID of the slave uint32_t fNumPacket; //number of data packets of the cycle uint32_t fPacketSize; //packet size in bytes uint32_t fActivePorts; //number of active ports uint32_t fCycle; //process cycle counter uint32_t fSubCycle; //midi/audio subcycle counter - int32_t fCycleSize; //process cycle size in frames + uint32_t fFrames; //process cycle size in frames uint32_t fIsLastPckt; //is it the last packet of a given cycle ('y' or 'n') } POST_PACKED_STRUCTURE;