20 #ifndef __JackLockedEngine__
21 #define __JackLockedEngine__
23 #include "JackEngine.h"
24 #include "JackMutex.h"
25 #include "JackTools.h"
26 #include "JackException.h"
43 #define CATCH_EXCEPTION_RETURN \
44 } catch(std::bad_alloc& e) { \
45 jack_error("Memory allocation error..."); \
48 jack_error("Unknown error..."); \
52 #define CATCH_CLOSE_EXCEPTION_RETURN \
53 } catch(std::bad_alloc& e) { \
54 jack_error("Memory allocation error..."); \
56 } catch(JackTemporaryException& e) { \
57 jack_error("JackTemporaryException : now quits..."); \
58 JackTools::KillServer(); \
61 jack_error("Unknown error..."); \
65 #define CATCH_EXCEPTION \
66 } catch(std::bad_alloc& e) { \
67 jack_error("Memory allocation error..."); \
69 jack_error("Unknown error..."); \
87 fEngine(manager, table, controler)
96 return fEngine.Open();
97 CATCH_EXCEPTION_RETURN
103 return fEngine.Close();
104 CATCH_EXCEPTION_RETURN
108 int ClientCheck(
const char* name,
int uuid,
char* name_res,
int protocol,
int options,
int* status)
112 return fEngine.ClientCheck(name, uuid, name_res, protocol, options, status);
113 CATCH_EXCEPTION_RETURN
115 int ClientExternalOpen(
const char* name,
int pid,
int uuid,
int* ref,
int* shared_engine,
int* shared_client,
int* shared_graph_manager)
119 return fEngine.ClientExternalOpen(name, pid, uuid, ref, shared_engine, shared_client, shared_graph_manager);
120 CATCH_EXCEPTION_RETURN
126 return fEngine.ClientInternalOpen(name, ref, shared_engine, shared_manager, client, wait);
127 CATCH_EXCEPTION_RETURN
130 int ClientExternalClose(
int refnum)
134 return (fEngine.CheckClient(refnum)) ? fEngine.ClientExternalClose(refnum) : -1;
135 CATCH_CLOSE_EXCEPTION_RETURN
137 int ClientInternalClose(
int refnum,
bool wait)
141 return (fEngine.CheckClient(refnum)) ? fEngine.ClientInternalClose(refnum, wait) : -1;
142 CATCH_CLOSE_EXCEPTION_RETURN
145 int ClientActivate(
int refnum,
bool is_real_time)
149 return (fEngine.CheckClient(refnum)) ? fEngine.ClientActivate(refnum, is_real_time) : -1;
150 CATCH_EXCEPTION_RETURN
152 int ClientDeactivate(
int refnum)
156 return (fEngine.CheckClient(refnum)) ? fEngine.ClientDeactivate(refnum) : -1;
157 CATCH_EXCEPTION_RETURN
161 int GetInternalClientName(
int int_ref,
char* name_res)
165 return fEngine.GetInternalClientName(int_ref, name_res);
166 CATCH_EXCEPTION_RETURN
168 int InternalClientHandle(
const char* client_name,
int* status,
int* int_ref)
172 return fEngine.InternalClientHandle(client_name, status, int_ref);
173 CATCH_EXCEPTION_RETURN
175 int InternalClientUnload(
int refnum,
int* status)
180 return fEngine.InternalClientUnload(refnum, status);
181 CATCH_EXCEPTION_RETURN
185 int PortRegister(
int refnum,
const char* name,
const char *type,
unsigned int flags,
unsigned int buffer_size, jack_port_id_t* port)
189 return (fEngine.CheckClient(refnum)) ? fEngine.PortRegister(refnum, name, type, flags, buffer_size, port) : -1;
190 CATCH_EXCEPTION_RETURN
192 int PortUnRegister(
int refnum, jack_port_id_t port)
196 return (fEngine.CheckClient(refnum)) ? fEngine.PortUnRegister(refnum, port) : -1;
197 CATCH_EXCEPTION_RETURN
200 int PortConnect(
int refnum,
const char* src,
const char* dst)
204 return (fEngine.CheckClient(refnum)) ? fEngine.PortConnect(refnum, src, dst) : -1;
205 CATCH_EXCEPTION_RETURN
207 int PortDisconnect(
int refnum,
const char* src,
const char* dst)
211 return (fEngine.CheckClient(refnum)) ? fEngine.PortDisconnect(refnum, src, dst) : -1;
212 CATCH_EXCEPTION_RETURN
215 int PortConnect(
int refnum, jack_port_id_t src, jack_port_id_t dst)
219 return (fEngine.CheckClient(refnum)) ? fEngine.PortConnect(refnum, src, dst) : -1;
220 CATCH_EXCEPTION_RETURN
222 int PortDisconnect(
int refnum, jack_port_id_t src, jack_port_id_t dst)
226 return (fEngine.CheckClient(refnum)) ? fEngine.PortDisconnect(refnum, src, dst) : -1;
227 CATCH_EXCEPTION_RETURN
230 int PortRename(
int refnum, jack_port_id_t port,
const char* name)
234 return (fEngine.CheckClient(refnum)) ? fEngine.PortRename(refnum, port, name) : -1;
235 CATCH_EXCEPTION_RETURN
238 int ComputeTotalLatencies()
242 return fEngine.ComputeTotalLatencies();
243 CATCH_EXCEPTION_RETURN
247 bool Process(jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end)
250 return fEngine.Process(cur_cycle_begin, prev_cycle_end);
254 void NotifyXRun(jack_time_t cur_cycle_begin,
float delayed_usecs)
257 fEngine.NotifyXRun(cur_cycle_begin, delayed_usecs);
260 void NotifyXRun(
int refnum)
263 fEngine.NotifyXRun(refnum);
266 void NotifyGraphReorder()
270 fEngine.NotifyGraphReorder();
274 void NotifyBufferSize(jack_nframes_t buffer_size)
278 fEngine.NotifyBufferSize(buffer_size);
281 void NotifySampleRate(jack_nframes_t sample_rate)
285 fEngine.NotifySampleRate(sample_rate);
288 void NotifyFreewheel(
bool onoff)
292 fEngine.NotifyFreewheel(onoff);
296 void NotifyFailure(
int code,
const char* reason)
300 fEngine.NotifyFailure(code, reason);
304 int GetClientPID(
const char* name)
308 return fEngine.GetClientPID(name);
309 CATCH_EXCEPTION_RETURN
312 int GetClientRefNum(
const char* name)
316 return fEngine.GetClientRefNum(name);
317 CATCH_EXCEPTION_RETURN
324 return fEngine.NotifyQuit();
332 fEngine.SessionNotify(refnum, target, type, path, socket, result);
336 void SessionReply(
int refnum)
340 fEngine.SessionReply(refnum);
344 void GetUUIDForClientName(
const char *client_name,
char *uuid_res,
int *result)
348 fEngine.GetUUIDForClientName(client_name, uuid_res, result);
351 void GetClientNameForUUID(
const char *uuid,
char *name_res,
int *result)
355 fEngine.GetClientNameForUUID(uuid, name_res, result);
358 void ReserveClientName(
const char *name,
const char *uuid,
int *result)
362 fEngine.ReserveClientName(name, uuid, result);
366 void ClientHasSessionCallback(
const char *name,
int *result)
370 fEngine.ClientHasSessionCallback(name, result);