~ubuntu-branches/ubuntu/oneiric/oss4/oneiric-proposed

« back to all changes in this revision

Viewing changes to debian/include-alsa/alsa/seq.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Rivera
  • Date: 2011-06-16 20:37:48 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110616203748-jbrxik6ql33z54co
Tags: 4.2-build2004-1ubuntu1
* Merge from Debian unstable.
  - Supports our current kernel (LP: #746048)
  Remaining changes:
  - debian/oss4-dkms.dkms.in: s/source/build/ in Kernel headers paths.
* ld-as-needed.patch: Re-order CC arguments to enable building with ld
  --as-needed (LP: #770972)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * \file <alsa/seq.h>
 
3
 * \brief Application interface library for the ALSA driver
 
4
 * \author Jaroslav Kysela <perex@suse.cz>
 
5
 * \author Abramo Bagnara <abramo@alsa-project.org>
 
6
 * \author Takashi Iwai <tiwai@suse.de>
 
7
 * \date 1998-2001
 
8
 */
 
9
/*
 
10
 * Application interface library for the ALSA driver
 
11
 *
 
12
 *
 
13
 *   This library is free software; you can redistribute it and/or modify
 
14
 *   it under the terms of the GNU Lesser General Public License as
 
15
 *   published by the Free Software Foundation; either version 2.1 of
 
16
 *   the License, or (at your option) any later version.
 
17
 *
 
18
 *   This program is distributed in the hope that it will be useful,
 
19
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
 *   GNU Lesser General Public License for more details.
 
22
 *
 
23
 *   You should have received a copy of the GNU Lesser General Public
 
24
 *   License along with this library; if not, write to the Free Software
 
25
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
26
 *
 
27
 */
 
28
 
 
29
#ifndef __ALSA_SEQ_H
 
30
#define __ALSA_SEQ_H
 
31
 
 
32
#ifdef __cplusplus
 
33
extern "C" {
 
34
#endif
 
35
 
 
36
/**
 
37
 *  \defgroup Sequencer MIDI Sequencer
 
38
 *  MIDI Sequencer Interface.
 
39
 *  See \ref seq page for more details.
 
40
 *  \{
 
41
 */
 
42
 
 
43
/** dlsym version for interface entry callback */
 
44
#define SND_SEQ_DLSYM_VERSION           _dlsym_seq_001
 
45
 
 
46
/** Sequencer handle */
 
47
typedef struct _snd_seq snd_seq_t;
 
48
 
 
49
#ifndef DOC_HIDDEN
 
50
#define SND_ALLOCA(type,ptr) \
 
51
do {\
 
52
        assert(ptr);\
 
53
        *ptr = (type##_t *)alloca(type##_sizeof());\
 
54
        memset(*ptr, 0, type##_sizeof());\
 
55
} while (0)
 
56
#endif
 
57
 
 
58
/**
 
59
 * sequencer opening stream types
 
60
 */
 
61
#define SND_SEQ_OPEN_OUTPUT     1       /**< open for output (write) */
 
62
#define SND_SEQ_OPEN_INPUT      2       /**< open for input (read) */
 
63
#define SND_SEQ_OPEN_DUPLEX     (SND_SEQ_OPEN_OUTPUT|SND_SEQ_OPEN_INPUT)        /**< open for both input and output (read/write) */
 
64
 
 
65
/**
 
66
 * sequencer opening mode
 
67
 */
 
68
#define SND_SEQ_NONBLOCK        0x0001  /**< non-blocking mode (flag to open mode) */
 
69
 
 
70
/** sequencer handle type */
 
71
typedef enum _snd_seq_type {
 
72
        SND_SEQ_TYPE_HW,                /**< hardware */
 
73
        SND_SEQ_TYPE_SHM,               /**< shared memory (NYI) */
 
74
        SND_SEQ_TYPE_INET               /**< network (NYI) */
 
75
} snd_seq_type_t;
 
76
 
 
77
/** special client (port) ids */
 
78
#define SND_SEQ_ADDRESS_UNKNOWN         253     /**< unknown source */
 
79
#define SND_SEQ_ADDRESS_SUBSCRIBERS     254     /**< send event to all subscribed ports */
 
80
#define SND_SEQ_ADDRESS_BROADCAST       255     /**< send event to all queues/clients/ports/channels */
 
81
 
 
82
/** known client numbers */
 
83
#define SND_SEQ_CLIENT_SYSTEM           0       /**< system client */
 
84
#define SND_SEQ_CLIENT_DUMMY            62      /**< dummy ports */
 
85
#define SND_SEQ_CLIENT_OSS              63      /**< OSS sequencer emulator */
 
86
 
 
87
/*
 
88
 */
 
89
int snd_seq_open(snd_seq_t **handle, const char *name, int streams, int mode);
 
90
int snd_seq_open_lconf(snd_seq_t **handle, const char *name, int streams, int mode, snd_config_t *lconf);
 
91
const char *snd_seq_name(snd_seq_t *seq);
 
92
snd_seq_type_t snd_seq_type(snd_seq_t *seq);
 
93
int snd_seq_close(snd_seq_t *handle);
 
94
int snd_seq_poll_descriptors_count(snd_seq_t *handle, short events);
 
95
int snd_seq_poll_descriptors(snd_seq_t *handle, struct pollfd *pfds, unsigned int space, short events);
 
96
int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
 
97
int snd_seq_nonblock(snd_seq_t *handle, int nonblock);
 
98
int snd_seq_client_id(snd_seq_t *handle);
 
99
 
 
100
size_t snd_seq_get_output_buffer_size(snd_seq_t *handle);
 
101
size_t snd_seq_get_input_buffer_size(snd_seq_t *handle);
 
102
int snd_seq_set_output_buffer_size(snd_seq_t *handle, size_t size);
 
103
int snd_seq_set_input_buffer_size(snd_seq_t *handle, size_t size);
 
104
 
 
105
/** system information container */
 
106
typedef struct _snd_seq_system_info snd_seq_system_info_t;
 
107
 
 
108
size_t snd_seq_system_info_sizeof(void);
 
109
/** allocate a #snd_seq_system_info_t container on stack */
 
110
#define snd_seq_system_info_alloca(ptr) \
 
111
        SND_ALLOCA(snd_seq_system_info, ptr)
 
112
int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr);
 
113
void snd_seq_system_info_free(snd_seq_system_info_t *ptr);
 
114
void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src);
 
115
 
 
116
int snd_seq_system_info_get_queues(const snd_seq_system_info_t *info);
 
117
int snd_seq_system_info_get_clients(const snd_seq_system_info_t *info);
 
118
int snd_seq_system_info_get_ports(const snd_seq_system_info_t *info);
 
119
int snd_seq_system_info_get_channels(const snd_seq_system_info_t *info);
 
120
int snd_seq_system_info_get_cur_clients(const snd_seq_system_info_t *info);
 
121
int snd_seq_system_info_get_cur_queues(const snd_seq_system_info_t *info);
 
122
 
 
123
int snd_seq_system_info(snd_seq_t *handle, snd_seq_system_info_t *info);
 
124
 
 
125
/** \} */
 
126
 
 
127
 
 
128
/**
 
129
 *  \defgroup SeqClient Sequencer Client Interface
 
130
 *  Sequencer Client Interface
 
131
 *  \ingroup Sequencer
 
132
 *  \{
 
133
 */
 
134
 
 
135
/** client information container */
 
136
typedef struct _snd_seq_client_info snd_seq_client_info_t;
 
137
 
 
138
/** client types */
 
139
typedef enum snd_seq_client_type {
 
140
        SND_SEQ_USER_CLIENT     = 1,    /**< user client */
 
141
        SND_SEQ_KERNEL_CLIENT   = 2     /**< kernel client */
 
142
} snd_seq_client_type_t;
 
143
                        
 
144
size_t snd_seq_client_info_sizeof(void);
 
145
/** allocate a #snd_seq_client_info_t container on stack */
 
146
#define snd_seq_client_info_alloca(ptr) \
 
147
        SND_ALLOCA(snd_seq_client_info, ptr)
 
148
int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr);
 
149
void snd_seq_client_info_free(snd_seq_client_info_t *ptr);
 
150
void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src);
 
151
 
 
152
int snd_seq_client_info_get_client(const snd_seq_client_info_t *info);
 
153
snd_seq_client_type_t snd_seq_client_info_get_type(const snd_seq_client_info_t *info);
 
154
const char *snd_seq_client_info_get_name(snd_seq_client_info_t *info);
 
155
int snd_seq_client_info_get_broadcast_filter(const snd_seq_client_info_t *info);
 
156
int snd_seq_client_info_get_error_bounce(const snd_seq_client_info_t *info);
 
157
const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_info_t *info);
 
