comparison plugin/api/alsa/seq.h @ 0:da6937383da8

initial import
author Chris Cannam
date Tue, 10 Jan 2006 16:33:16 +0000
parents
children 48e9f538e6e9
comparison
equal deleted inserted replaced
-1:000000000000 0:da6937383da8
1 /* DSSI ALSA compatibility library
2 *
3 * This library provides for Mac OS X the ALSA snd_seq_event_t handling
4 * necessary to compile and run DSSI. It was extracted from alsa-lib 1.0.8.
5 */
6
7 /**
8 * \file <alsa/seq.h>
9 * \brief Application interface library for the ALSA driver
10 * \author Jaroslav Kysela <perex@suse.cz>
11 * \author Abramo Bagnara <abramo@alsa-project.org>
12 * \author Takashi Iwai <tiwai@suse.de>
13 * \date 1998-2001
14 */
15 /*
16 * Application interface library for the ALSA driver
17 *
18 *
19 * This library is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU Lesser General Public License as
21 * published by the Free Software Foundation; either version 2.1 of
22 * the License, or (at your option) any later version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU Lesser General Public License for more details.
28 *
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 *
33 */
34
35 #ifndef __ALSA_SEQ_H
36 #define __ALSA_SEQ_H
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /**
43 * \defgroup SeqEvType Sequencer Event Type Checks
44 * Sequencer Event Type Checks
45 * \ingroup Sequencer
46 * \{
47 */
48
49 /* event type macros */
50 enum {
51 SND_SEQ_EVFLG_RESULT,
52 SND_SEQ_EVFLG_NOTE,
53 SND_SEQ_EVFLG_CONTROL,
54 SND_SEQ_EVFLG_QUEUE,
55 SND_SEQ_EVFLG_SYSTEM,
56 SND_SEQ_EVFLG_MESSAGE,
57 SND_SEQ_EVFLG_CONNECTION,
58 SND_SEQ_EVFLG_SAMPLE,
59 SND_SEQ_EVFLG_USERS,
60 SND_SEQ_EVFLG_INSTR,
61 SND_SEQ_EVFLG_QUOTE,
62 SND_SEQ_EVFLG_NONE,
63 SND_SEQ_EVFLG_RAW,
64 SND_SEQ_EVFLG_FIXED,
65 SND_SEQ_EVFLG_VARIABLE,
66 SND_SEQ_EVFLG_VARUSR
67 };
68
69 enum {
70 SND_SEQ_EVFLG_NOTE_ONEARG,
71 SND_SEQ_EVFLG_NOTE_TWOARG
72 };
73
74 enum {
75 SND_SEQ_EVFLG_QUEUE_NOARG,
76 SND_SEQ_EVFLG_QUEUE_TICK,
77 SND_SEQ_EVFLG_QUEUE_TIME,
78 SND_SEQ_EVFLG_QUEUE_VALUE
79 };
80
81 /**
82 * Exported event type table
83 *
84 * This table is referred by snd_seq_ev_is_xxx.
85 */
86 extern const unsigned int snd_seq_event_types[];
87
88 #define _SND_SEQ_TYPE(x) (1<<(x)) /**< master type - 24bit */
89 #define _SND_SEQ_TYPE_OPT(x) ((x)<<24) /**< optional type - 8bit */
90
91 /** check the event type */
92 #define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x))
93
94 /** event type check: result events */
95 #define snd_seq_ev_is_result_type(ev) \
96 snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT)
97 /** event type check: note events */
98 #define snd_seq_ev_is_note_type(ev) \
99 snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE)
100 /** event type check: control events */
101 #define snd_seq_ev_is_control_type(ev) \
102 snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL)
103 /** event type check: channel specific events */
104 #define snd_seq_ev_is_channel_type(ev) \
105 (snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL)))
106
107 /** event type check: queue control events */
108 #define snd_seq_ev_is_queue_type(ev) \
109 snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE)
110 /** event type check: system status messages */
111 #define snd_seq_ev_is_message_type(ev) \
112 snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE)
113 /** event type check: system status messages */
114 #define snd_seq_ev_is_subscribe_type(ev) \
115 snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION)
116 /** event type check: sample messages */
117 #define snd_seq_ev_is_sample_type(ev) \
118 snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE)
119 /** event type check: user-defined messages */
120 #define snd_seq_ev_is_user_type(ev) \
121 snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS)
122 /** event type check: instrument layer events */
123 #define snd_seq_ev_is_instr_type(ev) \
124 snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR)
125 /** event type check: fixed length events */
126 #define snd_seq_ev_is_fixed_type(ev) \
127 snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED)
128 /** event type check: variable length events */
129 #define snd_seq_ev_is_variable_type(ev) \
130 snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE)
131 /** event type check: user pointer events */
132 #define snd_seq_ev_is_varusr_type(ev) \
133 snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR)
134 /** event type check: reserved for kernel */
135 #define snd_seq_ev_is_reserved(ev) \
136 (! snd_seq_event_types[(ev)->type])
137
138 /**
139 * macros to check event flags
140 */
141 /** prior events */
142 #define snd_seq_ev_is_prior(ev) \
143 (((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH)
144
145 /** get the data length type */
146 #define snd_seq_ev_length_type(ev) \
147 ((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK)
148 /** fixed length events */
149 #define snd_seq_ev_is_fixed(ev) \
150 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED)
151 /** variable length events */
152 #define snd_seq_ev_is_variable(ev) \
153 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE)
154 /** variable length on user-space */
155 #define snd_seq_ev_is_varusr(ev) \
156 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR)
157
158 /** time-stamp type */
159 #define snd_seq_ev_timestamp_type(ev) \
160 ((ev)->flags & SND_SEQ_TIME_STAMP_MASK)
161 /** event is in tick time */
162 #define snd_seq_ev_is_tick(ev) \
163 (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK)
164 /** event is in real-time */
165 #define snd_seq_ev_is_real(ev) \
166 (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL)
167
168 /** time-mode type */
169 #define snd_seq_ev_timemode_type(ev) \
170 ((ev)->flags & SND_SEQ_TIME_MODE_MASK)
171 /** scheduled in absolute time */
172 #define snd_seq_ev_is_abstime(ev) \
173 (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS)
174 /** scheduled in relative time */
175 #define snd_seq_ev_is_reltime(ev) \
176 (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL)
177
178 /** direct dispatched events */
179 #define snd_seq_ev_is_direct(ev) \
180 ((ev)->queue == SND_SEQ_QUEUE_DIRECT)
181
182 /** \} */
183
184 #ifdef __cplusplus
185 }
186 #endif
187
188 #endif /* __ALSA_SEQ_H */
189