00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __JackGraphManager__
00022 #define __JackGraphManager__
00023
00024 #include "JackShmMem.h"
00025 #include "JackPort.h"
00026 #include "JackConstants.h"
00027 #include "JackConnectionManager.h"
00028 #include "JackAtomicState.h"
00029 #include "JackMutex.h"
00030
00031 namespace Jack
00032 {
00033
00038 class JackGraphManager : public JackShmMem, public JackAtomicState<JackConnectionManager>, public JackLockAble
00039 {
00040
00041 private:
00042
00043 JackPort fPortArray[PORT_NUM];
00044 JackClientTiming fClientTiming[CLIENT_NUM];
00045
00046 jack_port_id_t AllocatePortAux(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
00047 void GetConnectionsAux(JackConnectionManager* manager, const char** res, jack_port_id_t port_index);
00048 const char** GetPortsAux(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
00049 float* GetBuffer(jack_port_id_t port_index);
00050 void* GetBufferAux(JackConnectionManager* manager, jack_port_id_t port_index, jack_nframes_t frames);
00051 jack_nframes_t ComputeTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count);
00052
00053 public:
00054
00055 JackGraphManager()
00056 {}
00057 ~JackGraphManager()
00058 {}
00059
00060 void SetBufferSize(jack_nframes_t buffer_size);
00061
00062
00063 jack_port_id_t AllocatePort(int refnum, const char* port_name, const char* port_type, JackPortFlags flags, jack_nframes_t buffer_size);
00064 int ReleasePort(int refnum, jack_port_id_t port_index);
00065 void GetInputPorts(int refnum, jack_int_t* res);
00066 void GetOutputPorts(int refnum, jack_int_t* res);
00067 void RemoveAllPorts(int refnum);
00068 void DisconnectAllPorts(int refnum);
00069
00070 JackPort* GetPort(jack_port_id_t index);
00071 jack_port_id_t GetPort(const char* name);
00072 int ComputeTotalLatency(jack_port_id_t port_index);
00073 int ComputeTotalLatencies();
00074 int RequestMonitor(jack_port_id_t port_index, bool onoff);
00075
00076
00077 int Connect(jack_port_id_t src_index, jack_port_id_t dst_index);
00078 int Disconnect(jack_port_id_t src_index, jack_port_id_t dst_index);
00079 int IsConnected(jack_port_id_t port_src, jack_port_id_t port_dst);
00080 int GetConnectionsNum(jack_port_id_t port_index);
00081
00082 const char** GetConnections(jack_port_id_t port_index);
00083 void GetConnections(jack_port_id_t port_index, jack_int_t* connections);
00084 const char** GetPorts(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
00085
00086 int CheckPorts(const char* src, const char* dst, jack_port_id_t* src_index, jack_port_id_t* dst_index);
00087 int CheckPorts(jack_port_id_t port_src, jack_port_id_t port_dst);
00088
00089 void DisconnectAllInput(jack_port_id_t port_index);
00090 void DisconnectAllOutput(jack_port_id_t port_index);
00091 int DisconnectAll(jack_port_id_t port_index);
00092
00093 bool IsDirectConnection(int ref1, int ref2);
00094 void DirectConnect(int ref1, int ref2);
00095 void DirectDisconnect(int ref1, int ref2);
00096
00097 void Activate(int refnum);
00098 void Deactivate(int refnum);
00099
00100 int GetInputRefNum(jack_port_id_t port_index);
00101 int GetOutputRefNum(jack_port_id_t port_index);
00102
00103
00104 void* GetBuffer(jack_port_id_t port_index, jack_nframes_t frames);
00105
00106
00107 void RunCurrentGraph();
00108 bool RunNextGraph();
00109 bool IsFinishedGraph();
00110
00111 void InitRefNum(int refnum);
00112 int ResumeRefNum(JackClientControl* control, JackSynchro** table);
00113 int SuspendRefNum(JackClientControl* control, JackSynchro** table, long usecs);
00114
00115 JackClientTiming* GetClientTiming(int refnum);
00116
00117 void Save(JackConnectionManager* dst);
00118 void Restore(JackConnectionManager* src);
00119
00120 };
00121
00122
00123 }
00124
00125 #endif
00126