Jack2  1.9.8
JackServer.h
1 /*
2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2008 Grame
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19 */
20 
21 #ifndef __JackServer__
22 #define __JackServer__
23 
24 #include "JackCompilerDeps.h"
25 #include "driver_interface.h"
26 #include "JackDriverLoader.h"
27 #include "JackConnectionManager.h"
28 #include "JackGlobals.h"
29 #include "JackPlatformPlug.h"
30 #include "jslist.h"
31 
32 namespace Jack
33 {
34 
35 class JackGraphManager;
36 class JackDriverClientInterface;
37 struct JackEngineControl;
38 class JackLockedEngine;
39 class JackLoadableInternalClient;
40 
45 class SERVER_EXPORT JackServer
46 {
47 
48  private:
49 
50  JackDriverInfo* fDriverInfo;
51  JackDriverClientInterface* fAudioDriver;
52  JackDriverClientInterface* fFreewheelDriver;
53  JackDriverClientInterface* fThreadedFreewheelDriver;
54  JackLockedEngine* fEngine;
55  JackEngineControl* fEngineControl;
56  JackGraphManager* fGraphManager;
57  JackServerChannel fChannel;
58  JackConnectionManager fConnectionState;
59  JackSynchro fSynchroTable[CLIENT_NUM];
60  bool fFreewheel;
61 
62  int InternalClientLoadAux(JackLoadableInternalClient* client, const char* so_name, const char* client_name, int options, int* int_ref, int uuid, int* status);
63 
64  public:
65 
66  JackServer(bool sync, bool temporary, int timeout, bool rt, int priority, int port_max, bool verbose, jack_timer_type_t clock, const char* server_name);
67  ~JackServer();
68 
69  int Open(jack_driver_desc_t* driver_desc, JSList* driver_params);
70  int Close();
71 
72  int Start();
73  int Stop();
74  bool IsRunning();
75 
76  // RT thread
77  void Notify(int refnum, int notify, int value);
78 
79  // Command thread : API
80  int SetBufferSize(jack_nframes_t buffer_size);
81  int SetFreewheel(bool onoff);
82  int InternalClientLoad1(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int uuid, int* status);
83  int InternalClientLoad2(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int uuid, int* status);
84  void ClientKill(int refnum);
85 
86  // Transport management
87  int ReleaseTimebase(int refnum);
88  int SetTimebaseCallback(int refnum, int conditional);
89 
90  // Backend management
91  JackDriverInfo* AddSlave(jack_driver_desc_t* driver_desc, JSList* driver_params);
92  void RemoveSlave(JackDriverInfo* info);
93  int SwitchMaster(jack_driver_desc_t* driver_desc, JSList* driver_params);
94 
95  // Object access
96  JackLockedEngine* GetEngine();
97  JackEngineControl* GetEngineControl();
98  JackSynchro* GetSynchroTable();
99  JackGraphManager* GetGraphManager();
100 
101 };
102 
103 } // end of namespace
104 
105 
106 #endif