JackGraphManager.h

00001 /*
00002 Copyright (C) 2001 Paul Davis
00003 Copyright (C) 2004-2006 Grame  
00004 
00005 This program is free software; you can redistribute it and/or modify
00006   it under the terms of the GNU General Public License as published by
00007   the Free Software Foundation; either version 2 of the License, or
00008   (at your option) any later version.
00009 
00010   This program is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013   GNU General Public License for more details.
00014 
00015   You should have received a copy of the GNU General Public License
00016   along with this program; if not, write to the Free Software
00017   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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         // Ports management
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         // Connections management
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         // Buffer management
00096         void* GetBuffer(jack_port_id_t port_index, jack_nframes_t frames); 
00097 
00098         // Activation management
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 } // end of namespace
00116 
00117 #endif
00118 

Generated on Wed Jan 10 11:42:45 2007 for Jackdmp by  doxygen 1.4.5