158
int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info);
 
159
int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);
 
160
 
 
161
void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client);
 
162
void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name);
 
163
void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int val);
 
164
void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);
 
165
void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);
 
166
 
 
167
int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
 
168
int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);
 
169
int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
 
170
int snd_seq_query_next_client(snd_seq_t *handle, snd_seq_client_info_t *info);
 
171
 
 
172
/*
 
173
 */
 
174
 
 
175
/** client pool information container */
 
176
typedef struct _snd_seq_client_pool snd_seq_client_pool_t;
 
177
 
 
178
size_t snd_seq_client_pool_sizeof(void);
 
179
/** allocate a #snd_seq_client_pool_t container on stack */
 
180
#define snd_seq_client_pool_alloca(ptr) \
 
181
        SND_ALLOCA(snd_seq_client_pool, ptr)
 
182
int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr);
 
183
void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr);
 
184
void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src);
 
185
 
 
186
int snd_seq_client_pool_get_client(const snd_seq_client_pool_t *info);
 
187
size_t snd_seq_client_pool_get_output_pool(const snd_seq_client_pool_t *info);
 
188
size_t snd_seq_client_pool_get_input_pool(const snd_seq_client_pool_t *info);
 
189
size_t snd_seq_client_pool_get_output_room(const snd_seq_client_pool_t *info);
 
190
size_t snd_seq_client_pool_get_output_free(const snd_seq_client_pool_t *info);
 
