Jack2  1.9.8
JackInternalClientChannel.h
1 /*
2 Copyright (C) 2004-2008 Grame
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #ifndef __JackInternalClientChannel__
21 #define __JackInternalClientChannel__
22 
23 #include "JackChannel.h"
24 
25 namespace Jack
26 {
27 
33 {
34 
35  private:
36 
37  JackServer* fServer;
38  JackLockedEngine* fEngine;
39 
40  public:
41 
42  JackInternalClientChannel(JackServer* server): fServer(server), fEngine(server->GetEngine())
43  {}
44  virtual ~JackInternalClientChannel()
45  {}
46 
47  // Open the Server/Client connection
48  virtual int Open(const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
49  {
50  return 0;
51  }
52 
53  void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open)
54  {
55  *result = fEngine->ClientCheck(name, uuid, name_res, protocol, options, status);
56  }
57  void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
58  {
59  *result = fEngine->ClientInternalOpen(name, ref, shared_engine, shared_manager, client, true);
60  }
61  void ClientClose(int refnum, int* result)
62  {
63  *result = fEngine->ClientInternalClose(refnum, true);
64  }
65 
66  void ClientActivate(int refnum, int is_real_time, int* result)
67  {
68  *result = fEngine->ClientActivate(refnum, is_real_time);
69  }
70  void ClientDeactivate(int refnum, int* result)
71  {
72  *result = fEngine->ClientDeactivate(refnum);
73  }
74 
75  void PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, unsigned int* port_index, int* result)
76  {
77  *result = fEngine->PortRegister(refnum, name, type, flags, buffer_size, port_index);
78  }
79  void PortUnRegister(int refnum, jack_port_id_t port_index, int* result)
80  {
81  *result = fEngine->PortUnRegister(refnum, port_index);
82  }
83  void PortConnect(int refnum, const char* src, const char* dst, int* result)
84  {
85  *result = fEngine->PortConnect(refnum, src, dst);
86  }
87  void PortDisconnect(int refnum, const char* src, const char* dst, int* result)
88  {
89  *result = fEngine->PortDisconnect(refnum, src, dst);
90  }
91  void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
92  {
93  *result = fEngine->PortConnect(refnum, src, dst);
94  }
95  void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
96  {
97  *result = fEngine->PortDisconnect(refnum, src, dst);
98  }
99  void PortRename(int refnum, jack_port_id_t port, const char* name, int* result)
100  {
101  *result = fEngine->PortRename(refnum, port, name);
102  }
103 
104  void SetBufferSize(jack_nframes_t buffer_size, int* result)
105  {
106  *result = fServer->SetBufferSize(buffer_size);
107  }
108  void SetFreewheel(int onoff, int* result)
109  {
110  *result = fServer->SetFreewheel(onoff);
111  }
112  void ComputeTotalLatencies(int* result)
113  {
114  *result = fEngine->ComputeTotalLatencies();
115  }
116 
117  void ReleaseTimebase(int refnum, int* result)
118  {
119  *result = fServer->ReleaseTimebase(refnum);
120  }
121 
122  void SetTimebaseCallback(int refnum, int conditional, int* result)
123  {
124  *result = fServer->SetTimebaseCallback(refnum, conditional);
125  }
126 
127  void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result)
128  {
129  *result = fEngine->GetInternalClientName(int_ref, name_res);
130  }
131 
132  void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
133  {
134  *result = fEngine->InternalClientHandle(client_name, status, int_ref);
135  }
136 
137  void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int uuid, int* result)
138  {
139  *result = fServer->InternalClientLoad1(client_name, so_name, objet_data, options, int_ref, uuid, status);
140  }
141 
142  void InternalClientUnload(int refnum, int int_ref, int* status, int* result)
143  {
144  *result = fEngine->InternalClientUnload(int_ref, status);
145  }
146 
147  void SessionNotify(int refnum, const char *target, jack_session_event_type_t type, const char *path, jack_session_command_t** result)
148  {
150  fEngine->SessionNotify(refnum, target, type, path, NULL, &res);
151  if (res == NULL)
152  {
153  *result = NULL;
154  return;
155  }
156 
157  *result = res->GetCommands();
158  delete(res);
159  }
160 
161  void SessionReply(int refnum, int* result)
162  {
163  fEngine->SessionReply(refnum);
164  *result = 0;
165  }
166 
167  void GetUUIDForClientName(int refnum, const char* client_name, char* uuid_res, int* result)
168  {
169  fEngine->GetUUIDForClientName(client_name, uuid_res, result);
170  }
171 
172  void GetClientNameForUUID(int refnum, const char* uuid, char* name_res, int* result)
173  {
174  fEngine->GetClientNameForUUID(uuid, name_res, result);
175  }
176 
177  void ReserveClientName(int refnum, const char* client_name, const char *uuid, int* result)
178  {
179  fEngine->ReserveClientName(client_name, uuid, result);
180  }
181 
182  void ClientHasSessionCallback(const char* client_name, int* result)
183  {
184  fEngine->ClientHasSessionCallback(client_name, result);
185  }
186 
187 
188 };
189 
190 } // end of namespace
191 
192 #endif
193