JackServer.h 3.21 KB
Newer Older
sletz's avatar
sletz committed
1
/*
sletz's avatar
sletz committed
2
Copyright (C) 2001 Paul Davis
sletz's avatar
sletz committed
3
Copyright (C) 2004-2008 Grame
sletz's avatar
sletz committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef __JackServer__
#define __JackServer__

24
#include "JackCompilerDeps.h"
sletz's avatar
sletz committed
25
26
#include "driver_interface.h"
#include "JackDriverLoader.h"
sletz's avatar
Cleanup    
sletz committed
27
#include "JackConnectionManager.h"
28
#include "JackGlobals.h"
29
#include "JackPlatformPlug.h"
30
#include "jslist.h"
31

sletz's avatar
sletz committed
32
33
34
35
36
37
namespace Jack
{

class JackGraphManager;
class JackDriverClientInterface;
struct JackEngineControl;
sletz's avatar
sletz committed
38
class JackLockedEngine;
39
class JackLoadableInternalClient;
sletz's avatar
sletz committed
40
41
42
43
44

/*!
\brief The Jack server.
*/

45
class SERVER_EXPORT JackServer
sletz's avatar
sletz committed
46
47
48
49
{

    private:

50
        JackDriverInfo* fDriverInfo;
sletz's avatar
sletz committed
51
52
        JackDriverClientInterface* fAudioDriver;
        JackDriverClientInterface* fFreewheelDriver;
sletz's avatar
sletz committed
53
        JackLockedEngine* fEngine;
sletz's avatar
sletz committed
54
55
        JackEngineControl* fEngineControl;
        JackGraphManager* fGraphManager;
56
        JackServerChannel fChannel;
57
        JackConnectionManager fConnectionState;
58
        JackSynchro fSynchroTable[CLIENT_NUM];
sletz's avatar
sletz committed
59
        bool fFreewheel;
60
        
sletz's avatar
sletz committed
61
        int InternalClientLoadAux(JackLoadableInternalClient* client, const char* so_name, const char* client_name, int options, int* int_ref, int* status);
sletz's avatar
sletz committed
62
63
64

    public:

sletz's avatar
sletz committed
65
        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);
66
        ~JackServer();
sletz's avatar
sletz committed
67
68

        int Open(jack_driver_desc_t* driver_desc, JSList* driver_params);
sletz's avatar
sletz committed
69
        int Close();
sletz's avatar
sletz committed
70
71
72
73

        int Start();
        int Stop();

sletz's avatar
Cleanup    
sletz committed
74
        // RT thread
sletz's avatar
sletz committed
75
        void Notify(int refnum, int notify, int value);
sletz's avatar
sletz committed
76

sletz's avatar
Cleanup    
sletz committed
77
78
79
        // Command thread : API
        int SetBufferSize(jack_nframes_t buffer_size);
        int SetFreewheel(bool onoff);
sletz's avatar
sletz committed
80
        int InternalClientLoad(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int* status);
81
        int InternalClientLoad(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int* status);
82
        void ClientKill(int refnum);
sletz's avatar
sletz committed
83
84

        // Transport management
85
86
        int ReleaseTimebase(int refnum);
        int SetTimebaseCallback(int refnum, int conditional);
87
88
89
90
        
        // Backend management
        JackDriverInfo* AddSlave(jack_driver_desc_t* driver_desc, JSList* driver_params);
        void RemoveSlave(JackDriverInfo* info);
91
92
        int SwitchMaster(jack_driver_desc_t* driver_desc, JSList* driver_params);
 
sletz's avatar
sletz committed
93
        // Object access
sletz's avatar
sletz committed
94
        JackLockedEngine* GetEngine();
sletz's avatar
sletz committed
95
        JackEngineControl* GetEngineControl();
96
        JackSynchro* GetSynchroTable();
sletz's avatar
sletz committed
97
98
99
100
101
102
103
104
        JackGraphManager* GetGraphManager();

};

} // end of namespace


#endif