191
size_t snd_seq_client_pool_get_input_free(const snd_seq_client_pool_t *info);
 
192
void snd_seq_client_pool_set_output_pool(snd_seq_client_pool_t *info, size_t size);
 
193
void snd_seq_client_pool_set_input_pool(snd_seq_client_pool_t *info, size_t size);
 
194
void snd_seq_client_pool_set_output_room(snd_seq_client_pool_t *info, size_t size);
 
195
 
 
196
int snd_seq_get_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
 
197
int snd_seq_set_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
 
198
 
 
199
 
 
200
/** \} */
 
201
 
 
202
 
 
203
/**
 
204
 *  \defgroup SeqPort Sequencer Port Interface
 
205
 *  Sequencer Port Interface
 
206
 *  \ingroup Sequencer
 
207
 *  \{
 
208
 */
 
209
 
 
210
/** port information container */
 
211
typedef struct _snd_seq_port_info snd_seq_port_info_t;
 
212
 
 
213
/** known port numbers */
 
214
#define SND_SEQ_PORT_SYSTEM_TIMER       0       /**< system timer port */
 
215
#define SND_SEQ_PORT_SYSTEM_ANNOUNCE    1       /**< system announce port */
 
216
 
 
217
/** port capabilities (32 bits) */
 
218
#define SND_SEQ_PORT_CAP_READ           (1<<0)  /**< readable from this port */
 
219
#define SND_SEQ_PORT_CAP_WRITE          (1<<1)  /**< writable to this port */
 
220
 
 
221
#define SND_SEQ_PORT_CAP_SYNC_READ      (1<<2)  /**< allow read subscriptions */
 
222
#define SND_SEQ_PORT_CAP_SYNC_WRITE     (1<<3)  /**< allow write subscriptions */
 
223
 
 
224
#define SND_SEQ_PORT_CAP_DUPLEX         (1<<4)  /**< allow read/write duplex */
 
225
 
 
226
#define SND_SEQ_PORT_CAP_SUBS_READ      (1<<5)  /**< allow read subscription */
 
227
#define SND_SEQ_PORT_CAP_SUBS_WRITE     (1<<6)  /**< allow write subscription */
 
228
#define SND_SEQ_PORT_CAP_NO_EXPORT      (1<<7)  /**< routing not allowed */
 
229
 
 
230
/** port type */
 
231
#define SND_SEQ_PORT_TYPE_SPECIFIC      (1<<0)  /**< hardware specific */
 
232
#define SND_SEQ_PORT_TYPE_MIDI_GENERIC  (1<<1)  /**< generic MIDI device */
 
233
#define SND_SEQ_PORT_TYPE_MIDI_GM       (1<<2)  /**< General MIDI compatible device */
 
234
#define SND_SEQ_PORT_TYPE_MIDI_GS       (1<<3)  /**< GS compatible device */
 
235
#define SND_SEQ_PORT_TYPE_MIDI_XG       (1<<4)  /**< XG compatible device */
 
236
#define SND_SEQ_PORT_TYPE_MIDI_MT32     (1<<5)  /**< MT-32 compatible device */
 
237
#define SND_SEQ_PORT_TYPE_SYNTH         (1<<10) /**< Synth device */
 
238
#define SND_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /**< Sampling device (support sample download) */
 
239
#define SND_SEQ_PORT_TYPE_SAMPLE        (1<<12) /**< Sampling device (sample can be downloaded at any time) */
 
240
#define SND_SEQ_PORT_TYPE_APPLICATION   (1<<20) /**< application (sequencer/editor) */
 
241
 
 
242
 
 
243
size_t snd_seq_port_info_sizeof(void);
 
244
/** allocate a #snd_seq_port_info_t container on stack */
 
245
#define snd_seq_port_info_alloca(ptr) \
 
246
        SND_ALLOCA(snd_seq_port_info, ptr)
 
247
int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr);
 
248
void snd_seq_port_info_free(snd_seq_port_info_t *ptr);
 
249
void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src);
 
250
 
 
251
int snd_seq_port_info_get_client(const snd_seq_port_info_t *info);
 
252
int snd_seq_port_info_get_port(const snd_seq_port_info_t *info);
 
253
const snd_seq_addr_t *snd_seq_port_info_get_addr(const snd_seq_port_info_t *info);
 
254
const char *snd_seq_port_info_get_name(const snd_seq_port_info_t *info);
 
255
unsigned int snd_seq_port_info_get_capability(const snd_seq_port_info_t *info);
 
256
unsigned int snd_seq_port_info_get_type(const snd_seq_port_info_t *info);
 
257
int snd_seq_port_info_get_midi_channels(const snd_seq_port_info_t *info);
 
258
int snd_seq_port_info_get_midi_voices(const snd_seq_port_info_t *info);
 
259
int snd_seq_port_info_get_synth_voices(const snd_seq_port_info_t *info);
 
260
int snd_seq_port_info_get_read_use(const snd_seq_port_info_t *info);
 
261
int snd_seq_port_info_get_write_use(const snd_seq_port_info_t *info);
 
