JackGraphManager.h

00001 /*
00002 Copyright (C) 2001 Paul Davis
00003 Copyright (C) 2004-2008 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 #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         // Ports management
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         // Connections management
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);  // TODO
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         // Buffer management
00104         void* GetBuffer(jack_port_id_t port_index, jack_nframes_t frames); 
00105 
00106         // Activation management
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 } // end of namespace
00124 
00125 #endif
00126 

Generated on Thu Feb 14 11:16:01 2008 for Jackdmp by  doxygen 1.5.1