git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3312 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.9.2
| @@ -330,41 +330,6 @@ namespace Jack | |||
| return 0; | |||
| } | |||
| //network sync------------------------------------------------------------------------ | |||
| int JackNetAdapter::DecodeSyncPacket() | |||
| { | |||
| //this method contains every step of sync packet informations decoding process | |||
| //first : transport | |||
| if ( fParams.fTransportSync ) | |||
| { | |||
| //copy received transport data to transport data structure | |||
| memcpy ( &fSendTransportData, fRxData, sizeof ( net_transport_data_t ) ); | |||
| if ( DecodeTransportData() < 0 ) | |||
| return -1; | |||
| } | |||
| //then others | |||
| //... | |||
| return 0; | |||
| } | |||
| int JackNetAdapter::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; | |||
| //copy to TxBuffer | |||
| memcpy ( fTxData, &fReturnTransportData, sizeof ( net_transport_data_t ) ); | |||
| } | |||
| //then others | |||
| //... | |||
| return 0; | |||
| } | |||
| //read/write operations--------------------------------------------------------------- | |||
| int JackNetAdapter::Read() | |||
| { | |||
| @@ -41,9 +41,7 @@ namespace Jack | |||
| //transport data | |||
| int fLastTransportState; | |||
| int fLastTimebaseMaster; | |||
| net_transport_data_t fSendTransportData; | |||
| net_transport_data_t fReturnTransportData; | |||
| //sample buffers | |||
| sample_t** fSoftCaptureBuffer; | |||
| sample_t** fSoftPlaybackBuffer; | |||
| @@ -55,10 +53,6 @@ namespace Jack | |||
| int EncodeTransportData(); | |||
| int DecodeTransportData(); | |||
| //sync packet | |||
| int EncodeSyncPacket(); | |||
| int DecodeSyncPacket(); | |||
| public: | |||
| JackNetAdapter ( jack_client_t* jack_client, jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params ); | |||
| @@ -449,41 +449,6 @@ namespace Jack | |||
| return 0; | |||
| } | |||
| //network sync------------------------------------------------------------------------ | |||
| int JackNetDriver::DecodeSyncPacket() | |||
| { | |||
| //this method contains every step of sync packet informations decoding process | |||
| //first : transport | |||
| if ( fParams.fTransportSync ) | |||
| { | |||
| //copy received transport data to transport data structure | |||
| memcpy ( &fSendTransportData, fRxData, sizeof ( net_transport_data_t ) ); | |||
| if ( DecodeTransportData() < 0 ) | |||
| return -1; | |||
| } | |||
| //then others | |||
| //... | |||
| return 0; | |||
| } | |||
| int JackNetDriver::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; | |||
| //copy to TxBuffer | |||
| memcpy ( fTxData, &fReturnTransportData, sizeof ( net_transport_data_t ) ); | |||
| } | |||
| //then others | |||
| //... | |||
| return 0; | |||
| } | |||
| //driver processes-------------------------------------------------------------------- | |||
| int JackNetDriver::Read() | |||
| { | |||
| @@ -44,9 +44,7 @@ namespace Jack | |||
| //transport | |||
| int fLastTransportState; | |||
| int fLastTimebaseMaster; | |||
| net_transport_data_t fSendTransportData; | |||
| net_transport_data_t fReturnTransportData; | |||
| //monitoring | |||
| #ifdef JACK_MONITOR | |||
| JackGnuPlotMonitor<float>* fNetTimeMon; | |||
| @@ -61,10 +59,6 @@ namespace Jack | |||
| int EncodeTransportData(); | |||
| int DecodeTransportData(); | |||
| //sync packet | |||
| int EncodeSyncPacket(); | |||
| int DecodeSyncPacket(); | |||
| JackMidiBuffer* GetMidiInputBuffer ( int port_index ); | |||
| JackMidiBuffer* GetMidiOutputBuffer ( int port_index ); | |||
| @@ -871,4 +871,40 @@ namespace Jack | |||
| } | |||
| return 0; | |||
| } | |||
| //network sync------------------------------------------------------------------------ | |||
| int JackNetSlaveInterface::DecodeSyncPacket() | |||
| { | |||
| //this method contains every step of sync packet informations decoding process | |||
| //first : transport | |||
| if ( fParams.fTransportSync ) | |||
| { | |||
| //copy received transport data to transport data structure | |||
| memcpy ( &fSendTransportData, fRxData, sizeof ( net_transport_data_t ) ); | |||
| if ( DecodeTransportData() < 0 ) | |||
| return -1; | |||
| } | |||
| //then others | |||
| //... | |||
| return 0; | |||
| } | |||
| int 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; | |||
| //copy to TxBuffer | |||
| memcpy ( fTxData, &fReturnTransportData, sizeof ( net_transport_data_t ) ); | |||
| } | |||
| //then others | |||
| //... | |||
| return 0; | |||
| } | |||
| } | |||
| @@ -133,16 +133,28 @@ namespace Jack | |||
| class SERVER_EXPORT JackNetSlaveInterface : public JackNetInterface | |||
| { | |||
| protected: | |||
| static uint fSlaveCounter; | |||
| net_transport_data_t fSendTransportData; | |||
| net_transport_data_t fReturnTransportData; | |||
| bool Init(); | |||
| net_status_t GetNetMaster(); | |||
| net_status_t SendStartToMaster(); | |||
| void SetParams(); | |||
| int SyncRecv(); | |||
| int SyncSend(); | |||
| int DataRecv(); | |||
| int DataSend(); | |||
| //sync packet | |||
| int EncodeSyncPacket(); | |||
| int DecodeSyncPacket(); | |||
| int Recv ( size_t size, int flags ); | |||
| int Send ( size_t size, int flags ); | |||