262
int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info);
 
263
int snd_seq_port_info_get_timestamping(const snd_seq_port_info_t *info);
 
264
int snd_seq_port_info_get_timestamp_real(const snd_seq_port_info_t *info);
 
265
int snd_seq_port_info_get_timestamp_queue(const snd_seq_port_info_t *info);
 
266
 
 
267
void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client);
 
268
void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port);
 
269
void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t *addr);
 
270
void snd_seq_port_info_set_name(snd_seq_port_info_t *info, const char *name);
 
271
void snd_seq_port_info_set_capability(snd_seq_port_info_t *info, unsigned int capability);
 
272
void snd_seq_port_info_set_type(snd_seq_port_info_t *info, unsigned int type);
 
273
void snd_seq_port_info_set_midi_channels(snd_seq_port_info_t *info, int channels);
 
274
void snd_seq_port_info_set_midi_voices(snd_seq_port_info_t *info, int voices);
 
275
void snd_seq_port_info_set_synth_voices(snd_seq_port_info_t *info, int voices);
 
276
void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val);
 
277
void snd_seq_port_info_set_timestamping(snd_seq_port_info_t *info, int enable);
 
278
void snd_seq_port_info_set_timestamp_real(snd_seq_port_info_t *info, int realtime);
 
279
void snd_seq_port_info_set_timestamp_queue(snd_seq_port_info_t *info, int queue);
 
280
 
 
281
int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);
 
282
int snd_seq_delete_port(snd_seq_t *handle, int port);
 
283
int snd_seq_get_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
 
284
int snd_seq_get_any_port_info(snd_seq_t *handle, int client, int port, snd_seq_port_info_t *info);
 
285
int snd_seq_set_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
 
286
int snd_seq_query_next_port(snd_seq_t *handle, snd_seq_port_info_t *info);
 
287
 
 
288
/** \} */
 
289
 
 
290
 
 
291
/**
 
292
 *  \defgroup SeqSubscribe Sequencer Port Subscription
 
293
 *  Sequencer Port Subscription
 
294
 *  \ingroup Sequencer
 
295
 *  \{
 
296
 */
 
297
 
 
298
/** port subscription container */
 
299
typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t;
 
300
 
 
301
size_t snd_seq_port_subscribe_sizeof(void);
 
302
/** allocate a #snd_seq_port_subscribe_t container on stack */
 
303
#define snd_seq_port_subscribe_alloca(ptr) \
 
304
        SND_ALLOCA(snd_seq_port_subscribe, ptr)
 
305
int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr);
 
306
void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *ptr);
 
307
void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src);
 
308
 
 
309
const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subscribe_t *info);
 
310
const snd_seq_addr_t *snd_seq_port_subscribe_get_dest(const snd_seq_port_subscribe_t *info);
 
311
int snd_seq_port_subscribe_get_queue(const snd_seq_port_subscribe_t *info);
 
312
int snd_seq_port_subscribe_get_exclusive(const snd_seq_port_subscribe_t *info);
 
313
int snd_seq_port_subscribe_get_time_update(const snd_seq_port_subscribe_t *info);
 
314
int snd_seq_port_subscribe_get_time_real(const snd_seq_port_subscribe_t *info);
 
315
 
 
316
void snd_seq_port_subscribe_set_sender(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
 
317
void snd_seq_port_subscribe_set_dest(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
 
318
void snd_seq_port_subscribe_set_queue(snd_seq_port_subscribe_t *info, int q);
 
319
void snd_seq_port_subscribe_set_exclusive(snd_seq_port_subscribe_t *info, int val);
 
320
void snd_seq_port_subscribe_set_time_update(snd_seq_port_subscribe_t *info, int val);
 
321
void snd_seq_port_subscribe_set_time_real(snd_seq_port_subscribe_t *info, int val);
 
322
 
 
323
int snd_seq_get_port_subscription(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
 
324
int snd_seq_subscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
 
325
int snd_seq_unsubscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
 
326
 
 
327
/*
 
328
 */
 
329
 
 
330
/** subscription query container */
 
331
typedef struct _snd_seq_query_subscribe snd_seq_query_subscribe_t;
 
332
 
 
333
/** type of query subscription */
 
334
typedef enum {
 
335
        SND_SEQ_QUERY_SUBS_READ,        /**< query read subscriptions */
 
336
        SND_SEQ_QUERY_SUBS_WRITE        /**< query write subscriptions */
 
337
} snd_seq_query_subs_type_t;
 
338
 
 
339
size_t snd_seq_query_subscribe_sizeof(void);
 
340
/** allocate a #snd_seq_query_subscribe_t container on stack */
 
341
#define snd_seq_query_subscribe_alloca(ptr) \
 
342
        SND_ALLOCA(snd_seq_query_subscribe, ptr)
 
343
int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr);
 
344
void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *ptr);
 
345
void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src);
 
346
 
 
347
int snd_seq_query_subscribe_get_client(const snd_seq_query_subscribe_t *info);
 
348
int snd_seq_query_subscribe_get_port(const snd_seq_query_subscribe_t *info);
 
