Jack2 1.9.6

JackDebugClient.h

00001 /*
00002 Copyright (C) 2004-2008 Grame
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU Lesser General Public License as published by
00006 the Free Software Foundation; either version 2.1 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU Lesser General Public License for more details.
00013 
00014 You should have received a copy of the GNU Lesser General Public License
00015 along with this program; if not, write to the Free Software 
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 
00018 */
00019 
00020 #ifndef __JackDebugClient__
00021 #define __JackDebugClient__
00022 
00023 #define MAX_PORT_HISTORY 2048
00024 
00025 #include "JackClient.h"
00026 #include <list>
00027 #include <fstream>
00028 
00029 namespace Jack
00030 {
00031 
00036 typedef struct
00037 {
00038     jack_port_id_t idport;
00039     char name[JACK_PORT_NAME_SIZE]; //portname
00040     int IsConnected;
00041     int IsUnregistered;
00042 }
00043 PortFollower;
00044 
00049 class JackDebugClient : public JackClient
00050 {
00051     protected:
00052 
00053         JackClient* fClient;
00054         std::ofstream* fStream;
00055         PortFollower fPortList[MAX_PORT_HISTORY]; // Arbitrary value... To be tuned...
00056         int fTotalPortNumber;   // The total number of port opened and maybe closed. Historical view.
00057         int fOpenPortNumber;    // The current number of opened port.
00058         int fIsActivated;
00059         int fIsDeactivated;
00060         int fIsClosed;
00061         bool fFreewheel;
00062         char fClientName[JACK_CLIENT_NAME_SIZE + 1];
00063         JackProcessCallback fProcessTimeCallback;
00064         void* fProcessTimeCallbackArg;
00065 
00066     public:
00067 
00068         JackDebugClient(JackClient* fTheClient);
00069         virtual ~JackDebugClient();
00070 
00071         virtual int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
00072         int Close();
00073 
00074         virtual JackGraphManager* GetGraphManager() const;
00075         virtual JackEngineControl* GetEngineControl() const;
00076 
00077         // Notifications
00078         int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
00079 
00080         int Activate();
00081         int Deactivate();
00082 
00083         // Context
00084         int SetBufferSize(jack_nframes_t buffer_size);
00085         int SetFreeWheel(int onoff);
00086         void ShutDown();
00087         pthread_t GetThreadID();
00088 
00089         // Port management
00090         int PortRegister(const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size);
00091         int PortUnRegister(jack_port_id_t port);
00092 
00093         int PortConnect(const char* src, const char* dst);
00094         int PortDisconnect(const char* src, const char* dst);
00095         int PortDisconnect(jack_port_id_t src);
00096 
00097         int PortIsMine(jack_port_id_t port_index);
00098 
00099         // Transport
00100         int ReleaseTimebase();
00101         int SetSyncCallback(JackSyncCallback sync_callback, void* arg);
00102         int SetSyncTimeout(jack_time_t timeout);
00103         int SetTimebaseCallback(int conditional, JackTimebaseCallback timebase_callback, void* arg);
00104         void TransportLocate(jack_nframes_t frame);
00105         jack_transport_state_t TransportQuery(jack_position_t* pos);
00106         jack_nframes_t GetCurrentTransportFrame();
00107         int TransportReposition(jack_position_t* pos);
00108         void TransportStart();
00109         void TransportStop();
00110 
00111         // Callbacks
00112         void OnShutdown(JackShutdownCallback callback, void *arg);
00113         void OnInfoShutdown(JackInfoShutdownCallback callback, void *arg);
00114         int SetProcessCallback(JackProcessCallback callback, void* arg);
00115         int SetXRunCallback(JackXRunCallback callback, void* arg);
00116         int SetInitCallback(JackThreadInitCallback callback, void* arg);
00117         int SetGraphOrderCallback(JackGraphOrderCallback callback, void* arg);
00118         int SetBufferSizeCallback(JackBufferSizeCallback callback, void* arg);
00119         int SetClientRegistrationCallback(JackClientRegistrationCallback callback, void* arg);
00120         int SetFreewheelCallback(JackFreewheelCallback callback, void* arg);
00121         int SetPortRegistrationCallback(JackPortRegistrationCallback callback, void* arg);
00122         int SetPortConnectCallback(JackPortConnectCallback callback, void *arg);
00123         int SetPortRenameCallback(JackPortRenameCallback callback, void *arg);
00124 
00125         // Internal clients
00126         char* GetInternalClientName(int ref);
00127         int InternalClientHandle(const char* client_name, jack_status_t* status);
00128         int InternalClientLoad(const char* client_name, jack_options_t options, jack_status_t* status, jack_varargs_t* va);
00129         void InternalClientUnload(int ref, jack_status_t* status);
00130 
00131         JackClientControl* GetClientControl() const;
00132         void CheckClient(const char* function_name) const;
00133 
00134         static int TimeCallback(jack_nframes_t nframes, void *arg);
00135 };
00136 
00137 
00138 } // end of namespace
00139 
00140 #endif