2 Copyright (C) 2004-2008 Grame
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.
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.
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.
20 #ifndef __JackDebugClient__
21 #define __JackDebugClient__
23 #define MAX_PORT_HISTORY 2048
25 #include "JackClient.h"
33 \brief Follow a single port.
38 jack_port_id_t idport
;
39 char name
[JACK_PORT_NAME_SIZE
]; //portname
46 \brief A "decorator" debug client to validate API use.
49 class SERVER_EXPORT JackDebugClient
: public JackClient
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.
62 char fClientName
[JACK_CLIENT_NAME_SIZE
+ 1];
63 JackProcessCallback fProcessTimeCallback
;
64 void* fProcessTimeCallbackArg
;
68 JackDebugClient(JackClient
* fTheClient
);
69 virtual ~JackDebugClient();
71 virtual int Open(const char* server_name
, const char* name
, int uuid
, jack_options_t options
, jack_status_t
* status
);
74 virtual JackGraphManager
* GetGraphManager() const;
75 virtual JackEngineControl
* GetEngineControl() const;
78 int ClientNotify(int refnum
, const char* name
, int notify
, int sync
, const char* message
, int value1
, int value2
);
84 int SetBufferSize(jack_nframes_t buffer_size
);
85 int SetFreeWheel(int onoff
);
87 jack_native_thread_t
GetThreadID();
90 int PortRegister(const char* port_name
, const char* port_type
, unsigned long flags
, unsigned long buffer_size
);
91 int PortUnRegister(jack_port_id_t port
);
93 int PortConnect(const char* src
, const char* dst
);
94 int PortDisconnect(const char* src
, const char* dst
);
95 int PortDisconnect(jack_port_id_t src
);
97 int PortIsMine(jack_port_id_t port_index
);
100 int ReleaseTimebase();
101 int SetSyncCallback(JackSyncCallback sync_callback
, void* arg
);
102 int SetSyncTimeout(jack_time_t timeout
);
103 int SetTimebaseCallback(int conditional
, JackTimebaseCallback timebase_callback
, void* arg
);
104 void TransportLocate(jack_nframes_t frame
);
105 jack_transport_state_t
TransportQuery(jack_position_t
* pos
);
106 jack_nframes_t
GetCurrentTransportFrame();
107 int TransportReposition(jack_position_t
* pos
);
108 void TransportStart();
109 void TransportStop();
112 void OnShutdown(JackShutdownCallback callback
, void *arg
);
113 void OnInfoShutdown(JackInfoShutdownCallback callback
, void *arg
);
114 int SetProcessCallback(JackProcessCallback callback
, void* arg
);
115 int SetXRunCallback(JackXRunCallback callback
, void* arg
);
116 int SetInitCallback(JackThreadInitCallback callback
, void* arg
);
117 int SetGraphOrderCallback(JackGraphOrderCallback callback
, void* arg
);
118 int SetBufferSizeCallback(JackBufferSizeCallback callback
, void* arg
);
119 int SetClientRegistrationCallback(JackClientRegistrationCallback callback
, void* arg
);
120 int SetFreewheelCallback(JackFreewheelCallback callback
, void* arg
);
121 int SetPortRegistrationCallback(JackPortRegistrationCallback callback
, void* arg
);
122 int SetPortConnectCallback(JackPortConnectCallback callback
, void *arg
);
123 int SetPortRenameCallback(JackPortRenameCallback callback
, void *arg
);
124 int SetSessionCallback(JackSessionCallback callback
, void *arg
);
125 int SetLatencyCallback(JackLatencyCallback callback
, void *arg
);
128 char* GetInternalClientName(int ref
);
129 int InternalClientHandle(const char* client_name
, jack_status_t
* status
);
130 int InternalClientLoad(const char* client_name
, jack_options_t options
, jack_status_t
* status
, jack_varargs_t
* va
);
131 void InternalClientUnload(int ref
, jack_status_t
* status
);
134 jack_session_command_t
* SessionNotify(const char* target
, jack_session_event_type_t type
, const char* path
);
135 int SessionReply(jack_session_event_t
* ev
);
136 char* GetUUIDForClientName(const char* client_name
);
137 char* GetClientNameByUUID(const char* uuid
);
138 int ReserveClientName(const char* client_name
, const char* uuid
);
139 int ClientHasSessionCallback(const char* client_name
);
141 JackClientControl
* GetClientControl() const;
142 void CheckClient(const char* function_name
) const;
144 static int TimeCallback(jack_nframes_t nframes
, void *arg
);
148 } // end of namespace