349
const snd_seq_addr_t *snd_seq_query_subscribe_get_root(const snd_seq_query_subscribe_t *info);
 
350
snd_seq_query_subs_type_t snd_seq_query_subscribe_get_type(const snd_seq_query_subscribe_t *info);
 
351
int snd_seq_query_subscribe_get_index(const snd_seq_query_subscribe_t *info);
 
352
int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info);
 
353
const snd_seq_addr_t *snd_seq_query_subscribe_get_addr(const snd_seq_query_subscribe_t *info);
 
354
int snd_seq_query_subscribe_get_queue(const snd_seq_query_subscribe_t *info);
 
355
int snd_seq_query_subscribe_get_exclusive(const snd_seq_query_subscribe_t *info);
 
356
int snd_seq_query_subscribe_get_time_update(const snd_seq_query_subscribe_t *info);
 
357
int snd_seq_query_subscribe_get_time_real(const snd_seq_query_subscribe_t *info);
 
358
 
 
359
void snd_seq_query_subscribe_set_client(snd_seq_query_subscribe_t *info, int client);
 
360
void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port);
 
361
void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr);
 
362
void snd_seq_query_subscribe_set_type(snd_seq_query_subscribe_t *info, snd_seq_query_subs_type_t type);
 
363
void snd_seq_query_subscribe_set_index(snd_seq_query_subscribe_t *info, int index);
 
364
 
 
365
int snd_seq_query_port_subscribers(snd_seq_t *seq, snd_seq_query_subscribe_t * subs);
 
366
 
 
367
/** \} */
 
368
 
 
369
 
 
370
/**
 
371
 *  \defgroup SeqQueue Sequencer Queue Interface
 
372
 *  Sequencer Queue Interface
 
373
 *  \ingroup Sequencer
 
374
 *  \{
 
375
 */
 
376
 
 
377
/** queue information container */
 
378
typedef struct _snd_seq_queue_info snd_seq_queue_info_t;
 
379
/** queue status container */
 
380
typedef struct _snd_seq_queue_status snd_seq_queue_status_t;
 
381
/** queue tempo container */
 
382
typedef struct _snd_seq_queue_tempo snd_seq_queue_tempo_t;
 
383
/** queue timer information container */
 
384
typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t;
 
385
 
 
386
/** special queue ids */
 
387
#define SND_SEQ_QUEUE_DIRECT            253     /**< direct dispatch */
 
388
 
 
389
size_t snd_seq_queue_info_sizeof(void);
 
390
/** allocate a #snd_seq_queue_info_t container on stack */
 
391
#define snd_seq_queue_info_alloca(ptr) \
 
392
        SND_ALLOCA(snd_seq_queue_info, ptr)
 
393
int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr);
 
394
void snd_seq_queue_info_free(snd_seq_queue_info_t *ptr);
 
395
void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src);
 
396
 
 
397
int snd_seq_queue_info_get_queue(const snd_seq_queue_info_t *info);
 
398
const char *snd_seq_queue_info_get_name(const snd_seq_queue_info_t *info);
 
399
int snd_seq_queue_info_get_owner(const snd_seq_queue_info_t *info);
 
400
int snd_seq_queue_info_get_locked(const snd_seq_queue_info_t *info);
 
401
unsigned int snd_seq_queue_info_get_flags(const snd_seq_queue_info_t *info);
 
402
 
 
403
void snd_seq_queue_info_set_name(snd_seq_queue_info_t *info, const char *name);
 
404
void snd_seq_queue_info_set_owner(snd_seq_queue_info_t *info, int owner);
 
405
void snd_seq_queue_info_set_locked(snd_seq_queue_info_t *info, int locked);
 
406
void snd_seq_queue_info_set_flags(snd_seq_queue_info_t *info, unsigned int flags);
 
407
 
 
408
int snd_seq_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info);
 
409
int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name);
 
410
int snd_seq_alloc_queue(snd_seq_t *handle);
 
411
int snd_seq_free_queue(snd_seq_t *handle, int q);
 
412
int snd_seq_get_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
 
413
int snd_seq_set_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
 
414
int snd_seq_query_named_queue(snd_seq_t *seq, const char *name);
 
415
 
 
416
int snd_seq_get_queue_usage(snd_seq_t *handle, int q);
 
417
int snd_seq_set_queue_usage(snd_seq_t *handle, int q, int used);
 
418
 
 
419
/*
 
420
 */
 
421
size_t snd_seq_queue_status_sizeof(void);
 
422
/** allocate a #snd_seq_queue_status_t container on stack */
 
423
#define snd_seq_queue_status_alloca(ptr) \
 
424
        SND_ALLOCA(snd_seq_queue_status, ptr)
 
425
int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr);
 
426
void snd_seq_queue_status_free(snd_seq_queue_status_t *ptr);
 
427
void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src);
 
428
 
 
429
int snd_seq_queue_status_get_queue(const snd_seq_queue_status_t *info);
 
430
int snd_seq_queue_status_get_events(const snd_seq_queue_status_t *info);
 
431
snd_seq_tick_time_t snd_seq_queue_status_get_tick_time(const snd_seq_queue_status_t *info);
 
