Commit f6aa1469 authored by moret's avatar moret
Browse files

Change file encoding to UTF8 on windows

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2681 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 53adea59
This diff is collapsed.
......@@ -26,79 +26,79 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
namespace Jack
{
class JackNetDriver : public JackAudioDriver
{
private:
session_params_t fParams;
char* fMulticastIP;
JackNetSocket fSocket;
uint fNSubProcess;
jack_port_id_t* fMidiCapturePortList;
jack_port_id_t* fMidiPlaybackPortList;
packet_header_t fTxHeader;
packet_header_t fRxHeader;
char* fTxBuffer;
char* fRxBuffer;
char* fTxData;
char* fRxData;
NetMidiBuffer* fNetMidiCaptureBuffer;
NetMidiBuffer* fNetMidiPlaybackBuffer;
NetAudioBuffer* fNetAudioCaptureBuffer;
NetAudioBuffer* fNetAudioPlaybackBuffer;
int fAudioRxLen;
int fAudioTxLen;
bool Init();
net_status_t GetNetMaster();
net_status_t SendMasterStartSync();
void Restart();
int SetParams();
int AllocPorts();
int FreePorts();
JackMidiBuffer* GetMidiInputBuffer ( int port_index );
JackMidiBuffer* GetMidiOutputBuffer ( int port_index );
int Recv ( size_t size, int flags );
int Send ( size_t size, int flags );
public:
JackNetDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
const char* ip, int port, int mtu, int midi_input_ports, int midi_output_ports, const char* master_name );
~JackNetDriver();
int Open ( jack_nframes_t frames_per_cycle, jack_nframes_t rate, bool capturing, bool playing,
int inchannels, int outchannels, bool monitor, const char* capture_driver_name,
const char* playback_driver_name, jack_nframes_t capture_latency, jack_nframes_t playback_latency );
int Attach();
int Detach();
int Read();
int Write();
// BufferSize can be changed
bool IsFixedBufferSize()
{
return true;
}
int SetBufferSize(jack_nframes_t buffer_size)
{
return -1;
}
int SetSampleRate(jack_nframes_t sample_rate)
{
return -1;
}
};
class JackNetDriver : public JackAudioDriver
{
private:
session_params_t fParams;
char* fMulticastIP;
JackNetSocket fSocket;
uint fNSubProcess;
jack_port_id_t* fMidiCapturePortList;
jack_port_id_t* fMidiPlaybackPortList;
packet_header_t fTxHeader;
packet_header_t fRxHeader;
char* fTxBuffer;
char* fRxBuffer;
char* fTxData;
char* fRxData;
NetMidiBuffer* fNetMidiCaptureBuffer;
NetMidiBuffer* fNetMidiPlaybackBuffer;
NetAudioBuffer* fNetAudioCaptureBuffer;
NetAudioBuffer* fNetAudioPlaybackBuffer;
int fAudioRxLen;
int fAudioTxLen;
bool Init();
net_status_t GetNetMaster();
net_status_t SendMasterStartSync();
void Restart();
int SetParams();
int AllocPorts();
int FreePorts();
JackMidiBuffer* GetMidiInputBuffer ( int port_index );
JackMidiBuffer* GetMidiOutputBuffer ( int port_index );
int Recv ( size_t size, int flags );
int Send ( size_t size, int flags );
public:
JackNetDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
const char* ip, int port, int mtu, int midi_input_ports, int midi_output_ports, const char* master_name );
~JackNetDriver();
int Open ( jack_nframes_t frames_per_cycle, jack_nframes_t rate, bool capturing, bool playing,
int inchannels, int outchannels, bool monitor, const char* capture_driver_name,
const char* playback_driver_name, jack_nframes_t capture_latency, jack_nframes_t playback_latency );
int Attach();
int Detach();
int Read();
int Write();
// BufferSize can be changed
bool IsFixedBufferSize()
{
return true;
}
int SetBufferSize(jack_nframes_t buffer_size)
{
return -1;
}
int SetSampleRate(jack_nframes_t sample_rate)
{
return -1;
}
};
}
#endif
This diff is collapsed.
......@@ -21,95 +21,95 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define __JACKNETMASTER_H__
#include "JackNetTool.h"
#include "thread.h"
#include "jack.h"
#include "thread.h"
#include "jack.h"
#include "jslist.h"
#include <list>
namespace Jack
{
class JackNetMasterManager;
class JackNetMaster
{
friend class JackNetMasterManager;
private:
static int SetProcess ( jack_nframes_t nframes, void* arg );
JackNetMasterManager* fMasterManager;
session_params_t fParams;
JackNetSocket fSocket;
uint fNSubProcess;
int fNetJumpCnt;
bool fRunning;
jack_client_t* fJackClient;
const char* fClientName;
jack_port_t** fAudioCapturePorts;
jack_port_t** fAudioPlaybackPorts;
jack_port_t** fMidiCapturePorts;
jack_port_t** fMidiPlaybackPorts;
packet_header_t fTxHeader;
packet_header_t fRxHeader;
char* fTxBuffer;
char* fRxBuffer;
char* fTxData;
char* fRxData;
NetAudioBuffer* fNetAudioCaptureBuffer;
NetAudioBuffer* fNetAudioPlaybackBuffer;
NetMidiBuffer* fNetMidiCaptureBuffer;
NetMidiBuffer* fNetMidiPlaybackBuffer;
int fAudioTxLen;
int fAudioRxLen;
bool Init();
void FreePorts();
void Exit();
int Send ( char* buffer, size_t size, int flags );
int Recv ( size_t size, int flags );
int Process();
public:
JackNetMaster ( JackNetMasterManager* manager, session_params_t& params );
~JackNetMaster ();
};
typedef std::list<JackNetMaster*> master_list_t;
typedef master_list_t::iterator master_list_it_t;
class JackNetMasterManager
{
friend class JackNetMaster;
private:
static void* NetManagerThread ( void* arg );
static int SetProcess ( jack_nframes_t nframes, void* arg );
jack_client_t* fManagerClient;
const char* fManagerName;
const char* fMulticastIP;
JackNetSocket fSocket;
pthread_t fManagerThread;
master_list_t fMasterList;
uint32_t fGlobalID;
bool fRunning;
void Run();
JackNetMaster* MasterInit ( session_params_t& params );
master_list_it_t FindMaster ( uint32_t client_id );
void KillMaster ( session_params_t* params );
void SetSlaveName ( session_params_t& params );
int Process();
public:
JackNetMasterManager ( jack_client_t* jack_client, const JSList* params );
~JackNetMasterManager();
void Exit();
};
class JackNetMasterManager;
class JackNetMaster
{
friend class JackNetMasterManager;
private:
static int SetProcess ( jack_nframes_t nframes, void* arg );
JackNetMasterManager* fMasterManager;
session_params_t fParams;
JackNetSocket fSocket;
uint fNSubProcess;
int fNetJumpCnt;
bool fRunning;
jack_client_t* fJackClient;
const char* fClientName;
jack_port_t** fAudioCapturePorts;
jack_port_t** fAudioPlaybackPorts;
jack_port_t** fMidiCapturePorts;
jack_port_t** fMidiPlaybackPorts;
packet_header_t fTxHeader;
packet_header_t fRxHeader;
char* fTxBuffer;
char* fRxBuffer;
char* fTxData;
char* fRxData;
NetAudioBuffer* fNetAudioCaptureBuffer;
NetAudioBuffer* fNetAudioPlaybackBuffer;
NetMidiBuffer* fNetMidiCaptureBuffer;
NetMidiBuffer* fNetMidiPlaybackBuffer;
int fAudioTxLen;
int fAudioRxLen;
bool Init();
void FreePorts();
void Exit();
int Send ( char* buffer, size_t size, int flags );
int Recv ( size_t size, int flags );
int Process();
public:
JackNetMaster ( JackNetMasterManager* manager, session_params_t& params );
~JackNetMaster ();
};
typedef std::list<JackNetMaster*> master_list_t;
typedef master_list_t::iterator master_list_it_t;
class JackNetMasterManager
{
friend class JackNetMaster;
private:
static void* NetManagerThread ( void* arg );
static int SetProcess ( jack_nframes_t nframes, void* arg );
jack_client_t* fManagerClient;
const char* fManagerName;
const char* fMulticastIP;
JackNetSocket fSocket;
pthread_t fManagerThread;
master_list_t fMasterList;
uint32_t fGlobalID;
bool fRunning;
void Run();
JackNetMaster* MasterInit ( session_params_t& params );
master_list_it_t FindMaster ( uint32_t client_id );
void KillMaster ( session_params_t* params );
void SetSlaveName ( session_params_t& params );
int Process();
public:
JackNetMasterManager ( jack_client_t* jack_client, const JSList* params );
~JackNetMasterManager();
void Exit();
};
}
#endif
This diff is collapsed.
......@@ -21,7 +21,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackConstants.h"
#include "JackMidiPort.h"
#include "JackExports.h"
#include "JackError.h"
#include "JackError.h"
#include "JackTools.h"
#include "JackPlatformNetSocket.h"
......@@ -31,157 +31,157 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
namespace Jack
{
typedef struct _session_params session_params_t;
typedef struct _packet_header packet_header_t;
typedef struct sockaddr socket_address_t;
typedef struct in_addr address_t;
typedef jack_default_audio_sample_t sample_t;
typedef struct _session_params session_params_t;
typedef struct _packet_header packet_header_t;
typedef struct sockaddr socket_address_t;
typedef struct in_addr address_t;
typedef jack_default_audio_sample_t sample_t;
//session params ******************************************************************************
struct _session_params
{
char fPacketType[7]; //packet type ('param')
char fProtocolVersion; //version
uint32_t fPacketID; //indicates the packet type
char fMasterNetName[256]; //master hostname (network)
char fSlaveNetName[256]; //slave hostname (network)
uint32_t fMtu; //connection mtu
uint32_t fID; //slave's ID
uint32_t fSendAudioChannels; //number of master->slave channels
uint32_t fReturnAudioChannels; //number of slave->master channels
uint32_t fSendMidiChannels; //number of master->slave midi channels
uint32_t fReturnMidiChannels; //number of slave->master midi channels
uint32_t fSampleRate; //session sample rate
uint32_t fPeriodSize; //period size
uint32_t fFramesPerPacket; //complete frames per packet
uint32_t fBitdepth; //samples bitdepth (unused)
char fName[JACK_CLIENT_NAME_SIZE]; //slave's name
};
struct _session_params
{
char fPacketType[7]; //packet type ('param')
char fProtocolVersion; //version
uint32_t fPacketID; //indicates the packet type
char fMasterNetName[256]; //master hostname (network)
char fSlaveNetName[256]; //slave hostname (network)
uint32_t fMtu; //connection mtu
uint32_t fID; //slave's ID
uint32_t fSendAudioChannels; //number of master->slave channels
uint32_t fReturnAudioChannels; //number of slave->master channels
uint32_t fSendMidiChannels; //number of master->slave midi channels
uint32_t fReturnMidiChannels; //number of slave->master midi channels
uint32_t fSampleRate; //session sample rate
uint32_t fPeriodSize; //period size
uint32_t fFramesPerPacket; //complete frames per packet
uint32_t fBitdepth; //samples bitdepth (unused)
char fName[JACK_CLIENT_NAME_SIZE]; //slave's name
};
//net status **********************************************************************************
enum _net_status
{
NET_SOCKET_ERROR = 0,
NET_CONNECT_ERROR,
NET_ERROR,
NET_SEND_ERROR,
NET_RECV_ERROR,
NET_CONNECTED,
NET_ROLLING
};
enum _net_status
{
NET_SOCKET_ERROR = 0,
NET_CONNECT_ERROR,
NET_ERROR,
NET_SEND_ERROR,
NET_RECV_ERROR,
NET_CONNECTED,
NET_ROLLING
};
typedef enum _net_status net_status_t;
typedef enum _net_status net_status_t;
//sync packet type ****************************************************************************
enum _sync_packet_type
{
INVALID = 0, //...
SLAVE_AVAILABLE, //a slave is available
SLAVE_SETUP, //slave configuration
START_MASTER, //slave is ready, start master
START_SLAVE, //master is ready, activate slave
KILL_MASTER //master must stop
};
enum _sync_packet_type
{
INVALID = 0, //...
SLAVE_AVAILABLE, //a slave is available
SLAVE_SETUP, //slave configuration
START_MASTER, //slave is ready, start master
START_SLAVE, //master is ready, activate slave
KILL_MASTER //master must stop
};
typedef enum _sync_packet_type sync_packet_type_t;
typedef enum _sync_packet_type sync_packet_type_t;
//packet header *******************************************************************************
struct _packet_header
{
char fPacketType[7]; //packet type ( 'headr' )
char fDataType; //a for audio, m for midi
char fDataStream; //s for send, r for return
uint32_t fID; //to identify the slave
uint32_t fBitdepth; //bitdepth of the data samples
uint32_t fMidiDataSize; //size of midi data (if packet is 'midi typed') in bytes
uint32_t fNMidiPckt; //number of midi packets of the cycle
uint32_t fCycle; //process cycle counter
uint32_t fSubCycle; //midi/audio subcycle counter
char fIsLastPckt; //is it the last packet of a given cycle ('y' or 'n')
char fFree[13]; //unused
};
struct _packet_header
{
char fPacketType[7]; //packet type ( 'headr' )
char fDataType; //a for audio, m for midi
char fDataStream; //s for send, r for return
uint32_t fID; //to identify the slave
uint32_t fBitdepth; //bitdepth of the data samples
uint32_t fMidiDataSize; //size of midi data (if packet is 'midi typed') in bytes
uint32_t fNMidiPckt; //number of midi packets of the cycle
uint32_t fCycle; //process cycle counter
uint32_t fSubCycle; //midi/audio subcycle counter
char fIsLastPckt; //is it the last packet of a given cycle ('y' or 'n')
char fFree[13]; //unused
};
//midi data ***********************************************************************************
class EXPORT NetMidiBuffer
{
private:
int fNPorts;
size_t fMaxBufsize;
int fMaxPcktSize;
//data
char* fBuffer;
char* fNetBuffer;
public:
NetMidiBuffer ( session_params_t* params, uint32_t nports, char* net_buffer );
~NetMidiBuffer();
JackMidiBuffer** fPortBuffer;
void Reset();
size_t GetSize();
//utility
void DisplayEvents();
//jack<->buffer
int RenderFromJackPorts();
int RenderToJackPorts();
//network<->buffer
int RenderFromNetwork ( int subcycle, size_t copy_size );
int RenderToNetwork ( int subcycle, size_t total_size );
};
class EXPORT NetMidiBuffer
{
private:
int fNPorts;
size_t fMaxBufsize;
int fMaxPcktSize;
//data
char* fBuffer;
char* fNetBuffer;
public:
NetMidiBuffer ( session_params_t* params, uint32_t nports, char* net_buffer );
~NetMidiBuffer();
JackMidiBuffer** fPortBuffer;
void Reset();
size_t GetSize();
//utility
void DisplayEvents();
//jack<->buffer
int RenderFromJackPorts();
int RenderToJackPorts();
//network<->buffer
int RenderFromNetwork ( int subcycle, size_t copy_size );
int RenderToNetwork ( int subcycle, size_t total_size );
};
// audio data *********************************************************************************
class EXPORT NetAudioBuffer
{
private:
int fNPorts;
jack_nframes_t fPeriodSize;
jack_nframes_t fSubPeriodSize;
size_t fSubPeriodBytesSize;
char* fNetBuffer;
public:
NetAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer );
~NetAudioBuffer();
sample_t** fPortBuffer;
size_t GetSize();
//jack<->buffer
void RenderFromJackPorts ( int subcycle );
void RenderToJackPorts ( int subcycle );
};
class EXPORT NetAudioBuffer
{
private:
int fNPorts;
jack_nframes_t fPeriodSize;
jack_nframes_t fSubPeriodSize;
size_t fSubPeriodBytesSize;
char* fNetBuffer;
public:
NetAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer );
~NetAudioBuffer();
sample_t** fPortBuffer;
size_t GetSize();
//jack<->buffer
void RenderFromJackPorts ( int subcycle );
void RenderToJackPorts ( int subcycle );
};
//utility *************************************************************************************
//socket API management
EXPORT int SocketAPIInit();
EXPORT int SocketAPIEnd();
//n<-->h functions
EXPORT void SessionParamsHToN ( session_params_t* params );
EXPORT void SessionParamsNToH ( session_params_t* params );
EXPORT void PacketHeaderHToN ( packet_header_t* header );
EXPORT void PacketHeaderNToH ( packet_header_t* header );
//display session parameters
EXPORT void SessionParamsDisplay ( session_params_t* params );
//display packet header
EXPORT void PacketHeaderDisplay ( packet_header_t* header );
//get the packet type from a sesion parameters
EXPORT sync_packet_type_t GetPacketType ( session_params_t* params );
//set the packet type in a session parameters
EXPORT int SetPacketType ( session_params_t* params, sync_packet_type_t packet_type );
//step of network initialization
EXPORT jack_nframes_t SetFramesPerPacket ( session_params_t* params );
//get the midi packet number for a given cycle
EXPORT int GetNMidiPckt ( session_params_t* params, size_t data_size );
//set the recv timeout on a socket
EXPORT int SetRxTimeout ( JackNetSocket* socket, session_params_t* params );
//check if 'next' packet is really the next after 'previous'
EXPORT bool IsNextPacket ( packet_header_t* previous, packet_header_t* next, uint subcycles );
//socket API management
EXPORT int SocketAPIInit();
EXPORT int SocketAPIEnd();