diff --git a/common/JackNetAdapter.cpp b/common/JackNetAdapter.cpp index 31162c9c..f8c4486d 100644 --- a/common/JackNetAdapter.cpp +++ b/common/JackNetAdapter.cpp @@ -260,7 +260,7 @@ namespace Jack } //transport--------------------------------------------------------------------------- - int JackNetAdapter::DecodeTransportData() + void JackNetAdapter::DecodeTransportData() { //TODO : we need here to get the actual timebase master to eventually release it from its duty (see JackNetDriver) @@ -288,11 +288,9 @@ namespace Jack break; } } - - return 0; } - int JackNetAdapter::EncodeTransportData() + void JackNetAdapter::EncodeTransportData() { //is there a timebase master change ? int refnum = -1; @@ -326,8 +324,6 @@ namespace Jack if ( fReturnTransportData.fNewState ) jack_info ( "Sending transport state '%s'.", GetTransportState ( fReturnTransportData.fState ) ); fLastTransportState = fReturnTransportData.fState; - - return 0; } //read/write operations--------------------------------------------------------------- @@ -338,17 +334,14 @@ namespace Jack if ( SyncRecv() == SOCKET_ERROR ) return 0; - if ( DecodeSyncPacket() < 0 ) - return 0; - + DecodeSyncPacket(); return DataRecv(); } int JackNetAdapter::Write() { - if ( EncodeSyncPacket() < 0 ) - return 0; - + EncodeSyncPacket(); + if ( SyncSend() == SOCKET_ERROR ) return SOCKET_ERROR; diff --git a/common/JackNetAdapter.h b/common/JackNetAdapter.h index 7f120e28..f6b7675b 100644 --- a/common/JackNetAdapter.h +++ b/common/JackNetAdapter.h @@ -48,8 +48,8 @@ namespace Jack JackThread fThread; //transport - int EncodeTransportData(); - int DecodeTransportData(); + void EncodeTransportData(); + void DecodeTransportData(); public: diff --git a/common/JackNetDriver.cpp b/common/JackNetDriver.cpp index 7b17ac90..d34c7db5 100644 --- a/common/JackNetDriver.cpp +++ b/common/JackNetDriver.cpp @@ -381,7 +381,7 @@ namespace Jack } //transport--------------------------------------------------------------------------- - int JackNetDriver::DecodeTransportData() + void JackNetDriver::DecodeTransportData() { //is there a new timebase master on the net master ? // - release timebase master only if it's a non-conditional request @@ -397,9 +397,10 @@ namespace Jack jack_info ( "The NetMaster is now the new timebase master." ); } - //is there a tranport state change to handle ? + //is there a transport state change to handle ? if ( fSendTransportData.fNewState && ( fSendTransportData.fState != fEngineControl->fTransport.GetState() ) ) { + switch ( fSendTransportData.fState ) { case JackTransportStopped : @@ -419,11 +420,9 @@ namespace Jack break; } } - - return 0; } - int JackNetDriver::EncodeTransportData() + void JackNetDriver::EncodeTransportData() { //is there a timebase master change ? int refnum; @@ -457,8 +456,6 @@ namespace Jack if ( fReturnTransportData.fNewState ) jack_info ( "Sending '%s'.", GetTransportState ( fReturnTransportData.fState ) ); fLastTransportState = fReturnTransportData.fState; - - return 0; } //driver processes-------------------------------------------------------------------- @@ -486,9 +483,8 @@ namespace Jack //decode sync //if there is an error, don't return -1, it will skip Write() and the network error probably won't be identified - if ( DecodeSyncPacket() < 0 ) - return 0; - + DecodeSyncPacket(); + #ifdef JACK_MONITOR fNetTimeMon->Add ( ( ( float ) ( GetMicroSeconds() - JackDriver::fBeginDateUst ) / ( float ) fEngineControl->fPeriodUsecs ) * 100.f ); #endif @@ -519,9 +515,8 @@ namespace Jack #endif //sync - if ( EncodeSyncPacket() < 0 ) - return 0; - + EncodeSyncPacket(); + //send sync if ( SyncSend() == SOCKET_ERROR ) return SOCKET_ERROR; diff --git a/common/JackNetDriver.h b/common/JackNetDriver.h index af432084..058489a1 100644 --- a/common/JackNetDriver.h +++ b/common/JackNetDriver.h @@ -57,8 +57,8 @@ namespace Jack int FreePorts(); //transport - int EncodeTransportData(); - int DecodeTransportData(); + void EncodeTransportData(); + void DecodeTransportData(); JackMidiBuffer* GetMidiInputBuffer ( int port_index ); JackMidiBuffer* GetMidiOutputBuffer ( int port_index ); diff --git a/common/JackNetInterface.cpp b/common/JackNetInterface.cpp index 299c4588..979e9849 100644 --- a/common/JackNetInterface.cpp +++ b/common/JackNetInterface.cpp @@ -565,39 +565,33 @@ namespace Jack return rx_bytes; } - int JackNetMasterInterface::EncodeSyncPacket() + void JackNetMasterInterface::EncodeSyncPacket() { //this method contains every step of sync packet informations coding //first of all, reset sync packet memset ( fTxData, 0, fPayloadSize ); //then, first step : transport - if ( fParams.fTransportSync ) - { - if ( EncodeTransportData() < 0 ) - return -1; + if (fParams.fTransportSync) { + EncodeTransportData(); //copy to TxBuffer memcpy ( fTxData, &fSendTransportData, sizeof ( net_transport_data_t ) ); } //then others (freewheel etc.) //... - return 0; } - int JackNetMasterInterface::DecodeSyncPacket() + void JackNetMasterInterface::DecodeSyncPacket() { //this method contains every step of sync packet informations decoding process //first : transport - if ( fParams.fTransportSync ) - { + if (fParams.fTransportSync) { //copy received transport data to transport data structure memcpy ( &fReturnTransportData, fRxData, sizeof ( net_transport_data_t ) ); - if ( DecodeTransportData() < 0 ) - return -1; + DecodeTransportData(); } //then others //... - return 0; } // JackNetSlaveInterface ************************************************************************************************ @@ -955,38 +949,32 @@ namespace Jack } //network sync------------------------------------------------------------------------ - int JackNetSlaveInterface::DecodeSyncPacket() + void JackNetSlaveInterface::DecodeSyncPacket() { //this method contains every step of sync packet informations decoding process //first : transport - if ( fParams.fTransportSync ) - { + if (fParams.fTransportSync) { //copy received transport data to transport data structure memcpy ( &fSendTransportData, fRxData, sizeof ( net_transport_data_t ) ); - if ( DecodeTransportData() < 0 ) - return -1; + DecodeTransportData(); } //then others //... - return 0; } - int JackNetSlaveInterface::EncodeSyncPacket() + void JackNetSlaveInterface::EncodeSyncPacket() { //this method contains every step of sync packet informations coding //first of all, reset sync packet memset ( fTxData, 0, fPayloadSize ); //then first step : transport - if ( fParams.fTransportSync ) - { - if ( EncodeTransportData() < 0 ) - return -1; + if (fParams.fTransportSync) { + EncodeTransportData(); //copy to TxBuffer memcpy ( fTxData, &fReturnTransportData, sizeof ( net_transport_data_t ) ); } //then others //... - return 0; } } diff --git a/common/JackNetInterface.h b/common/JackNetInterface.h index 9d2c95c2..c655a3b0 100644 --- a/common/JackNetInterface.h +++ b/common/JackNetInterface.h @@ -73,12 +73,12 @@ namespace Jack virtual bool Init() = 0; //transport - virtual int EncodeTransportData() = 0; - virtual int DecodeTransportData() = 0; + virtual void EncodeTransportData() = 0; + virtual void DecodeTransportData() = 0; //sync packet - virtual int EncodeSyncPacket() = 0; - virtual int DecodeSyncPacket() = 0; + virtual void EncodeSyncPacket() = 0; + virtual void DecodeSyncPacket() = 0; virtual int SyncRecv() = 0; virtual int SyncSend() = 0; @@ -119,8 +119,8 @@ namespace Jack int DataSend(); //sync packet - int EncodeSyncPacket(); - int DecodeSyncPacket(); + void EncodeSyncPacket(); + void DecodeSyncPacket(); int Send ( size_t size, int flags ); int Recv ( size_t size, int flags ); @@ -163,8 +163,8 @@ namespace Jack int DataSend(); //sync packet - int EncodeSyncPacket(); - int DecodeSyncPacket(); + void EncodeSyncPacket(); + void DecodeSyncPacket(); 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 b935d252..13c61561 100644 --- a/common/JackNetManager.cpp +++ b/common/JackNetManager.cpp @@ -245,7 +245,7 @@ namespace Jack } //transport--------------------------------------------------------------------------- - int JackNetMaster::EncodeTransportData() + void JackNetMaster::EncodeTransportData() { //is there a new timebase master ? //TODO : check if any timebase callback has been called (and if it's conditional or not) and set correct value... @@ -260,11 +260,9 @@ namespace Jack if ( fSendTransportData.fNewState ) jack_info ( "Sending '%s' to '%s'.", GetTransportState ( fSendTransportData.fState ), fParams.fName ); fLastTransportState = fSendTransportData.fState; + } - return 0; - } - - int JackNetMaster::DecodeTransportData() + void JackNetMaster::DecodeTransportData() { //is there timebase master change ? if ( fReturnTransportData.fTimebaseMaster != NO_CHANGE ) @@ -322,7 +320,6 @@ namespace Jack break; } } - return 0; } void JackNetMaster::SetTimebaseCallback ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t* pos, int new_pos, void* arg ) @@ -385,9 +382,8 @@ namespace Jack if (IsSynched()) { // only send if connection is "synched" //encode the first packet - if ( EncodeSyncPacket() < 0 ) - return 0; - + EncodeSyncPacket(); + //send sync if ( SyncSend() == SOCKET_ERROR ) return SOCKET_ERROR; @@ -418,9 +414,8 @@ namespace Jack #endif //decode sync - if ( DecodeSyncPacket() < 0 ) - return 0; - + DecodeSyncPacket(); + //receive data res = DataRecv(); if ( ( res == 0 ) || ( res == SOCKET_ERROR ) ) diff --git a/common/JackNetManager.h b/common/JackNetManager.h index 9d748d34..c50c0e08 100644 --- a/common/JackNetManager.h +++ b/common/JackNetManager.h @@ -68,8 +68,8 @@ namespace Jack void Exit(); //transport - int EncodeTransportData(); - int DecodeTransportData(); + void EncodeTransportData(); + void DecodeTransportData(); int Process(); void TimebaseCallback ( jack_position_t* pos );