432
const snd_seq_real_time_t *snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t *info);
 
433
unsigned int snd_seq_queue_status_get_status(const snd_seq_queue_status_t *info);
 
434
 
 
435
int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t *status);
 
436
 
 
437
/*
 
438
 */
 
439
size_t snd_seq_queue_tempo_sizeof(void);
 
440
/** allocate a #snd_seq_queue_tempo_t container on stack */
 
441
#define snd_seq_queue_tempo_alloca(ptr) \
 
442
        SND_ALLOCA(snd_seq_queue_tempo, ptr)
 
443
int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr);
 
444
void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *ptr);
 
445
void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src);
 
446
 
 
447
int snd_seq_queue_tempo_get_queue(const snd_seq_queue_tempo_t *info);
 
448
unsigned int snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t *info);
 
449
int snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t *info);
 
450
unsigned int snd_seq_queue_tempo_get_skew(const snd_seq_queue_tempo_t *info);
 
451
unsigned int snd_seq_queue_tempo_get_skew_base(const snd_seq_queue_tempo_t *info);
 
452
void snd_seq_queue_tempo_set_tempo(snd_seq_queue_tempo_t *info, unsigned int tempo);
 
453
void snd_seq_queue_tempo_set_ppq(snd_seq_queue_tempo_t *info, int ppq);
 
454
void snd_seq_queue_tempo_set_skew(snd_seq_queue_tempo_t *info, unsigned int skew);
 
455
void snd_seq_queue_tempo_set_skew_base(snd_seq_queue_tempo_t *info, unsigned int base);
 
456
 
 
457
int snd_seq_get_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
 
458
int snd_seq_set_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
 
459
 
 
460
/*
 
461
 */
 
462
 
 
463
/** sequencer timer sources */
 
464
typedef enum {
 
465
        SND_SEQ_TIMER_ALSA = 0,         /* ALSA timer */
 
466
        SND_SEQ_TIMER_MIDI_CLOCK = 1,   /* Midi Clock (CLOCK event) */
 
467
        SND_SEQ_TIMER_MIDI_TICK = 2     /* Midi Timer Tick (TICK event */
 
468
} snd_seq_queue_timer_type_t;
 
469
 
 
470
size_t snd_seq_queue_timer_sizeof(void);
 
471
/** allocate a #snd_seq_queue_timer_t container on stack */
 
472
#define snd_seq_queue_timer_alloca(ptr) \
 
473
        SND_ALLOCA(snd_seq_queue_timer, ptr)
 
474
int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr);
 
475
void snd_seq_queue_timer_free(snd_seq_queue_timer_t *ptr);
 
476
void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src);
 
477
 
 
478
int snd_seq_queue_timer_get_queue(const snd_seq_queue_timer_t *info);
 
479
snd_seq_queue_timer_type_t snd_seq_queue_timer_get_type(const snd_seq_queue_timer_t *info);
 
480
const snd_timer_id_t *snd_seq_queue_timer_get_id(const snd_seq_queue_timer_t *info);
 
481
unsigned int snd_seq_queue_timer_get_resolution(const snd_seq_queue_timer_t *info);
 
482
 
 
483
void snd_seq_queue_timer_set_type(snd_seq_queue_timer_t *info, snd_seq_queue_timer_type_t type);
 
484
void snd_seq_queue_timer_set_id(snd_seq_queue_timer_t *info, const snd_timer_id_t *id);
 
485
void snd_seq_queue_timer_set_resolution(snd_seq_queue_timer_t *info, unsigned int resolution);
 
486
 
 
487
int snd_seq_get_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
 
488
int snd_seq_set_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
 
489
 
 
490
/** \} */
 
491
 
 
492
/**
 
493
 *  \defgroup SeqEvent Sequencer Event API
 
494
 *  Sequencer Event API
 
495
 *  \ingroup Sequencer
 
496
 *  \{
 
497
 */
 
498
 
 
499
int snd_seq_free_event(snd_seq_event_t *ev);
 
500
ssize_t snd_seq_event_length(snd_seq_event_t *ev);
 
501
int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);
 
502
int snd_seq_event_output_buffer(snd_seq_t *handle, snd_seq_event_t *ev);
 
503
int snd_seq_event_output_direct(snd_seq_t *handle, snd_seq_event_t *ev);
 
504
int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev);
 
505
int snd_seq_event_input_pending(snd_seq_t *seq, int fetch_sequencer);
 
506
int snd_seq_drain_output(snd_seq_t *handle);
 
507
int snd_seq_event_output_pending(snd_seq_t *seq);
 
508
int snd_seq_extract_output(snd_seq_t *handle, snd_seq_event_t **ev);
 
509
int snd_seq_drop_output(snd_seq_t *handle);
 
510
int snd_seq_drop_output_buffer(snd_seq_t *handle);
 
511
int snd_seq_drop_input(snd_seq_t *handle);
 
512
int snd_seq_drop_input_buffer(snd_seq_t *handle);
 
513
 
 
514
/** event removal conditionals */
 
