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 General Public License as published by
00006 the Free Software Foundation; either version 2 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 General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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 IsUnregistrated;
00042 }
00043 PortFollower;
00044 
00049 class JackDebugClient : public JackClient
00050 {
00051     private:
00052 
00053         JackClient* fClient;
00054         std::ofstream* fStream;
00055 
00056     protected:
00057         
00058         PortFollower fPortList[MAX_PORT_HISTORY]; // Arbitrary value... To be tuned...
00059         int fTotalPortNumber;   // The total number of port opened and maybe closed. Historical view.
00060         int fOpenPortNumber;    // The current number of opened port.
00061         int fIsActivated;
00062         int fIsDeactivated;
00063         int fIsClosed;
00064         char fClientName[JACK_CLIENT_NAME_SIZE];
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, 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 PortConnect(jack_port_id_t src, jack_port_id_t dst);
00096         int PortDisconnect(jack_port_id_t src);
00097 
00098         int PortIsMine(jack_port_id_t port_index);
00099 
00100         // Transport
00101         int ReleaseTimebase();
00102         int SetSyncCallback(JackSyncCallback sync_callback, void* arg);
00103         int SetSyncTimeout(jack_time_t timeout);
00104         int SetTimebaseCallback(int conditional, JackTimebaseCallback timebase_callback, void* arg);
00105         int TransportLocate(jack_nframes_t frame);
00106         jack_transport_state_t TransportQuery(jack_position_t* pos);
00107         jack_nframes_t GetCurrentTransportFrame();
00108         int TransportReposition(jack_position_t* pos);
00109         void TransportStart();
00110         void TransportStop();
00111 
00112         // Callbacks
00113         void OnShutdown(JackShutdownCallback 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                 
00124                 // Internal clients
00125                 char* GetInternalClientName(int ref);
00126                 int InternalClientHandle(const char* client_name, jack_status_t* status);
00127                 int InternalClientLoad(const char* client_name, jack_options_t options, jack_status_t* status, jack_varargs_t* va);
00128                 void InternalClientUnload(int ref, jack_status_t* status);
00129                 
00130                 // Fons Adriaensen thread model
00131                 jack_nframes_t Wait(int status);
00132                 
00133         JackClientControl* GetClientControl() const;
00134                 
00135                 void CheckClient() const;
00136 
00137 };
00138 
00139 
00140 } // end of namespace
00141 
00142 #endif

Generated on Thu Feb 14 11:16:01 2008 for Jackdmp by  doxygen 1.5.1