Browse Source

NetJack : replace all 'size_t' by 'unsigned int'

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2503 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
moret 17 years ago
parent
commit
75320c73bb
6 changed files with 66 additions and 66 deletions
  1. +7
    -7
      common/JackNetDriver.cpp
  2. +5
    -5
      common/JackNetDriver.h
  3. +8
    -8
      common/JackNetManager.cpp
  4. +7
    -7
      common/JackNetManager.h
  5. +14
    -14
      common/JackNetTool.cpp
  6. +25
    -25
      common/JackNetTool.h

+ 7
- 7
common/JackNetDriver.cpp View File

@@ -35,7 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
namespace Jack namespace Jack
{ {
JackNetDriver::JackNetDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table, JackNetDriver::JackNetDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
const char* ip, size_t port, int midi_input_ports, int midi_output_ports, const char* net_name )
const char* ip, unsigned int port, int midi_input_ports, int midi_output_ports, const char* net_name )
: JackAudioDriver ( name, alias, engine, table ) : JackAudioDriver ( name, alias, engine, table )
{ {
fMulticastIP = new char[strlen ( ip ) + 1]; fMulticastIP = new char[strlen ( ip ) + 1];
@@ -411,7 +411,7 @@ namespace Jack
return static_cast<JackMidiBuffer*> ( fGraphManager->GetBuffer ( fMidiPlaybackPortList[port_index], fEngineControl->fBufferSize ) ); return static_cast<JackMidiBuffer*> ( fGraphManager->GetBuffer ( fMidiPlaybackPortList[port_index], fEngineControl->fBufferSize ) );
} }


int JackNetDriver::Recv ( size_t size, int flags )
int JackNetDriver::Recv ( unsigned int size, int flags )
{ {
int rx_bytes; int rx_bytes;
if ( ( rx_bytes = recv ( fSockfd, fRxBuffer, size, flags ) ) < 0 ) if ( ( rx_bytes = recv ( fSockfd, fRxBuffer, size, flags ) ) < 0 )
@@ -435,7 +435,7 @@ namespace Jack
return rx_bytes; return rx_bytes;
} }


