2 Copyright (C) 2004-2006 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __JackEngine__
21 #define __JackEngine__
23 #include "JackConstants.h"
24 #include "JackGraphManager.h"
25 #include "JackSynchro.h"
26 #include "JackTransportEngine.h"
31 class JackClientInterface
;
32 struct JackEngineControl
;
33 class JackServerNotifyChannelInterface
;
34 class JackEngineTiming
;
35 class JackExternalClient
;
36 class JackSyncInterface
;
39 \brief Engine description.
46 JackGraphManager
* fGraphManager
;
47 JackEngineControl
* fEngineControl
;
48 JackClientInterface
* fClientTable
[CLIENT_NUM
];
49 JackSynchro
** fSynchroTable
;
50 JackServerNotifyChannelInterface
* fChannel
; /*! To communicate between the RT thread and server */
51 JackEngineTiming
* fEngineTiming
;
52 JackSyncInterface
* fSignal
;
53 jack_time_t fLastSwitchUsecs
;
55 int ClientCloseAux(int refnum
, JackClientInterface
* client
, bool wait
);
56 void CheckXRun(jack_time_t callback_usecs
);
57 int NotifyAddClient(JackClientInterface
* new_client
, const char* name
, int refnum
);
58 void NotifyRemoveClient(const char* name
, int refnum
);
59 bool IsZombie(JackClientInterface
* client
, jack_time_t current_time
);
60 void RemoveZombifiedClients(jack_time_t current_time
);
61 void GetZombifiedClients(bool clients
[CLIENT_NUM
], jack_time_t current_time
);
62 void ProcessNext(jack_time_t callback_usecs
);
63 void ProcessCurrent(jack_time_t callback_usecs
);
64 bool ClientCheckName(const char* name
);
69 JackEngine(JackGraphManager
* manager
, JackSynchro
** table
, JackEngineControl
* controler
);
70 virtual ~JackEngine();
77 int ClientExternalOpen(const char* name
, int* ref
, int* shared_engine
, int* shared_client
, int* shared_graph_manager
);
78 int ClientInternalOpen(const char* name
, int* ref
, JackEngineControl
** shared_engine
, JackGraphManager
** shared_manager
, JackClientInterface
* client
);
80 int ClientExternalClose(int refnum
);
81 int ClientInternalClose(int refnum
);
82 int ClientInternalCloseIm(int refnum
);
84 int ClientActivate(int refnum
);
85 int ClientDeactivate(int refnum
);
88 int PortRegister(int refnum
, const char* name
, unsigned int flags
, unsigned int buffer_size
, jack_port_id_t
* port_index
);
89 int PortUnRegister(int refnum
, jack_port_id_t port
);
91 int PortConnect(int refnum
, const char* src
, const char* dst
);
92 int PortDisconnect(int refnum
, const char* src
, const char* dst
);
94 int PortConnect(int refnum
, jack_port_id_t src
, jack_port_id_t dst
);
95 int PortDisconnect(int refnum
, jack_port_id_t src
, jack_port_id_t dst
);
97 // Transport management
98 int ReleaseTimebase(int refnum
);
99 int SetTimebaseCallback(int refnum
, int conditional
);
102 bool Process(jack_time_t callback_usecs
);
103 void ZombifyClient(int refnum
);
106 void NotifyClient(int refnum
, int event
, int sync
, int value
);
107 void NotifyClients(int event
, int sync
, int value
);
108 void NotifyXRun(jack_time_t callback_usecs
);
109 void NotifyXRun(int refnum
);
110 void NotifyGraphReorder();
111 void NotifyBufferSize(jack_nframes_t nframes
);
112 void NotifyFreewheel(bool onoff
);
113 void NotifyPortRegistation(jack_port_id_t port_index
, bool onoff
);
114 void NotifyActivate(int refnum
);
120 } // end of namespace