00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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 JackExternalClient;
00035 class JackSyncInterface;
00036
00041 class JackEngine
00042 {
00043 private:
00044
00045 JackGraphManager* fGraphManager;
00046 JackEngineControl* fEngineControl;
00047 JackClientInterface* fClientTable[CLIENT_NUM];
00048 JackSynchro** fSynchroTable;
00049 JackServerNotifyChannelInterface* fChannel;
00050 JackSyncInterface* fSignal;
00051 jack_time_t fLastSwitchUsecs;
00052
00053 int ClientCloseAux(int refnum, JackClientInterface* client, bool wait);
00054 void CheckXRun(jack_time_t callback_usecs);
00055
00056 int NotifyAddClient(JackClientInterface* new_client, const char* name, int refnum);
00057 void NotifyRemoveClient(const char* name, int refnum);
00058
00059 void ProcessNext(jack_time_t callback_usecs);
00060 void ProcessCurrent(jack_time_t callback_usecs);
00061
00062 bool ClientCheckName(const char* name);
00063 bool GenerateUniqueName(char* name);
00064
00065 int AllocateRefnum();
00066 void ReleaseRefnum(int ref);
00067
00068 void NotifyClient(int refnum, int event, int sync, int value1, int value2);
00069 void NotifyClients(int event, int sync, int value1, int value2);
00070
00071 public:
00072
00073 JackEngine(JackGraphManager* manager, JackSynchro** table, JackEngineControl* controler);
00074 virtual ~JackEngine();
00075
00076 int Open();
00077 int Close();
00078
00079
00080 int ClientCheck(const char* name, char* name_res, int protocol, int options, int* status);
00081 int ClientExternalOpen(const char* name, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager);
00082 int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait);
00083
00084 int ClientExternalClose(int refnum);
00085 int ClientInternalClose(int refnum, bool wait);
00086
00087 int ClientActivate(int refnum);
00088 int ClientDeactivate(int refnum);
00089
00090
00091 int GetInternalClientName(int int_ref, char* name_res);
00092 int InternalClientHandle(const char* client_name, int* status, int* int_ref);
00093 int InternalClientUnload(int refnum, int* status);
00094
00095
00096 int PortRegister(int refnum, const char* name, const char *type, unsigned int flags, unsigned int buffer_size, unsigned int* port_index);
00097 int PortUnRegister(int refnum, jack_port_id_t port);
00098
00099 int PortConnect(int refnum, const char* src, const char* dst);
00100 int PortDisconnect(int refnum, const char* src, const char* dst);
00101
00102 int PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
00103 int PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
00104
00105
00106 bool Process(jack_time_t callback_usecs);
00107
00108
00109 void NotifyXRun(jack_time_t callback_usecs);
00110 void NotifyXRun(int refnum);
00111 void NotifyGraphReorder();
00112 void NotifyBufferSize(jack_nframes_t nframes);
00113 void NotifyFreewheel(bool onoff);
00114 void NotifyPortRegistation(jack_port_id_t port_index, bool onoff);
00115 void NotifyPortConnect(jack_port_id_t src, jack_port_id_t dst, bool onoff);
00116 void NotifyActivate(int refnum);
00117 };
00118
00119
00120 }
00121
00122 #endif
00123