515
typedef struct _snd_seq_remove_events snd_seq_remove_events_t;
 
516
 
 
517
/** Remove conditional flags */
 
518
#define SND_SEQ_REMOVE_INPUT            (1<<0)  /**< Flush input queues */
 
519
#define SND_SEQ_REMOVE_OUTPUT           (1<<1)  /**< Flush output queues */
 
520
#define SND_SEQ_REMOVE_DEST             (1<<2)  /**< Restrict by destination q:client:port */
 
521
#define SND_SEQ_REMOVE_DEST_CHANNEL     (1<<3)  /**< Restrict by channel */
 
522
#define SND_SEQ_REMOVE_TIME_BEFORE      (1<<4)  /**< Restrict to before time */
 
523
#define SND_SEQ_REMOVE_TIME_AFTER       (1<<5)  /**< Restrict to time or after */
 
524
#define SND_SEQ_REMOVE_TIME_TICK        (1<<6)  /**< Time is in ticks */
 
525
#define SND_SEQ_REMOVE_EVENT_TYPE       (1<<7)  /**< Restrict to event type */
 
526
#define SND_SEQ_REMOVE_IGNORE_OFF       (1<<8)  /**< Do not flush off events */
 
527
#define SND_SEQ_REMOVE_TAG_MATCH        (1<<9)  /**< Restrict to events with given tag */
 
528
 
 
529
size_t snd_seq_remove_events_sizeof(void);
 
530
/** allocate a #snd_seq_remove_events_t container on stack */
 
531
#define snd_seq_remove_events_alloca(ptr) \
 
532
        SND_ALLOCA(snd_seq_remove_events, ptr)
 
533
int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr);
 
534
void snd_seq_remove_events_free(snd_seq_remove_events_t *ptr);
 
535
void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src);
 
536
 
 
537
unsigned int snd_seq_remove_events_get_condition(const snd_seq_remove_events_t *info);
 
538
int snd_seq_remove_events_get_queue(const snd_seq_remove_events_t *info);
 
539
const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_events_t *info);
 
540
const snd_seq_addr_t *snd_seq_remove_events_get_dest(const snd_seq_remove_events_t *info);
 
541
int snd_seq_remove_events_get_channel(const snd_seq_remove_events_t *info);
 
542
int snd_seq_remove_events_get_event_type(const snd_seq_remove_events_t *info);
 
543
int snd_seq_remove_events_get_tag(const snd_seq_remove_events_t *info);
 
544
 
 
545
void snd_seq_remove_events_set_condition(snd_seq_remove_events_t *info, unsigned int flags);
 
546
void snd_seq_remove_events_set_queue(snd_seq_remove_events_t *info, int queue);
 
547
void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq_timestamp_t *time);
 
548
void snd_seq_remove_events_set_dest(snd_seq_remove_events_t *info, const snd_seq_addr_t *addr);
 
549
void snd_seq_remove_events_set_channel(snd_seq_remove_events_t *info, int channel);
 
550
void snd_seq_remove_events_set_event_type(snd_seq_remove_events_t *info, int type);
 
551
void snd_seq_remove_events_set_tag(snd_seq_remove_events_t *info, int tag);
 
552
 
 
553
int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);
 
554
 
 
555
/** \} */
 
556
 
 
557
/**
 
558
 *  \defgroup SeqMisc Sequencer Miscellaneous
 
559
 *  Sequencer Miscellaneous
 
560
 *  \ingroup Sequencer
 
561
 *  \{
 
562
 */
 
563
 
 
564
void snd_seq_set_bit(int nr, void *array);
 
565
int snd_seq_change_bit(int nr, void *array);
 
566
int snd_seq_get_bit(int nr, void *array);
 
567
 
 
568
/** \} */
 
569
 
 
570
 
 
571
/**
 
572
 *  \defgroup SeqEvType Sequencer Event Type Checks
 
573
 *  Sequencer Event Type Checks
 
574
 *  \ingroup Sequencer
 
575
 *  \{
 
576
 */
 
577
 
 
578
/* event type macros */
 
579
enum {
 
580
        SND_SEQ_EVFLG_RESULT,
 
581
        SND_SEQ_EVFLG_NOTE,
 
582
        SND_SEQ_EVFLG_CONTROL,
 
583
        SND_SEQ_EVFLG_QUEUE,
 
584
        SND_SEQ_EVFLG_SYSTEM,
 
585
        SND_SEQ_EVFLG_MESSAGE,
 
586
        SND_SEQ_EVFLG_CONNECTION,
 
587
        SND_SEQ_EVFLG_SAMPLE,
 
588
        SND_SEQ_EVFLG_USERS,
 
589
        SND_SEQ_EVFLG_INSTR,
 
590
        SND_SEQ_EVFLG_QUOTE,
 
591
        SND_SEQ_EVFLG_NONE,
 
592
        SND_SEQ_EVFLG_RAW,
 
593
        SND_SEQ_EVFLG_FIXED,
 
594
        SND_SEQ_EVFLG_VARIABLE,
 
595
        SND_SEQ_EVFLG_VARUSR
 
596
};
 
