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                 
00058         int NotifyAddClient(JackClientInterface* new_client, const char* name, int refnum);
00059         void NotifyRemoveClient(const char* name, int refnum);
00060                 
00061         bool IsZombie(JackClientInterface* client, jack_time_t current_time);
00062         void RemoveZombifiedClients(jack_time_t current_time);
00063         void GetZombifiedClients(bool clients[CLIENT_NUM], jack_time_t current_time);
00064                 
00065                 void ProcessNext(jack_time_t callback_usecs);
00066                 void ProcessCurrent(jack_time_t callback_usecs);
00067                 
00068                 bool ClientCheckName(const char* name);
00069                 bool GenerateUniqueName(char* name);
00070                 
00071                 int AllocateRefnum();
00072                 void ReleaseRefnum(int ref);
00073 
00074     public:
00075 
00076         JackEngine(JackGraphManager* manager, JackSynchro** table, JackEngineControl* controler);
00077         virtual ~JackEngine();
00078 
00079         int Open();
00080         int Close();
00081         
00082         // Client management
00083                 int ClientCheck(const char* name, char* name_res, int protocol, int options, int* status);
00084         int ClientExternalOpen(const char* name, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager);
00085         int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait);
00086 
00087         int ClientExternalClose(int refnum);
00088         int ClientInternalClose(int refnum, bool wait);
00089     
00090         int ClientActivate(int refnum);
00091         int ClientDeactivate(int refnum);
00092                 
00093                 // Internal lient management
00094                 int GetInternalClientName(int int_ref, char* name_res);
00095                 int InternalClientHandle(const char* client_name, int* status, int* int_ref);
00096                 int InternalClientUnload(int refnum, int* status);
00097 
00098         // Port management
00099         int PortRegister(int refnum, const char* name, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index);
00100         int PortUnRegister(int refnum, jack_port_id_t port);
00101 
00102         int PortConnect(int refnum, const char* src, const char* dst);
00103         int PortDisconnect(int refnum, const char* src, const char* dst);
00104 
00105         int PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
00106         int PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
00107 
00108         // Transport management
00109         int ReleaseTimebase(int refnum);
00110         int SetTimebaseCallback(int refnum, int conditional);
00111 
00112         // Graph
00113         bool Process(jack_time_t callback_usecs);
00114         void ZombifyClient(int refnum);
00115 
00116         // Notifications
00117         void NotifyClient(int refnum, int event, int sync, int value);
00118         void NotifyClients(int event, int sync, int value);
00119         void NotifyXRun(jack_time_t callback_usecs);
00120         void NotifyXRun(int refnum);
00121         void NotifyGraphReorder();
00122         void NotifyBufferSize(jack_nframes_t nframes);
00123         void NotifyFreewheel(bool onoff);
00124         void NotifyPortRegistation(jack_port_id_t port_index, bool onoff);
00125                 void NotifyActivate(int refnum);
00126 };
00127 
00128 
00129 } // end of namespace
00130 
00131 #endif
00132 

Generated on Mon Oct 15 17:11:14 2007 for Jackdmp by  doxygen 1.5.1