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 int ReleasePort(int refnum, jack_port_id_t port_index);
00062 void RemoveAllPorts(int refnum);
00063 void DisconnectAllPorts(int refnum);
00064
00065 JackPort* GetPort(jack_port_id_t index);
00066 jack_port_id_t GetPort(const char* name);
00067 jack_nframes_t GetTotalLatency(jack_port_id_t port_index);
00068 int RequestMonitor(jack_port_id_t port_index, bool onoff);
00069
00070
00071 int Connect(jack_port_id_t src_index, jack_port_id_t dst_index);
00072 int Disconnect(jack_port_id_t src_index, jack_port_id_t dst_index);
00073 int GetConnectionsNum(jack_port_id_t port_index);
00074
00075 int ConnectedTo(jack_port_id_t port_src, const char* port_name);
00076 const char** GetConnections(jack_port_id_t port_index);
00077 const char** GetPorts(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
00078
00079 int CheckPorts(const char* src, const char* dst, jack_port_id_t* src_index, jack_port_id_t* dst_index);
00080 int CheckPorts(jack_port_id_t port_src, jack_port_id_t port_dst);
00081 int CheckPort(jack_port_id_t port_index);
00082
00083 void DisconnectAllInput(jack_port_id_t port_index);
00084 void DisconnectAllOutput(jack_port_id_t port_index);
00085 int DisconnectAll(jack_port_id_t port_index);
00086
00087 bool IsDirectConnection(int ref1, int ref2);
00088 void DirectConnect(int ref1, int ref2);
00089 void DirectDisconnect(int ref1, int ref2);
00090
00091 void Activate(int refnum);
00092 void Deactivate(int refnum);
00093
00094 int GetInputRefNum(jack_port_id_t port_index);
00095 int GetOutputRefNum(jack_port_id_t port_index);
00096
00097
00098 void* GetBuffer(jack_port_id_t port_index, jack_nframes_t frames);
00099
00100
00101 void RunCurrentGraph();
00102 bool RunNextGraph();
00103 bool IsFinishedGraph();
00104
00105 void InitRefNum(int refnum);
00106 int ResumeRefNum(JackClientControl* control, JackSynchro** table);
00107 int SuspendRefNum(JackClientControl* control, JackSynchro** table, long usecs);
00108
00109 JackClientTiming* GetClientTiming(int refnum);
00110
00111 void Save(JackConnectionManager* dst);
00112 void Restore(JackConnectionManager* src);
00113
00114 };
00115
00116
00117 }
00118
00119 #endif
00120