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 "JackPlatformPlug.h"
00030 #include "JackSystemDeps.h"
00031
00032
00033 namespace Jack
00034 {
00035
00040 class SERVER_EXPORT JackGraphManager : public JackShmMem, public JackAtomicState<JackConnectionManager>
00041 {
00042
00043 private:
00044
00045 JackPort fPortArray[PORT_NUM];
00046 JackClientTiming fClientTiming[CLIENT_NUM];
00047
00048 jack_port_id_t AllocatePortAux(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
00049 void GetConnectionsAux(JackConnectionManager* manager, const char** res, jack_port_id_t port_index);
00050 void GetPortsAux(const char** matching_ports, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
00051 float* GetBuffer(jack_port_id_t port_index);
00052 void* GetBufferAux(JackConnectionManager* manager, jack_port_id_t port_index, jack_nframes_t frames);
00053 jack_nframes_t ComputeTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count);
00054
00055 public:
00056
00057 JackGraphManager()
00058 {}
00059 ~JackGraphManager()
00060 {}
00061
00062 void SetBufferSize(jack_nframes_t buffer_size);
00063
00064
00065 jack_port_id_t AllocatePort(int refnum, const char* port_name, const char* port_type, JackPortFlags flags, jack_nframes_t buffer_size);
00066 int ReleasePort(int refnum, jack_port_id_t port_index);
00067 void GetInputPorts(int refnum, jack_int_t* res);
00068 void GetOutputPorts(int refnum, jack_int_t* res);
00069 void RemoveAllPorts(int refnum);
00070 void DisconnectAllPorts(int refnum);
00071
00072 JackPort* GetPort(jack_port_id_t index);
00073 jack_port_id_t GetPort(const char* name);
00074 int ComputeTotalLatency(jack_port_id_t port_index);
00075 int ComputeTotalLatencies();
00076 int RequestMonitor(jack_port_id_t port_index, bool onoff);
00077
00078
00079 int Connect(jack_port_id_t src_index, jack_port_id_t dst_index);
00080 int Disconnect(jack_port_id_t src_index, jack_port_id_t dst_index);
00081 int IsConnected(jack_port_id_t port_src, jack_port_id_t port_dst);
00082
00083
00084 int GetConnectionsNum(jack_port_id_t port_index)
00085 {
00086 JackConnectionManager* manager = ReadCurrentState();
00087 return manager->Connections(port_index);
00088 }
00089
00090 const char** GetConnections(jack_port_id_t port_index);
00091 void GetConnections(jack_port_id_t port_index, jack_int_t* connections);
00092 const char** GetPorts(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
00093
00094 int CheckPorts(const char* src, const char* dst, jack_port_id_t* src_index, jack_port_id_t* dst_index);
00095 int CheckPorts(jack_port_id_t port_src, jack_port_id_t port_dst);
00096
00097 void DisconnectAllInput(jack_port_id_t port_index);
00098 void DisconnectAllOutput(jack_port_id_t port_index);
00099 int DisconnectAll(jack_port_id_t port_index);
00100
00101 bool IsDirectConnection(int ref1, int ref2);
00102 void DirectConnect(int ref1, int ref2);
00103 void DirectDisconnect(int ref1, int ref2);
00104
00105 void Activate(int refnum);
00106 void Deactivate(int refnum);
00107
00108 int GetInputRefNum(jack_port_id_t port_index);
00109 int GetOutputRefNum(jack_port_id_t port_index);
00110
00111
00112 void* GetBuffer(jack_port_id_t port_index, jack_nframes_t frames);
00113
00114
00115 void RunCurrentGraph();
00116 bool RunNextGraph();
00117 bool IsFinishedGraph();
00118
00119 void InitRefNum(int refnum);
00120 int ResumeRefNum(JackClientControl* control, JackSynchro* table);
00121 int SuspendRefNum(JackClientControl* control, JackSynchro* table, long usecs);
00122
00123 JackClientTiming* GetClientTiming(int refnum);
00124
00125 void Save(JackConnectionManager* dst);
00126 void Restore(JackConnectionManager* src);
00127
00128 };
00129
00130
00131 }
00132
00133 #endif
00134