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
00030 namespace Jack
00031 {
00032
00037 class JackGraphManager : public JackShmMem, public JackAtomicState<JackConnectionManager>
00038 {
00039
00040 private:
00041
00042 JackPort fPortArray[PORT_NUM];
00043 JackClientTiming fClientTiming[CLIENT_NUM];
00044
00045 jack_port_id_t AllocatePortAux(int refnum, const char* port_name, JackPortFlags flags);
00046 void GetConnectionsAux(JackConnectionManager* manager, const char** res, jack_port_id_t port_index);
00047 const char** GetPortsAux(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
00048 float* GetBuffer(jack_port_id_t port_index);
00049 void* GetBufferAux(JackConnectionManager* manager, jack_port_id_t port_index, jack_nframes_t frames);
00050 jack_nframes_t GetTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count);
00051
00052 public:
00053
00054 JackGraphManager()
00055 {}
00056 virtual ~JackGraphManager()
00057 {}
00058
00059
00060 jack_port_id_t AllocatePort(int refnum, const char* port_name, JackPortFlags flags);
00061 void ReleasePort(jack_port_id_t port_index);
00062 JackPort* GetPort(jack_port_id_t index);
00063 jack_port_id_t GetPort(const char* name);
00064 jack_nframes_t GetTotalLatency(jack_port_id_t port_index);
00065 int RequestMonitor(jack_port_id_t port_index, bool onoff);
00066
00067
00068 int Connect(jack_port_id_t src_index, jack_port_id_t dst_index);
00069 int Disconnect(jack_port_id_t src_index, jack_port_id_t dst_index);
00070 int GetConnectionsNum(jack_port_id_t port_index);
00071
00072 int ConnectedTo(jack_port_id_t port_src, const char* port_name);
00073 const char** GetConnections(jack_port_id_t port_index);
00074 const char** GetPorts(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
00075
00076 int CheckPorts(const char* src, const char* dst, jack_port_id_t* src_index, jack_port_id_t* dst_index);
00077 int CheckPorts(jack_port_id_t port_src, jack_port_id_t port_dst);
00078 int CheckPort(jack_port_id_t port_index);
00079
00080 void DisconnectAllInput(jack_port_id_t port_index);
00081 void DisconnectAllOutput(jack_port_id_t port_index);
00082 int DisconnectAll(jack_port_id_t port_index);
00083
00084 bool IsDirectConnection(int ref1, int ref2);
00085 void DirectConnect(int ref1, int ref2);
00086 void DirectDisconnect(int ref1, int ref2);
00087
00088 int RemovePort(int refnum, jack_port_id_t port_index);
00089 void RemoveAllPorts(int refnum);
00090 void DisconnectAllPorts(int refnum);
00091
00092 int GetInputRefNum(jack_port_id_t port_index);
00093 int GetOutputRefNum(jack_port_id_t port_index);
00094
00095
00096 void* GetBuffer(jack_port_id_t port_index, jack_nframes_t frames);
00097
00098
00099 void RunCurrentGraph();
00100 bool RunNextGraph();
00101 bool IsFinishedGraph();
00102
00103 void InitRefNum(int refnum);
00104 int ResumeRefNum(JackClientControl* control, JackSynchro** table);
00105 int SuspendRefNum(JackClientControl* control, JackSynchro** table, long usecs);
00106
00107 JackClientTiming* GetClientTiming(int refnum);
00108
00109 void Save(JackConnectionManager* dst);
00110 void Restore(JackConnectionManager* src);
00111
00112 };
00113
00114
00115 }
00116
00117 #endif
00118