JackEngine.h

00001 /*
00002 Copyright (C) 2004-2006 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 __JackEngine__
00021 #define __JackEngine__
00022 
00023 #include "JackConstants.h"
00024 #include "JackGraphManager.h"
00025 #include "JackSynchro.h"
00026 #include "JackTransportEngine.h"
00027 
00028 namespace Jack
00029 {
00030 
00031 class JackClientInterface;
00032 struct JackEngineControl;
00033 class JackServerNotifyChannelInterface;
00034 class JackEngineTiming;
00035 class JackExternalClient;
00036 class JackSyncInterface;
00037 
00042 class JackEngine
00043 {
00044     private:
00045 
00046         JackGraphManager* fGraphManager;
00047         JackEngineControl* fEngineControl;
00048         JackClientInterface* fClientTable[CLIENT_NUM];
00049         JackSynchro** fSynchroTable;
00050         JackServerNotifyChannelInterface* fChannel;              
00051         JackEngineTiming* fEngineTiming;
00052         JackSyncInterface* fSignal;
00053         jack_time_t fLastSwitchUsecs;
00054 
00055         int ClientCloseAux(int refnum, JackClientInterface* client, bool wait);
00056         void CheckXRun(jack_time_t callback_usecs);
00057         int NotifyAddClient(JackClientInterface* new_client, const char* name, int refnum);
00058         void NotifyRemoveClient(const char* name, int refnum);
00059         bool IsZombie(JackClientInterface* client, jack_time_t current_time);
00060         void RemoveZombifiedClients(jack_time_t current_time);
00061         void GetZombifiedClients(bool clients[CLIENT_NUM], jack_time_t current_time);
00062 
00063     public:
00064 
00065         JackEngine(JackGraphManager* manager, JackSynchro** table, JackEngineControl* control, JackSyncInterface* signal, bool sync, long time_out_ms, bool rt, long priority, bool verbose);
00066         virtual ~JackEngine();
00067 
00068         int Open();
00069         int Close();
00070                 int Allocate();
00071 
00072         // Client management
00073         bool ClientCheckName(const char* name);
00074         int ClientNew(const char* name, int* refnum, int* shared_engine, int* shared_client, int* shared_graph_manager);
00075         int ClientExternalNew(const char* name, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager, JackExternalClient* client);
00076         int ClientInternalNew(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client);
00077 
00078         int ClientClose(int refnum);
00079         int ClientInternalClose(int refnum);
00080         int ClientInternalCloseIm(int refnum);
00081 
00082         int ClientActivate(int refnum);
00083         int ClientDeactivate(int refnum);
00084 
00085         // Port management
00086         int PortRegister(int refnum, const char* name, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index);
00087         int PortUnRegister(int refnum, jack_port_id_t port);
00088 
00089         int PortConnect(int refnum, const char* src, const char* dst);
00090         int PortDisconnect(int refnum, const char* src, const char* dst);
00091 
00092         int PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
00093         int PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
00094 
00095         // Transport management
00096         int ReleaseTimebase(int refnum);
00097         int SetTimebaseCallback(int refnum, int conditional);
00098 
00099         // Graph
00100         bool Process(jack_time_t callback_usecs);
00101         void ZombifyClient(int refnum);
00102 
00103         // Notifications
00104         void NotifyClient(int refnum, int event, int sync, int value);
00105         void NotifyClients(int event, int sync, int value);
00106         void NotifyXRun(jack_time_t callback_usecs);
00107         void NotifyXRun(int refnum);
00108         void NotifyGraphReorder();
00109         void NotifyBufferSize(jack_nframes_t nframes);
00110         void NotifyFreewheel(bool onoff);
00111         void NotifyPortRegistation(jack_port_id_t port_index, bool onoff);
00112                 void NotifyActivate(int refnum);
00113 
00114         void PrintState();
00115 };
00116 
00117 
00118 } // end of namespace
00119 
00120 #endif
00121 

Generated on Wed Jan 10 11:42:45 2007 for Jackdmp by  doxygen 1.4.5