597
 
 
598
enum {
 
599
        SND_SEQ_EVFLG_NOTE_ONEARG,
 
600
        SND_SEQ_EVFLG_NOTE_TWOARG
 
601
};
 
602
 
 
603
enum {
 
604
        SND_SEQ_EVFLG_QUEUE_NOARG,
 
605
        SND_SEQ_EVFLG_QUEUE_TICK,
 
606
        SND_SEQ_EVFLG_QUEUE_TIME,
 
607
        SND_SEQ_EVFLG_QUEUE_VALUE
 
608
};
 
609
 
 
610
/**
 
611
 * Exported event type table
 
612
 *
 
613
 * This table is referred by snd_seq_ev_is_xxx.
 
614
 */
 
615
extern const unsigned int snd_seq_event_types[];
 
616
 
 
617
#define _SND_SEQ_TYPE(x)        (1<<(x))        /**< master type - 24bit */
 
618
#define _SND_SEQ_TYPE_OPT(x)    ((x)<<24)       /**< optional type - 8bit */
 
619
 
 
620
/** check the event type */
 
621
#define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x))
 
622
 
 
623
/** event type check: result events */
 
624
#define snd_seq_ev_is_result_type(ev) \
 
625
        snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT)
 
626
/** event type check: note events */
 
627
#define snd_seq_ev_is_note_type(ev) \
 
628
        snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE)
 
629
/** event type check: control events */
 
630
#define snd_seq_ev_is_control_type(ev) \
 
631
        snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL)
 
632
/** event type check: channel specific events */
 
633
#define snd_seq_ev_is_channel_type(ev) \
 
634
        (snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL)))
 
635
 
 
636
/** event type check: queue control events */
 
637
#define snd_seq_ev_is_queue_type(ev) \
 
638
        snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE)
 
639
/** event type check: system status messages */
 
640
#define snd_seq_ev_is_message_type(ev) \
 
641
        snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE)
 
642
/** event type check: system status messages */
 
643
#define snd_seq_ev_is_subscribe_type(ev) \
 
644
        snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION)
 
645
/** event type check: sample messages */
 
646
#define snd_seq_ev_is_sample_type(ev) \
 
647
        snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE)
 
648
/** event type check: user-defined messages */
 
649
#define snd_seq_ev_is_user_type(ev) \
 
650
        snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS)
 
651
/** event type check: instrument layer events */
 
652
#define snd_seq_ev_is_instr_type(ev) \
 
653
        snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR)
 
654
/** event type check: fixed length events */
 
655
#define snd_seq_ev_is_fixed_type(ev) \
 
656
        snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED)
 
657
/** event type check: variable length events */
 
658
#define snd_seq_ev_is_variable_type(ev) \
 
659
        snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE)
 
660
/** event type check: user pointer events */
 
661
#define snd_seq_ev_is_varusr_type(ev) \
 
662
        snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR)
 
663
/** event type check: reserved for kernel */
 
664
#define snd_seq_ev_is_reserved(ev) \
 
665
        (! snd_seq_event_types[(ev)->type])
 
666
 
 
667
/**
 
668
 * macros to check event flags
 
669
 */
 
670
/** prior events */
 
671
#define snd_seq_ev_is_prior(ev) \
 
672
        (((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH)
 
673
 
 
674
/** get the data length type */
 
675
#define snd_seq_ev_length_type(ev) \
 
676
        ((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK)
 
677
/** fixed length events */
 
678
#define snd_seq_ev_is_fixed(ev) \
 
679
        (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED)
 
680
/** variable length events */
 
681
#define snd_seq_ev_is_variable(ev) \
 
682
        (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE)
 
683
/** variable length on user-space */
 
684
#define snd_seq_ev_is_varusr(ev) \
 
685
        (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR)
 
686
 
 
687
/** time-stamp type */
 
688
#define snd_seq_ev_timestamp_type(ev) \
 
689
        ((ev)->flags & SND_SEQ_TIME_STAMP_MASK)
 
690
/** event is in tick time */
 
691
#define snd_seq_ev_is_tick(ev) \
 
692
        (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK)
 
693
/** event is in real-time */
 
694
#define snd_seq_ev_is_real(ev) \
 
695
        (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL)
 
696
 
 
697
/** time-mode type */
 
698
#define snd_seq_ev_timemode_type(ev) \
 
699
        ((ev)->flags & SND_SEQ_TIME_MODE_MASK)
 
700
/** scheduled in absolute time */
 
701
#define snd_seq_ev_is_abstime(ev) \
 
702
        (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS)
 
703
/** scheduled in relative time */
 
704
#define snd_seq_ev_is_reltime(ev) \
 
705
        (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL)
 
706
 
 
707
/** direct dispatched events */
 
708
#define snd_seq_ev_is_direct(ev) \
 
709
        ((ev)->queue == SND_SEQ_QUEUE_DIRECT)
 
710
 
 
711
/** \} */
 
712
 
 
713
#ifdef __cplusplus
 
714
}
 
715
#endif
 
716
 
 
717
#endif /* __ALSA_SEQ_H */
 
718