Chris@0: /* DSSI ALSA compatibility library
Chris@0:  *
Chris@0:  * This library provides for Mac OS X the ALSA snd_seq_event_t handling
Chris@0:  * necessary to compile and run DSSI.  It was extracted from alsa-lib 1.0.8.
Chris@0:  */
Chris@0: 
Chris@0: /**
Chris@0:  * \file <alsa/seq.h>
Chris@0:  * \brief Application interface library for the ALSA driver
Chris@0:  * \author Jaroslav Kysela <perex@suse.cz>
Chris@0:  * \author Abramo Bagnara <abramo@alsa-project.org>
Chris@0:  * \author Takashi Iwai <tiwai@suse.de>
Chris@0:  * \date 1998-2001
Chris@0:  */
Chris@0: /*
Chris@0:  * Application interface library for the ALSA driver
Chris@0:  *
Chris@0:  *
Chris@0:  *   This library is free software; you can redistribute it and/or modify
Chris@0:  *   it under the terms of the GNU Lesser General Public License as
Chris@0:  *   published by the Free Software Foundation; either version 2.1 of
Chris@0:  *   the License, or (at your option) any later version.
Chris@0:  *
Chris@0:  *   This program is distributed in the hope that it will be useful,
Chris@0:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Chris@0:  *   GNU Lesser General Public License for more details.
Chris@0:  *
Chris@0:  *   You should have received a copy of the GNU Lesser General Public
Chris@0:  *   License along with this library; if not, write to the Free Software
Chris@0:  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
Chris@0:  *
Chris@0:  */
Chris@0: 
Chris@0: #ifndef __ALSA_SEQ_H
Chris@0: #define __ALSA_SEQ_H
Chris@0: 
Chris@0: #ifdef __cplusplus
Chris@0: extern "C" {
Chris@0: #endif
Chris@0: 
Chris@0: /**
Chris@0:  *  \defgroup SeqEvType Sequencer Event Type Checks
Chris@0:  *  Sequencer Event Type Checks
Chris@0:  *  \ingroup Sequencer
Chris@0:  *  \{
Chris@0:  */
Chris@0: 
Chris@0: /* event type macros */
Chris@0: enum {
Chris@1429:         SND_SEQ_EVFLG_RESULT,
Chris@1429:         SND_SEQ_EVFLG_NOTE,
Chris@1429:         SND_SEQ_EVFLG_CONTROL,
Chris@1429:         SND_SEQ_EVFLG_QUEUE,
Chris@1429:         SND_SEQ_EVFLG_SYSTEM,
Chris@1429:         SND_SEQ_EVFLG_MESSAGE,
Chris@1429:         SND_SEQ_EVFLG_CONNECTION,
Chris@1429:         SND_SEQ_EVFLG_SAMPLE,
Chris@1429:         SND_SEQ_EVFLG_USERS,
Chris@1429:         SND_SEQ_EVFLG_INSTR,
Chris@1429:         SND_SEQ_EVFLG_QUOTE,
Chris@1429:         SND_SEQ_EVFLG_NONE,
Chris@1429:         SND_SEQ_EVFLG_RAW,
Chris@1429:         SND_SEQ_EVFLG_FIXED,
Chris@1429:         SND_SEQ_EVFLG_VARIABLE,
Chris@1429:         SND_SEQ_EVFLG_VARUSR
Chris@0: };
Chris@0: 
Chris@0: enum {
Chris@1429:         SND_SEQ_EVFLG_NOTE_ONEARG,
Chris@1429:         SND_SEQ_EVFLG_NOTE_TWOARG
Chris@0: };
Chris@0: 
Chris@0: enum {
Chris@1429:         SND_SEQ_EVFLG_QUEUE_NOARG,
Chris@1429:         SND_SEQ_EVFLG_QUEUE_TICK,
Chris@1429:         SND_SEQ_EVFLG_QUEUE_TIME,
Chris@1429:         SND_SEQ_EVFLG_QUEUE_VALUE
Chris@0: };
Chris@0: 
Chris@0: /**
Chris@0:  * Exported event type table
Chris@0:  *
Chris@0:  * This table is referred by snd_seq_ev_is_xxx.
Chris@0:  */
Chris@0: extern const unsigned int snd_seq_event_types[];
Chris@0: 
Chris@1429: #define _SND_SEQ_TYPE(x)        (1<<(x))        /**< master type - 24bit */
Chris@1429: #define _SND_SEQ_TYPE_OPT(x)        ((x)<<24)        /**< optional type - 8bit */
Chris@0: 
Chris@0: /** check the event type */
Chris@0: #define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x))
Chris@0: 
Chris@0: /** event type check: result events */
Chris@0: #define snd_seq_ev_is_result_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT)
Chris@0: /** event type check: note events */
Chris@0: #define snd_seq_ev_is_note_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE)
Chris@0: /** event type check: control events */
Chris@0: #define snd_seq_ev_is_control_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL)
Chris@0: /** event type check: channel specific events */
Chris@0: #define snd_seq_ev_is_channel_type(ev) \
Chris@1429:         (snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL)))
Chris@0: 
Chris@0: /** event type check: queue control events */
Chris@0: #define snd_seq_ev_is_queue_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE)
Chris@0: /** event type check: system status messages */
Chris@0: #define snd_seq_ev_is_message_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE)
Chris@0: /** event type check: system status messages */
Chris@0: #define snd_seq_ev_is_subscribe_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION)
Chris@0: /** event type check: sample messages */
Chris@0: #define snd_seq_ev_is_sample_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE)
Chris@0: /** event type check: user-defined messages */
Chris@0: #define snd_seq_ev_is_user_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS)
Chris@0: /** event type check: instrument layer events */
Chris@0: #define snd_seq_ev_is_instr_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR)
Chris@0: /** event type check: fixed length events */
Chris@0: #define snd_seq_ev_is_fixed_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED)
Chris@0: /** event type check: variable length events */
Chris@1429: #define snd_seq_ev_is_variable_type(ev)        \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE)
Chris@0: /** event type check: user pointer events */
Chris@0: #define snd_seq_ev_is_varusr_type(ev) \
Chris@1429:         snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR)
Chris@0: /** event type check: reserved for kernel */
Chris@0: #define snd_seq_ev_is_reserved(ev) \
Chris@1429:         (! snd_seq_event_types[(ev)->type])
Chris@0: 
Chris@0: /**
Chris@0:  * macros to check event flags
Chris@0:  */
Chris@0: /** prior events */
Chris@1429: #define snd_seq_ev_is_prior(ev)        \
Chris@1429:         (((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH)
Chris@0: 
Chris@0: /** get the data length type */
Chris@0: #define snd_seq_ev_length_type(ev) \
Chris@1429:         ((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK)
Chris@0: /** fixed length events */
Chris@1429: #define snd_seq_ev_is_fixed(ev)        \
Chris@1429:         (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED)
Chris@0: /** variable length events */
Chris@0: #define snd_seq_ev_is_variable(ev) \
Chris@1429:         (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE)
Chris@0: /** variable length on user-space */
Chris@0: #define snd_seq_ev_is_varusr(ev) \
Chris@1429:         (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR)
Chris@0: 
Chris@0: /** time-stamp type */
Chris@0: #define snd_seq_ev_timestamp_type(ev) \
Chris@1429:         ((ev)->flags & SND_SEQ_TIME_STAMP_MASK)
Chris@0: /** event is in tick time */
Chris@0: #define snd_seq_ev_is_tick(ev) \
Chris@1429:         (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK)
Chris@0: /** event is in real-time */
Chris@0: #define snd_seq_ev_is_real(ev) \
Chris@1429:         (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL)
Chris@0: 
Chris@0: /** time-mode type */
Chris@0: #define snd_seq_ev_timemode_type(ev) \
Chris@1429:         ((ev)->flags & SND_SEQ_TIME_MODE_MASK)
Chris@0: /** scheduled in absolute time */
Chris@0: #define snd_seq_ev_is_abstime(ev) \
Chris@1429:         (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS)
Chris@0: /** scheduled in relative time */
Chris@0: #define snd_seq_ev_is_reltime(ev) \
Chris@1429:         (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL)
Chris@0: 
Chris@0: /** direct dispatched events */
Chris@0: #define snd_seq_ev_is_direct(ev) \
Chris@1429:         ((ev)->queue == SND_SEQ_QUEUE_DIRECT)
Chris@0: 
Chris@0: /** \} */
Chris@0: 
Chris@0: #ifdef __cplusplus
Chris@0: }
Chris@0: #endif
Chris@0: 
Chris@0: #endif /* __ALSA_SEQ_H */
Chris@0: