summaryrefslogtreecommitdiff
path: root/common/JackChannel.h
blob: 4036aede346d7bc2384824b8f6e05ef4688135c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/*
Copyright (C) 2004-2006 Grame  

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 __JackChannel__
#define __JackChannel__

#include "types.h"
#include "JackError.h"
#include "JackTransportEngine.h"

namespace Jack
{

class JackClientInterface;
class JackClient;
class JackServer;
struct JackEngineControl;
class JackGraphManager;

/*!
\brief Inter process channel for server/client bidirectionnal communication : request and (receiving) notifications.
*/

class JackClientChannelInterface
{

    public:

        JackClientChannelInterface()
        {}
        virtual ~JackClientChannelInterface()
        {}

        // Open the Server/Client connection
        virtual int Open(const char* name, JackClient* obj)
        {
            return 0;
        }

        // Close the Server/Client connection
        virtual void Close()
        {}

        // Start listening for messages from the server
        virtual int Start()
        {
            return 0;
        }

        // Stop listening for messages from the server
        virtual void Stop()
        {}

        virtual void ClientNew(const char* name, int* shared_engine, int* shared_client, int* shared_ports, int* result)
        {}
        virtual void ClientNew(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
        {}
        virtual void ClientClose(int refnum, int* result)
        {}

        virtual void ClientActivate(int refnum, int* result)
        {}
        virtual void ClientDeactivate(int refnum, int* result)
        {}

        virtual void PortRegister(int refnum, const char* name, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result)
        {}
        virtual void PortUnRegister(int refnum, jack_port_id_t port_index, int* result)
        {}

        virtual void PortConnect(int refnum, const char* src, const char* dst, int* result)
        {}
        virtual void PortDisconnect(int refnum, const char* src, const char* dst, int* result)
        {}
        virtual void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
        {}
        virtual void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
        {}

        virtual void SetBufferSize(jack_nframes_t nframes, int* result)
        {}
        virtual void SetFreewheel(int onoff, int* result)
        {}

        virtual void ReleaseTimebase(int refnum, int* result)
        {}

        virtual void SetTimebaseCallback(int refnum, int conditional, int* result)
        {}

};

/*!
\brief Inter process channel for server to client notifications.
*/

class JackNotifyChannelInterface
{

    public:

        JackNotifyChannelInterface()
        {}
        virtual ~JackNotifyChannelInterface()
        {}

        // Open the Server/Client connection
        virtual int Open(const char* name)
        {
            return 0;
        }
        // Close the Server/Client connection
        virtual void Close()
        {}

        /*
        The "sync" parameter allows to choose between "synchronous" and "asynchronous" notification
        */
        virtual void ClientNotify(int refnum, const char* name, int notify, int sync, int value, int* result)
        {}

        typedef enum {
            kAddClient = 0,
            kRemoveClient = 1,
            kXRunCallback = 2,
            kGraphOrderCallback = 3,
            kBufferSizeCallback = 4,
            kStartFreewheel = 5,
            kStopFreewheel = 6,
            kPortRegistrationOn = 7,
            kPortRegistrationOff = 8,
            kZombifyClient = 9,
            kDeadClient = 10
    } NotificationType;

};

/*!
\brief Entry point channel for client/server communication.
*/

class JackServerChannelInterface
{

    public:

        JackServerChannelInterface()
        {}
        virtual ~JackServerChannelInterface()
        {}

        // Open the Server/Client connection
        virtual int Open(JackServer* server)
        {
            return 0;
        }
        // Close the Server/Client connection
        virtual void Close()
        {}
};

/*!
\brief Channel for server RT thread to request server thread communication.
*/

class JackServerNotifyChannelInterface
{

    public:

        JackServerNotifyChannelInterface()
        {}
        virtual ~JackServerNotifyChannelInterface()
        {}

        // Open the Server RT/Server connection
        virtual int Open()
        {
            return 0;
        }
        // Close the Server RT/Server connection
        virtual void Close()
        {}

        virtual void ClientNotify(int refnum, int notify, int value)
        {}

};


} // end of namespace

#endif