Add Pieter Palmers FreeBob driver.
[jack2.git] / common / JackGraphManager.h
blob646e0267711f5793195ad9ba556b49f99224cb6b
1 /*
2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2006 Grame
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __JackGraphManager__
22 #define __JackGraphManager__
24 #include "JackShmMem.h"
25 #include "JackPort.h"
26 #include "JackConstants.h"
27 #include "JackConnectionManager.h"
28 #include "JackAtomicState.h"
30 namespace Jack
33 /*!
34 \brief Graph manager: contains the connection manager and the port array.
37 class JackGraphManager : public JackShmMem, public JackAtomicState<JackConnectionManager>
40 private:
42 JackPort fPortArray[PORT_NUM];
43 JackClientTiming fClientTiming[CLIENT_NUM];
45 jack_port_id_t AllocatePortAux(int refnum, const char* port_name, JackPortFlags flags);
46 void GetConnectionsAux(JackConnectionManager* manager, const char** res, jack_port_id_t port_index);
47 const char** GetPortsAux(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
48 float* GetBuffer(jack_port_id_t port_index);
49 void* GetBufferAux(JackConnectionManager* manager, jack_port_id_t port_index, jack_nframes_t frames);
50 jack_nframes_t GetTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count);
52 public:
54 JackGraphManager()
56 virtual ~JackGraphManager()
59 // Ports management
60 jack_port_id_t AllocatePort(int refnum, const char* port_name, JackPortFlags flags);
61 void ReleasePort(jack_port_id_t port_index);
62 JackPort* GetPort(jack_port_id_t index);
63 jack_port_id_t GetPort(const char* name);
64 jack_nframes_t GetTotalLatency(jack_port_id_t port_index);
65 int RequestMonitor(jack_port_id_t port_index, bool onoff);
67 // Connections management
68 int Connect(jack_port_id_t src_index, jack_port_id_t dst_index);
69 int Disconnect(jack_port_id_t src_index, jack_port_id_t dst_index);
70 int GetConnectionsNum(jack_port_id_t port_index);
72 int ConnectedTo(jack_port_id_t port_src, const char* port_name);
73 const char** GetConnections(jack_port_id_t port_index);
74 const char** GetPorts(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
76 int CheckPorts(const char* src, const char* dst, jack_port_id_t* src_index, jack_port_id_t* dst_index);
77 int CheckPorts(jack_port_id_t port_src, jack_port_id_t port_dst);
78 int CheckPort(jack_port_id_t port_index);
80 void DisconnectAllInput(jack_port_id_t port_index);
81 void DisconnectAllOutput(jack_port_id_t port_index);
82 int DisconnectAll(jack_port_id_t port_index);
84 bool IsDirectConnection(int ref1, int ref2);
85 void DirectConnect(int ref1, int ref2);
86 void DirectDisconnect(int ref1, int ref2);
88 int RemovePort(int refnum, jack_port_id_t port_index);
89 void RemoveAllPorts(int refnum);
90 void DisconnectAllPorts(int refnum);
92 void Activate(int refnum);
93 void Deactivate(int refnum);
95 int GetInputRefNum(jack_port_id_t port_index);
96 int GetOutputRefNum(jack_port_id_t port_index);
98 // Buffer management
99 void* GetBuffer(jack_port_id_t port_index, jack_nframes_t frames);
101 // Activation management
102 void RunCurrentGraph();
103 bool RunNextGraph();
104 bool IsFinishedGraph();
106 void InitRefNum(int refnum);
107 int ResumeRefNum(JackClientControl* control, JackSynchro** table);
108 int SuspendRefNum(JackClientControl* control, JackSynchro** table, long usecs);
110 JackClientTiming* GetClientTiming(int refnum);
112 void Save(JackConnectionManager* dst);
113 void Restore(JackConnectionManager* src);
118 } // end of namespace
120 #endif