Use jack_client_open instead of old jack_client_new.
[jack2.git] / common / JackDebugClient.h
blob0bb21b20284c3b0311e5458bf644c903f9354ea0
1 /*
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"
26 #include <list>
27 #include <fstream>
29 namespace Jack
32 /*!
33 \brief Follow a single port.
36 typedef struct
38 jack_port_id_t idport;
39 char name[JACK_PORT_NAME_SIZE]; //portname
40 int IsConnected;
41 int IsUnregistrated;
43 PortFollower;
45 /*!
46 \brief A "decorator" debug client to validate API use.
49 class JackDebugClient : public JackClient
51 protected:
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;
66 public:
68 JackDebugClient(JackClient* fTheClient);
69 virtual ~JackDebugClient();
71 virtual int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
72 int Close();
74 virtual JackGraphManager* GetGraphManager() const;
75 virtual JackEngineControl* GetEngineControl() const;
77 // Notifications
78 int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
80 int Activate();
81 int Deactivate();
83 // Context
84 int SetBufferSize(jack_nframes_t buffer_size);
85 int SetFreeWheel(int onoff);
86 void ShutDown();
87 pthread_t GetThreadID();
89 // Port management
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);
99 // Transport
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();
111 // Callbacks
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);
125 // Internal clients
126 char* GetInternalClientName(int ref);
127 int InternalClientHandle(const char* client_name, jack_status_t* status);
128 int InternalClientLoad(const char* client_name, jack_options_t options, jack_status_t* status, jack_varargs_t* va);
129 void InternalClientUnload(int ref, jack_status_t* status);
131 JackClientControl* GetClientControl() const;
132 void CheckClient() const;
134 static int TimeCallback(jack_nframes_t nframes, void *arg);
138 } // end of namespace
140 #endif