int JackNetDriver::Send ( size_t size, int flags )
int JackNetDriver::Send ( unsigned int size, int flags )
{ {
int tx_bytes; int tx_bytes;
if ( ( tx_bytes = send ( fSockfd, fTxBuffer, size, flags ) ) < 0 ) if ( ( tx_bytes = send ( fSockfd, fTxBuffer, size, flags ) ) < 0 )
@@ -456,7 +456,7 @@ namespace Jack
int JackNetDriver::Read() int JackNetDriver::Read()
{ {
int rx_bytes; int rx_bytes;
size_t recvd_midi_pckt = 0;
unsigned int recvd_midi_pckt = 0;
packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer ); packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer );
fRxHeader.fIsLastPckt = 'n'; fRxHeader.fIsLastPckt = 'n';


@@ -536,7 +536,7 @@ namespace Jack
fTxHeader.fDataType = 'm'; fTxHeader.fDataType = 'm';
fTxHeader.fMidiDataSize = fNetMidiPlaybackBuffer->RenderFromJackPorts(); fTxHeader.fMidiDataSize = fNetMidiPlaybackBuffer->RenderFromJackPorts();
fTxHeader.fNMidiPckt = GetNMidiPckt ( &fParams, fTxHeader.fMidiDataSize ); fTxHeader.fNMidiPckt = GetNMidiPckt ( &fParams, fTxHeader.fMidiDataSize );
for ( size_t subproc = 0; subproc < fTxHeader.fNMidiPckt; subproc++ )
for ( unsigned int subproc = 0; subproc < fTxHeader.fNMidiPckt; subproc++ )
{ {
fTxHeader.fSubCycle = subproc; fTxHeader.fSubCycle = subproc;
if ( ( subproc == ( fTxHeader.fNMidiPckt - 1 ) ) && !fParams.fReturnAudioChannels ) if ( ( subproc == ( fTxHeader.fNMidiPckt - 1 ) ) && !fParams.fReturnAudioChannels )
@@ -551,7 +551,7 @@ namespace Jack
if ( fParams.fReturnAudioChannels ) if ( fParams.fReturnAudioChannels )
{ {
fTxHeader.fDataType = 'a'; fTxHeader.fDataType = 'a';
for ( size_t subproc = 0; subproc < fNSubProcess; subproc++ )
for ( unsigned int subproc = 0; subproc < fNSubProcess; subproc++ )
{ {
fTxHeader.fSubCycle = subproc; fTxHeader.fSubCycle = subproc;
if ( subproc == ( fNSubProcess - 1 ) ) if ( subproc == ( fNSubProcess - 1 ) )
@@ -577,7 +577,7 @@ namespace Jack
desc->nparams = 7; desc->nparams = 7;
desc->params = ( jack_driver_param_desc_t* ) calloc ( desc->nparams, sizeof ( jack_driver_param_desc_t ) ); desc->params = ( jack_driver_param_desc_t* ) calloc ( desc->nparams, sizeof ( jack_driver_param_desc_t ) );


size_t i = 0;
unsigned int i = 0;
strcpy ( desc->params[i].name, "multicast_ip" ); strcpy ( desc->params[i].name, "multicast_ip" );
desc->params[i].character = 'a'; desc->params[i].character = 'a';
desc->params[i].type = JackDriverParamString; desc->params[i].type = JackDriverParamString;


+ 5
- 5
common/JackNetDriver.h View File

@@ -32,10 +32,10 @@ namespace Jack
private: private:
session_params_t fParams; session_params_t fParams;
char* fMulticastIP; char* fMulticastIP;
size_t fPort;
unsigned int fPort;
int fSockfd; int fSockfd;
struct sockaddr_in fMasterAddr; struct sockaddr_in fMasterAddr;
size_t fNSubProcess;
unsigned int fNSubProcess;


jack_port_id_t* fMidiCapturePortList; jack_port_id_t* fMidiCapturePortList;
jack_port_id_t* fMidiPlaybackPortList; jack_port_id_t* fMidiPlaybackPortList;
@@ -67,12 +67,12 @@ namespace Jack
JackMidiBuffer* GetMidiInputBuffer ( int port_index ); JackMidiBuffer* GetMidiInputBuffer ( int port_index );
JackMidiBuffer* GetMidiOutputBuffer ( int port_index ); JackMidiBuffer* GetMidiOutputBuffer ( int port_index );


int Recv ( size_t size, int flags );
int Send ( size_t size, int flags );
int Recv ( unsigned int size, int flags );
int Send ( unsigned int size, int flags );
public: public:
JackNetDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table, JackNetDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
const char* ip, size_t port, int midi_input_ports, int midi_output_ports, const char* master_name );
const char* ip, unsigned int port, int midi_input_ports, int midi_output_ports, const char* master_name );
~JackNetDriver(); ~JackNetDriver();


int Open ( jack_nframes_t frames_per_cycle, jack_nframes_t rate, bool capturing, bool playing, int Open ( jack_nframes_t frames_per_cycle, jack_nframes_t rate, bool capturing, bool playing,


+ 8
- 8
common/JackNetManager.cpp View File

@@ -130,7 +130,7 @@ namespace Jack
struct timeval timeout; struct timeval timeout;
timeout.tv_sec = 1; timeout.tv_sec = 1;
timeout.tv_usec = 0; timeout.tv_usec = 0;
size_t attempt = 0;
unsigned int attempt = 0;
int rx_bytes = 0; int rx_bytes = 0;


//socket //socket
@@ -273,7 +273,7 @@ namespace Jack
close ( mcast_sockfd ); close ( mcast_sockfd );
} }


int JackNetMaster::Send ( char* buffer, size_t size, int flags )
int JackNetMaster::Send ( char* buffer, unsigned int size, int flags )
{ {
int tx_bytes; int tx_bytes;
if ( ( tx_bytes = send ( fSockfd, buffer, size, flags ) ) < 0 ) if ( ( tx_bytes = send ( fSockfd, buffer, size, flags ) ) < 0 )
@@ -292,7 +292,7 @@ namespace Jack
return tx_bytes; return tx_bytes;
} }


int JackNetMaster::Recv ( size_t size, int flags )
int JackNetMaster::Recv ( unsigned int size, int flags )
{ {
int rx_bytes; int rx_bytes;
if ( ( rx_bytes = recv ( fSockfd, fRxBuffer, size, flags ) ) < 0 ) if ( ( rx_bytes = recv ( fSockfd, fRxBuffer, size, flags ) ) < 0 )
@@ -333,7 +333,7 @@ namespace Jack
return 0; return 0;


int tx_bytes, rx_bytes, copy_size; int tx_bytes, rx_bytes, copy_size;
size_t midi_recvd_pckt = 0;
unsigned int midi_recvd_pckt = 0;
fTxHeader.fCycle++; fTxHeader.fCycle++;
fTxHeader.fSubCycle = 0; fTxHeader.fSubCycle = 0;
fTxHeader.fIsLastPckt = 'n'; fTxHeader.fIsLastPckt = 'n';
@@ -368,7 +368,7 @@ namespace Jack
fTxHeader.fDataType = 'm'; fTxHeader.fDataType = 'm';
fTxHeader.fMidiDataSize = fNetMidiCaptureBuffer->RenderFromJackPorts(); fTxHeader.fMidiDataSize = fNetMidiCaptureBuffer->RenderFromJackPorts();
fTxHeader.fNMidiPckt = GetNMidiPckt ( &fParams, fTxHeader.fMidiDataSize ); fTxHeader.fNMidiPckt = GetNMidiPckt ( &fParams, fTxHeader.fMidiDataSize );
for ( size_t subproc = 0; subproc < fTxHeader.fNMidiPckt; subproc++ )
for ( unsigned int subproc = 0; subproc < fTxHeader.fNMidiPckt; subproc++ )
{ {
fTxHeader.fSubCycle = subproc; fTxHeader.fSubCycle = subproc;
if ( ( subproc == ( fTxHeader.fNMidiPckt - 1 ) ) && !fParams.fSendAudioChannels ) if ( ( subproc == ( fTxHeader.fNMidiPckt - 1 ) ) && !fParams.fSendAudioChannels )
@@ -385,7 +385,7 @@ namespace Jack
if ( fParams.fSendAudioChannels ) if ( fParams.fSendAudioChannels )
{ {
fTxHeader.fDataType = 'a'; fTxHeader.fDataType = 'a';
for ( size_t subproc = 0; subproc < fNSubProcess; subproc++ )
for ( unsigned int subproc = 0; subproc < fNSubProcess; subproc++ )
{ {
fTxHeader.fSubCycle = subproc; fTxHeader.fSubCycle = subproc;
if ( subproc == ( fNSubProcess - 1 ) ) if ( subproc == ( fNSubProcess - 1 ) )
@@ -479,7 +479,7 @@ namespace Jack
struct timeval timeout; struct timeval timeout;
timeout.tv_sec = 2; timeout.tv_sec = 2;
timeout.tv_usec = 0; timeout.tv_usec = 0;
size_t attempt = 0;
unsigned int attempt = 0;


//network //network
int mcast_sockfd; int mcast_sockfd;
@@ -617,7 +617,7 @@ namespace Jack
sprintf ( params.fName, "%s-%u", params.fName, params.fID ); sprintf ( params.fName, "%s-%u", params.fName, params.fID );
} }


master_list_it_t JackNetMasterManager::FindMaster ( size_t id )
master_list_it_t JackNetMasterManager::FindMaster ( unsigned int id )
{ {
jack_log ( "JackNetMasterManager::FindMaster, ID %u.", id ); jack_log ( "JackNetMasterManager::FindMaster, ID %u.", id );
master_list_it_t it; master_list_it_t it;


+ 7
- 7
common/JackNetManager.h View File

@@ -43,8 +43,8 @@ namespace Jack
struct sockaddr_in fAddr; struct sockaddr_in fAddr;
struct sockaddr_in fMcastAddr; struct sockaddr_in fMcastAddr;
int fSockfd; int fSockfd;
size_t fNSubProcess;
size_t fNetJumpCnt;
unsigned int fNSubProcess;
unsigned int fNetJumpCnt;
bool fRunning; bool fRunning;


jack_client_t* fJackClient; jack_client_t* fJackClient;
@@ -75,8 +75,8 @@ namespace Jack
void FreePorts(); void FreePorts();
void Exit(); void Exit();


int Send ( char* buffer, size_t size, int flags );
int Recv ( size_t size, int flags );
int Send ( char* buffer, unsigned int size, int flags );
int Recv ( unsigned int size, int flags );
int Process(); int Process();
public: public:
JackNetMaster ( JackNetMasterManager* manager, session_params_t& params, struct sockaddr_in& address, struct sockaddr_in& mcast_addr ); JackNetMaster ( JackNetMasterManager* manager, session_params_t& params, struct sockaddr_in& address, struct sockaddr_in& mcast_addr );
@@ -97,13 +97,13 @@ namespace Jack
const char* fMCastIP; const char* fMCastIP;
pthread_t fManagerThread; pthread_t fManagerThread;
master_list_t fMasterList; master_list_t fMasterList;
size_t fGlobalID;
unsigned int fGlobalID;
bool fRunning; bool fRunning;
size_t fPort;
unsigned int fPort;


void Run(); void Run();
JackNetMaster* MasterInit ( session_params_t& params, struct sockaddr_in& address, struct sockaddr_in& mcast_addr ); JackNetMaster* MasterInit ( session_params_t& params, struct sockaddr_in& address, struct sockaddr_in& mcast_addr );
master_list_it_t FindMaster ( size_t client_id );
master_list_it_t FindMaster ( unsigned int client_id );
void KillMaster ( session_params_t* params ); void KillMaster ( session_params_t* params );
void SetSlaveName ( session_params_t& params ); void SetSlaveName ( session_params_t& params );
int Process(); int Process();


+ 14
- 14
common/JackNetTool.cpp View File

@@ -8,7 +8,7 @@ namespace Jack
{ {
// NetMidiBuffer********************************************************************************** // NetMidiBuffer**********************************************************************************


NetMidiBuffer::NetMidiBuffer ( session_params_t* params, size_t nports, char* net_buffer )
NetMidiBuffer::NetMidiBuffer ( session_params_t* params, unsigned int nports, char* net_buffer )
{ {
fNPorts = nports; fNPorts = nports;
fMaxBufsize = fNPorts * sizeof ( sample_t ) * params->fPeriodSize ; fMaxBufsize = fNPorts * sizeof ( sample_t ) * params->fPeriodSize ;
@@ -26,7 +26,7 @@ namespace Jack
delete[] fPortBuffer; delete[] fPortBuffer;
} }


size_t NetMidiBuffer::GetSize()
unsigned int NetMidiBuffer::GetSize()
{ {
return fMaxBufsize; return fMaxBufsize;
} }
@@ -35,7 +35,7 @@ namespace Jack
{ {
for ( int port_index = 0; port_index < fNPorts; port_index++ ) for ( int port_index = 0; port_index < fNPorts; port_index++ )
{ {
for ( size_t event = 0; event < fPortBuffer[port_index]->event_count; event++ )
for ( unsigned int event = 0; event < fPortBuffer[port_index]->event_count; event++ )
if ( fPortBuffer[port_index]->IsValid() ) if ( fPortBuffer[port_index]->IsValid() )
jack_info ( "port %d : midi event %u/%u -> time : %u, size : %u", jack_info ( "port %d : midi event %u/%u -> time : %u, size : %u",
port_index + 1, event + 1, fPortBuffer[port_index]->event_count, port_index + 1, event + 1, fPortBuffer[port_index]->event_count,
@@ -75,13 +75,13 @@ namespace Jack
return pos; return pos;
} }


int NetMidiBuffer::RenderFromNetwork ( size_t subcycle, size_t copy_size )
int NetMidiBuffer::RenderFromNetwork ( unsigned int subcycle, unsigned int copy_size )
{ {
memcpy ( fBuffer + subcycle * fMaxPcktSize, fNetBuffer, copy_size ); memcpy ( fBuffer + subcycle * fMaxPcktSize, fNetBuffer, copy_size );
return copy_size; return copy_size;
} }


int NetMidiBuffer::RenderToNetwork ( size_t subcycle, size_t total_size )
int NetMidiBuffer::RenderToNetwork ( unsigned int subcycle, unsigned int total_size )
{ {
int size = total_size - subcycle * fMaxPcktSize; int size = total_size - subcycle * fMaxPcktSize;
int copy_size = ( size <= fMaxPcktSize ) ? size : fMaxPcktSize; int copy_size = ( size <= fMaxPcktSize ) ? size : fMaxPcktSize;
@@ -91,7 +91,7 @@ namespace Jack


// net audio buffer ********************************************************************************* // net audio buffer *********************************************************************************


NetAudioBuffer::NetAudioBuffer ( session_params_t* params, size_t nports, char* net_buffer )
NetAudioBuffer::NetAudioBuffer ( session_params_t* params, unsigned int nports, char* net_buffer )
{ {
fNPorts = nports; fNPorts = nports;
fPeriodSize = params->fPeriodSize; fPeriodSize = params->fPeriodSize;
@@ -108,18 +108,18 @@ namespace Jack
delete[] fPortBuffer; delete[] fPortBuffer;
} }


size_t NetAudioBuffer::GetSize()
unsigned int NetAudioBuffer::GetSize()
{ {
return fNPorts * fSubPeriodBytesSize; return fNPorts * fSubPeriodBytesSize;
} }


void NetAudioBuffer::RenderFromJackPorts ( size_t subcycle )
void NetAudioBuffer::RenderFromJackPorts ( unsigned int subcycle )
{ {
for ( int port_index = 0; port_index < fNPorts; port_index++ ) for ( int port_index = 0; port_index < fNPorts; port_index++ )
memcpy ( fNetBuffer + port_index * fSubPeriodBytesSize, fPortBuffer[port_index] + subcycle * fSubPeriodSize, fSubPeriodBytesSize ); memcpy ( fNetBuffer + port_index * fSubPeriodBytesSize, fPortBuffer[port_index] + subcycle * fSubPeriodSize, fSubPeriodBytesSize );
} }


void NetAudioBuffer::RenderToJackPorts ( size_t subcycle )
void NetAudioBuffer::RenderToJackPorts ( unsigned int subcycle )
{ {
for ( int port_index = 0; port_index < fNPorts; port_index++ ) for ( int port_index = 0; port_index < fNPorts; port_index++ )
memcpy ( fPortBuffer[port_index] + subcycle * fSubPeriodSize, fNetBuffer + port_index * fSubPeriodBytesSize, fSubPeriodBytesSize ); memcpy ( fPortBuffer[port_index] + subcycle * fSubPeriodSize, fNetBuffer + port_index * fSubPeriodBytesSize, fSubPeriodBytesSize );
@@ -257,24 +257,24 @@ namespace Jack


// Utility ******************************************************************************************************* // Utility *******************************************************************************************************


EXPORT size_t SetFramesPerPacket ( session_params_t* params )
EXPORT unsigned int SetFramesPerPacket ( session_params_t* params )
{ {
if ( !params->fSendAudioChannels && !params->fReturnAudioChannels ) if ( !params->fSendAudioChannels && !params->fReturnAudioChannels )
return ( params->fFramesPerPacket = params->fPeriodSize ); return ( params->fFramesPerPacket = params->fPeriodSize );
size_t period = ( int ) powf ( 2.f, ( int ) log2 ( ( params->fMtu - sizeof ( packet_header_t ) )
unsigned int period = ( int ) powf ( 2.f, ( int ) log2 ( ( params->fMtu - sizeof ( packet_header_t ) )
/ ( max ( params->fReturnAudioChannels, params->fSendAudioChannels ) * sizeof ( sample_t ) ) ) ); / ( max ( params->fReturnAudioChannels, params->fSendAudioChannels ) * sizeof ( sample_t ) ) ) );
( period > params->fPeriodSize ) ? params->fFramesPerPacket = params->fPeriodSize : params->fFramesPerPacket = period; ( period > params->fPeriodSize ) ? params->fFramesPerPacket = params->fPeriodSize : params->fFramesPerPacket = period;
return params->fFramesPerPacket; return params->fFramesPerPacket;
} }


EXPORT size_t GetNMidiPckt ( session_params_t* params, size_t data_size )
EXPORT unsigned int GetNMidiPckt ( session_params_t* params, unsigned int data_size )
{ {
//even if there is no midi data, jack need an empty buffer to know there is no event to read //even if there is no midi data, jack need an empty buffer to know there is no event to read
//99% of the cases : all data in one packet //99% of the cases : all data in one packet
if ( data_size <= ( params->fMtu - sizeof ( packet_header_t ) ) ) if ( data_size <= ( params->fMtu - sizeof ( packet_header_t ) ) )
return 1; return 1;
//else, get the number of needed packets (simply slice the biiig buffer) //else, get the number of needed packets (simply slice the biiig buffer)
size_t npckt = data_size / ( params->fMtu - sizeof ( packet_header_t ) );
unsigned int npckt = data_size / ( params->fMtu - sizeof ( packet_header_t ) );
if ( data_size % ( params->fMtu - sizeof ( packet_header_t ) ) ) if ( data_size % ( params->fMtu - sizeof ( packet_header_t ) ) )
return ++npckt; return ++npckt;
return npckt; return npckt;
@@ -295,7 +295,7 @@ namespace Jack


// Packet ******************************************************************************************************* // Packet *******************************************************************************************************


EXPORT bool IsNextPacket ( packet_header_t* previous, packet_header_t* next, size_t subcycles )
EXPORT bool IsNextPacket ( packet_header_t* previous, packet_header_t* next, unsigned int subcycles )
{ {
//ignore first cycle //ignore first cycle
if ( previous->fCycle <= 1 ) if ( previous->fCycle <= 1 )


+ 25
- 25
common/JackNetTool.h View File

@@ -38,16 +38,16 @@ namespace Jack
int fPacketID; //indicates the packet type int fPacketID; //indicates the packet type
char fMasterNetName[256]; //master hostname (network) char fMasterNetName[256]; //master hostname (network)
char fSlaveNetName[256]; //slave hostname (network) char fSlaveNetName[256]; //slave hostname (network)
size_t fMtu; //connection mtu
size_t fID; //slave's ID
unsigned int fMtu; //connection mtu
unsigned int fID; //slave's ID
int fSendAudioChannels; //number of master->slave channels int fSendAudioChannels; //number of master->slave channels
int fReturnAudioChannels; //number of slave->master channels int fReturnAudioChannels; //number of slave->master channels
int fSendMidiChannels; //number of master->slave midi channels int fSendMidiChannels; //number of master->slave midi channels
int fReturnMidiChannels; //number of slave->master midi channels int fReturnMidiChannels; //number of slave->master midi channels
size_t fSampleRate; //session sample rate
size_t fPeriodSize; //period size
size_t fFramesPerPacket; //complete frames per packet
size_t fBitdepth; //samples bitdepth (unused)
unsigned int fSampleRate; //session sample rate
unsigned int fPeriodSize; //period size
unsigned int fFramesPerPacket; //complete frames per packet
unsigned int fBitdepth; //samples bitdepth (unused)
char fName[JACK_CLIENT_NAME_SIZE]; //slave's name char fName[JACK_CLIENT_NAME_SIZE]; //slave's name
}; };


@@ -90,12 +90,12 @@ namespace Jack
char fPacketType[7]; //packet type ( 'headr' ) char fPacketType[7]; //packet type ( 'headr' )
char fDataType; //a for audio, m for midi char fDataType; //a for audio, m for midi
char fDataStream; //s for send, r for return char fDataStream; //s for send, r for return
size_t fID; //to identify the slave
size_t fBitdepth; //bitdepth of the data samples
size_t fMidiDataSize; //size of midi data (if packet is 'midi typed') in bytes
size_t fNMidiPckt; //number of midi packets of the cycle
size_t fCycle; //process cycle counter
size_t fSubCycle; //midi/audio subcycle counter
unsigned int fID; //to identify the slave
unsigned int fBitdepth; //bitdepth of the data samples
unsigned int fMidiDataSize; //size of midi data (if packet is 'midi typed') in bytes
unsigned int fNMidiPckt; //number of midi packets of the cycle
unsigned int fCycle; //process cycle counter
unsigned int fSubCycle; //midi/audio subcycle counter
char fIsLastPckt; //is it the last packet of a given cycle ('y' or 'n') char fIsLastPckt; //is it the last packet of a given cycle ('y' or 'n')
char fFree[13]; //unused char fFree[13]; //unused
}; };
@@ -106,27 +106,27 @@ namespace Jack
{ {
private: private:
int fNPorts; int fNPorts;
size_t fMaxBufsize;
unsigned int fMaxBufsize;
int fMaxPcktSize; int fMaxPcktSize;
//data //data
char* fBuffer; char* fBuffer;
char* fNetBuffer; char* fNetBuffer;
public: public:
NetMidiBuffer ( session_params_t* params, size_t nports, char* net_buffer );
NetMidiBuffer ( session_params_t* params, unsigned int nports, char* net_buffer );
~NetMidiBuffer(); ~NetMidiBuffer();


JackMidiBuffer** fPortBuffer; JackMidiBuffer** fPortBuffer;


void Reset(); void Reset();
size_t GetSize();
unsigned int GetSize();
//utility //utility
void DisplayEvents(); void DisplayEvents();
//jack<->buffer //jack<->buffer
int RenderFromJackPorts(); int RenderFromJackPorts();
int RenderToJackPorts(); int RenderToJackPorts();
//network<->buffer //network<->buffer
int RenderFromNetwork ( size_t subcycle, size_t copy_size );
int RenderToNetwork ( size_t subcycle, size_t copy_size );
int RenderFromNetwork ( unsigned int subcycle, unsigned int copy_size );
int RenderToNetwork ( unsigned int subcycle, unsigned int copy_size );
}; };


// audio data ********************************************************************************* // audio data *********************************************************************************
@@ -137,18 +137,18 @@ namespace Jack
int fNPorts; int fNPorts;
jack_nframes_t fPeriodSize; jack_nframes_t fPeriodSize;
jack_nframes_t fSubPeriodSize; jack_nframes_t fSubPeriodSize;
size_t fSubPeriodBytesSize;
unsigned int fSubPeriodBytesSize;
char* fNetBuffer; char* fNetBuffer;
public: public:
NetAudioBuffer ( session_params_t* params, size_t nports, char* net_buffer );
NetAudioBuffer ( session_params_t* params, unsigned int nports, char* net_buffer );
~NetAudioBuffer(); ~NetAudioBuffer();


sample_t** fPortBuffer; sample_t** fPortBuffer;


size_t GetSize();
unsigned int GetSize();
//jack<->buffer //jack<->buffer
void RenderFromJackPorts ( size_t subcycle );
void RenderToJackPorts ( size_t subcycle );
void RenderFromJackPorts ( unsigned int subcycle );
void RenderToJackPorts ( unsigned int subcycle );
}; };


//utility ************************************************************************************* //utility *************************************************************************************
@@ -167,11 +167,11 @@ namespace Jack
//set the packet type in a session parameters //set the packet type in a session parameters
EXPORT int SetPacketType ( session_params_t* params, sync_packet_type_t packet_type ); EXPORT int SetPacketType ( session_params_t* params, sync_packet_type_t packet_type );
//step of network initialization //step of network initialization
EXPORT size_t SetFramesPerPacket ( session_params_t* params );
EXPORT unsigned int SetFramesPerPacket ( session_params_t* params );
//get the midi packet number for a given cycle //get the midi packet number for a given cycle
EXPORT size_t GetNMidiPckt ( session_params_t* params, size_t data_size );
EXPORT unsigned int GetNMidiPckt ( session_params_t* params, unsigned int data_size );
//set the recv timeout on a socket //set the recv timeout on a socket
EXPORT int SetRxTimeout ( int* sockfd, session_params_t* params ); EXPORT int SetRxTimeout ( int* sockfd, session_params_t* params );
//check if 'next' packet is really the next after 'previous' //check if 'next' packet is really the next after 'previous'
EXPORT bool IsNextPacket ( packet_header_t* previous, packet_header_t* next, size_t subcycles );
EXPORT bool IsNextPacket ( packet_header_t* previous, packet_header_t* next, unsigned int subcycles );
} }

Loading…
Cancel
Save