annotate plugin/api/alsa/seq.h @ 1013:6370575a812c

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