Jack2 1.9.12

JackDebugClient.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 Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 */
19
20 #ifndef __JackDebugClient__
21 #define __JackDebugClient__
22
23 #define MAX_PORT_HISTORY 2048
24
25 #include "JackClient.h"
26 #include <list>
27 #include <fstream>
28
29 namespace Jack
30 {
31
36 typedef struct
37 {
38 jack_port_id_t idport;
39 char name[JACK_PORT_NAME_SIZE]; //portname
40 int IsConnected;
41 int IsUnregistered;
42 }
43 PortFollower;
44
49 class JackDebugClient : public JackClient
50 {
51 protected:
52
53 JackClient* fClient;
54 std::ofstream* fStream;
55 PortFollower fPortList[MAX_PORT_HISTORY]; // Arbitrary value... To be tuned...
56 int fTotalPortNumber; // The total number of port opened and maybe closed. Historical view.
57 int fOpenPortNumber; // The current number of opened port.
58 int fIsActivated;
59 int fIsDeactivated;
60 int fIsClosed;
61 bool fFreewheel;
62 char fClientName[JACK_CLIENT_NAME_SIZE+1];
63 JackProcessCallback fProcessTimeCallback;
64 void* fProcessTimeCallbackArg;
65
66 public:
67
68 JackDebugClient(JackClient* fTheClient);
69 virtual ~JackDebugClient();
70
71 virtual int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status);
72 int Close();
73
74 virtual JackGraphManager* GetGraphManager() const;
75 virtual JackEngineControl* GetEngineControl() const;
76
77 // Notifications
78 int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
79
80 int Activate();
81 int Deactivate();
82
83 // Context
84 int SetBufferSize(jack_nframes_t buffer_size);
85 int SetFreeWheel(int onoff);
86 int ComputeTotalLatencies();
87 void ShutDown(jack_status_t code, const char* message);
88 jack_native_thread_t GetThreadID();
89
90 // Port management
91 int PortRegister(const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size);
92 int PortUnRegister(jack_port_id_t port);
93
94 int PortConnect(const char* src, const char* dst);
95 int PortDisconnect(const char* src, const char* dst);
96 int PortDisconnect(jack_port_id_t src);
97
98 int PortIsMine(jack_port_id_t port_index);
99 int PortRename(jack_port_id_t port_index, const char* name);
100
101 // Transport
102 int ReleaseTimebase();
103 int SetSyncCallback(JackSyncCallback sync_callback, void* arg);
104 int SetSyncTimeout(jack_time_t timeout);
105 int SetTimebaseCallback(int conditional, JackTimebaseCallback timebase_callback, void* arg);
106 void TransportLocate(jack_nframes_t frame);
107 jack_transport_state_t TransportQuery(jack_position_t* pos);
108 jack_nframes_t GetCurrentTransportFrame();
109 int TransportReposition(const jack_position_t* pos);
110 void TransportStart();
111 void TransportStop();
112
113 // Callbacks
114 void OnShutdown(JackShutdownCallback callback, void *arg);
115 void OnInfoShutdown(JackInfoShutdownCallback callback, void *arg);
116 int SetProcessCallback(JackProcessCallback callback, void* arg);
117 int SetXRunCallback(JackXRunCallback callback, void* arg);
118 int SetInitCallback(JackThreadInitCallback callback, void* arg);
119 int SetGraphOrderCallback(JackGraphOrderCallback callback, void* arg);
120 int SetBufferSizeCallback(JackBufferSizeCallback callback, void* arg);
121 int SetClientRegistrationCallback(JackClientRegistrationCallback callback, void* arg);
122 int SetFreewheelCallback(JackFreewheelCallback callback, void* arg);
123 int SetPortRegistrationCallback(JackPortRegistrationCallback callback, void* arg);
124 int SetPortConnectCallback(JackPortConnectCallback callback, void *arg);
125 int SetPortRenameCallback(JackPortRenameCallback callback, void *arg);
126 int SetSessionCallback(JackSessionCallback callback, void *arg);
127 int SetLatencyCallback(JackLatencyCallback callback, void *arg);
128
129 // Internal clients
130 char* GetInternalClientName(int ref);
131 int InternalClientHandle(const char* client_name, jack_status_t* status);
132 int InternalClientLoad(const char* client_name, jack_options_t options, jack_status_t* status, jack_varargs_t* va);
133 void InternalClientUnload(int ref, jack_status_t* status);
134
135 // RT Thread
136 int SetProcessThread(JackThreadCallback fun, void *arg);
137
138 // Session API
139 jack_session_command_t* SessionNotify(const char* target, jack_session_event_type_t type, const char* path);
140 int SessionReply(jack_session_event_t* ev);
141 char* GetUUIDForClientName(const char* client_name);
142 char* GetClientNameByUUID(const char* uuid);
143 int ReserveClientName(const char* client_name, const char* uuid);
144 int ClientHasSessionCallback(const char* client_name);
145
146 JackClientControl* GetClientControl() const;
147 void CheckClient(const char* function_name) const;
148
149 static int TimeCallback(jack_nframes_t nframes, void *arg);
150 };
151
152
153 } // end of namespace
154
155 #endif
_jack_position
Definition: types.h:554
jack_varargs_t
Definition: varargs.h:34
_jack_session_event
Definition: JackSession.h:45
Jack::PortFollower
Follow a single port.
Definition: JackDebugClient.h:36
Jack::JackGraphManager
Graph manager: contains the connection manager and the port array.
Definition: JackGraphManager.h:40
jack_session_command_t
Definition: JackSession.h:59
Jack::JackDebugClient::Deactivate
int Deactivate()
Need to stop thread after deactivating in the server.
Definition: JackDebugClient.cpp:173
Jack::JackDebugClient::Activate
int Activate()
We need to start thread before activating in the server, otherwise the FW driver connected to the cli...
Definition: JackDebugClient.cpp:160
Jack::JackDebugClient::ClientNotify
int ClientNotify(int refnum, const char *name, int notify, int sync, const char *message, int value1, int value2)
Notification received from the server.
Definition: JackDebugClient.cpp:154
Jack::JackDebugClient
A "decorator" debug client to validate API use.
Definition: JackDebugClient.h:49
Jack::JackEngineControl
Engine control in shared memory.
Definition: JackEngineControl.h:49
JackSessionCallback
void(* JackSessionCallback)(jack_session_event_t *event, void *arg)
Definition: session.h:162
Jack::JackClient
The base class for clients: share part of the implementation for JackInternalClient and JackLibClient...
Definition: JackClient.h:47
Jack::JackClientControl
Client control possibly in shared memory.
Definition: JackClientControl.h:38