Path: blob/master/thirdparty/linuxbsd_headers/alsa/seq_event.h
9903 views
/**1* \file include/seq_event.h2* \brief Application interface library for the ALSA driver3* \author Jaroslav Kysela <[email protected]>4* \author Abramo Bagnara <[email protected]>5* \author Takashi Iwai <[email protected]>6* \date 1998-20017*8* Application interface library for the ALSA driver9*/10/*11* This library is free software; you can redistribute it and/or modify12* it under the terms of the GNU Lesser General Public License as13* published by the Free Software Foundation; either version 2.1 of14* the License, or (at your option) any later version.15*16* This program is distributed in the hope that it will be useful,17* but WITHOUT ANY WARRANTY; without even the implied warranty of18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19* GNU Lesser General Public License for more details.20*21* You should have received a copy of the GNU Lesser General Public22* License along with this library; if not, write to the Free Software23* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA24*25*/2627#ifndef __ALSA_SEQ_EVENT_H28#define __ALSA_SEQ_EVENT_H2930/**31* \defgroup SeqEvents Sequencer Event Definitions32* Sequencer Event Definitions33* \ingroup Sequencer34* \{35*/3637/**38* Sequencer event data type39*/40typedef unsigned char snd_seq_event_type_t;4142/** Sequencer event type */43enum snd_seq_event_type {44/** system status; event data type = #snd_seq_result_t */45SND_SEQ_EVENT_SYSTEM = 0,46/** returned result status; event data type = #snd_seq_result_t */47SND_SEQ_EVENT_RESULT,4849/** note on and off with duration; event data type = #snd_seq_ev_note_t */50SND_SEQ_EVENT_NOTE = 5,51/** note on; event data type = #snd_seq_ev_note_t */52SND_SEQ_EVENT_NOTEON,53/** note off; event data type = #snd_seq_ev_note_t */54SND_SEQ_EVENT_NOTEOFF,55/** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */56SND_SEQ_EVENT_KEYPRESS,5758/** controller; event data type = #snd_seq_ev_ctrl_t */59SND_SEQ_EVENT_CONTROLLER = 10,60/** program change; event data type = #snd_seq_ev_ctrl_t */61SND_SEQ_EVENT_PGMCHANGE,62/** channel pressure; event data type = #snd_seq_ev_ctrl_t */63SND_SEQ_EVENT_CHANPRESS,64/** pitchwheel; event data type = #snd_seq_ev_ctrl_t; data is from -8192 to 8191) */65SND_SEQ_EVENT_PITCHBEND,66/** 14 bit controller value; event data type = #snd_seq_ev_ctrl_t */67SND_SEQ_EVENT_CONTROL14,68/** 14 bit NRPN; event data type = #snd_seq_ev_ctrl_t */69SND_SEQ_EVENT_NONREGPARAM,70/** 14 bit RPN; event data type = #snd_seq_ev_ctrl_t */71SND_SEQ_EVENT_REGPARAM,7273/** SPP with LSB and MSB values; event data type = #snd_seq_ev_ctrl_t */74SND_SEQ_EVENT_SONGPOS = 20,75/** Song Select with song ID number; event data type = #snd_seq_ev_ctrl_t */76SND_SEQ_EVENT_SONGSEL,77/** midi time code quarter frame; event data type = #snd_seq_ev_ctrl_t */78SND_SEQ_EVENT_QFRAME,79/** SMF Time Signature event; event data type = #snd_seq_ev_ctrl_t */80SND_SEQ_EVENT_TIMESIGN,81/** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */82SND_SEQ_EVENT_KEYSIGN,8384/** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */85SND_SEQ_EVENT_START = 30,86/** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */87SND_SEQ_EVENT_CONTINUE,88/** MIDI Real Time Stop message; event data type = #snd_seq_ev_queue_control_t */89SND_SEQ_EVENT_STOP,90/** Set tick queue position; event data type = #snd_seq_ev_queue_control_t */91SND_SEQ_EVENT_SETPOS_TICK,92/** Set real-time queue position; event data type = #snd_seq_ev_queue_control_t */93SND_SEQ_EVENT_SETPOS_TIME,94/** (SMF) Tempo event; event data type = #snd_seq_ev_queue_control_t */95SND_SEQ_EVENT_TEMPO,96/** MIDI Real Time Clock message; event data type = #snd_seq_ev_queue_control_t */97SND_SEQ_EVENT_CLOCK,98/** MIDI Real Time Tick message; event data type = #snd_seq_ev_queue_control_t */99SND_SEQ_EVENT_TICK,100/** Queue timer skew; event data type = #snd_seq_ev_queue_control_t */101SND_SEQ_EVENT_QUEUE_SKEW,102/** Sync position changed; event data type = #snd_seq_ev_queue_control_t */103SND_SEQ_EVENT_SYNC_POS,104105/** Tune request; event data type = none */106SND_SEQ_EVENT_TUNE_REQUEST = 40,107/** Reset to power-on state; event data type = none */108SND_SEQ_EVENT_RESET,109/** Active sensing event; event data type = none */110SND_SEQ_EVENT_SENSING,111112/** Echo-back event; event data type = any type */113SND_SEQ_EVENT_ECHO = 50,114/** OSS emulation raw event; event data type = any type */115SND_SEQ_EVENT_OSS,116117/** New client has connected; event data type = #snd_seq_addr_t */118SND_SEQ_EVENT_CLIENT_START = 60,119/** Client has left the system; event data type = #snd_seq_addr_t */120SND_SEQ_EVENT_CLIENT_EXIT,121/** Client status/info has changed; event data type = #snd_seq_addr_t */122SND_SEQ_EVENT_CLIENT_CHANGE,123/** New port was created; event data type = #snd_seq_addr_t */124SND_SEQ_EVENT_PORT_START,125/** Port was deleted from system; event data type = #snd_seq_addr_t */126SND_SEQ_EVENT_PORT_EXIT,127/** Port status/info has changed; event data type = #snd_seq_addr_t */128SND_SEQ_EVENT_PORT_CHANGE,129130/** Ports connected; event data type = #snd_seq_connect_t */131SND_SEQ_EVENT_PORT_SUBSCRIBED,132/** Ports disconnected; event data type = #snd_seq_connect_t */133SND_SEQ_EVENT_PORT_UNSUBSCRIBED,134135/** user-defined event; event data type = any (fixed size) */136SND_SEQ_EVENT_USR0 = 90,137/** user-defined event; event data type = any (fixed size) */138SND_SEQ_EVENT_USR1,139/** user-defined event; event data type = any (fixed size) */140SND_SEQ_EVENT_USR2,141/** user-defined event; event data type = any (fixed size) */142SND_SEQ_EVENT_USR3,143/** user-defined event; event data type = any (fixed size) */144SND_SEQ_EVENT_USR4,145/** user-defined event; event data type = any (fixed size) */146SND_SEQ_EVENT_USR5,147/** user-defined event; event data type = any (fixed size) */148SND_SEQ_EVENT_USR6,149/** user-defined event; event data type = any (fixed size) */150SND_SEQ_EVENT_USR7,151/** user-defined event; event data type = any (fixed size) */152SND_SEQ_EVENT_USR8,153/** user-defined event; event data type = any (fixed size) */154SND_SEQ_EVENT_USR9,155156/** system exclusive data (variable length); event data type = #snd_seq_ev_ext_t */157SND_SEQ_EVENT_SYSEX = 130,158/** error event; event data type = #snd_seq_ev_ext_t */159SND_SEQ_EVENT_BOUNCE,160/** reserved for user apps; event data type = #snd_seq_ev_ext_t */161SND_SEQ_EVENT_USR_VAR0 = 135,162/** reserved for user apps; event data type = #snd_seq_ev_ext_t */163SND_SEQ_EVENT_USR_VAR1,164/** reserved for user apps; event data type = #snd_seq_ev_ext_t */165SND_SEQ_EVENT_USR_VAR2,166/** reserved for user apps; event data type = #snd_seq_ev_ext_t */167SND_SEQ_EVENT_USR_VAR3,168/** reserved for user apps; event data type = #snd_seq_ev_ext_t */169SND_SEQ_EVENT_USR_VAR4,170171/** NOP; ignored in any case */172SND_SEQ_EVENT_NONE = 255173};174175176/** Sequencer event address */177typedef struct snd_seq_addr {178unsigned char client; /**< Client id */179unsigned char port; /**< Port id */180} snd_seq_addr_t;181182/** Connection (subscription) between ports */183typedef struct snd_seq_connect {184snd_seq_addr_t sender; /**< sender address */185snd_seq_addr_t dest; /**< destination address */186} snd_seq_connect_t;187188189/** Real-time data record */190typedef struct snd_seq_real_time {191unsigned int tv_sec; /**< seconds */192unsigned int tv_nsec; /**< nanoseconds */193} snd_seq_real_time_t;194195/** (MIDI) Tick-time data record */196typedef unsigned int snd_seq_tick_time_t;197198/** unioned time stamp */199typedef union snd_seq_timestamp {200snd_seq_tick_time_t tick; /**< tick-time */201struct snd_seq_real_time time; /**< real-time */202} snd_seq_timestamp_t;203204205/**206* Event mode flags207*208* NOTE: only 8 bits available!209*/210#define SND_SEQ_TIME_STAMP_TICK (0<<0) /**< timestamp in clock ticks */211#define SND_SEQ_TIME_STAMP_REAL (1<<0) /**< timestamp in real time */212#define SND_SEQ_TIME_STAMP_MASK (1<<0) /**< mask for timestamp bits */213214#define SND_SEQ_TIME_MODE_ABS (0<<1) /**< absolute timestamp */215#define SND_SEQ_TIME_MODE_REL (1<<1) /**< relative to current time */216#define SND_SEQ_TIME_MODE_MASK (1<<1) /**< mask for time mode bits */217218#define SND_SEQ_EVENT_LENGTH_FIXED (0<<2) /**< fixed event size */219#define SND_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /**< variable event size */220#define SND_SEQ_EVENT_LENGTH_VARUSR (2<<2) /**< variable event size - user memory space */221#define SND_SEQ_EVENT_LENGTH_MASK (3<<2) /**< mask for event length bits */222223#define SND_SEQ_PRIORITY_NORMAL (0<<4) /**< normal priority */224#define SND_SEQ_PRIORITY_HIGH (1<<4) /**< event should be processed before others */225#define SND_SEQ_PRIORITY_MASK (1<<4) /**< mask for priority bits */226227228/** Note event */229typedef struct snd_seq_ev_note {230unsigned char channel; /**< channel number */231unsigned char note; /**< note */232unsigned char velocity; /**< velocity */233unsigned char off_velocity; /**< note-off velocity; only for #SND_SEQ_EVENT_NOTE */234unsigned int duration; /**< duration until note-off; only for #SND_SEQ_EVENT_NOTE */235} snd_seq_ev_note_t;236237/** Controller event */238typedef struct snd_seq_ev_ctrl {239unsigned char channel; /**< channel number */240unsigned char unused[3]; /**< reserved */241unsigned int param; /**< control parameter */242signed int value; /**< control value */243} snd_seq_ev_ctrl_t;244245/** generic set of bytes (12x8 bit) */246typedef struct snd_seq_ev_raw8 {247unsigned char d[12]; /**< 8 bit value */248} snd_seq_ev_raw8_t;249250/** generic set of integers (3x32 bit) */251typedef struct snd_seq_ev_raw32 {252unsigned int d[3]; /**< 32 bit value */253} snd_seq_ev_raw32_t;254255/** external stored data */256struct snd_seq_ev_ext {257unsigned int len; /**< length of data */258void *ptr; /**< pointer to data (note: can be 64-bit) */259} __attribute__((packed));260/** external stored data */261typedef struct snd_seq_ev_ext snd_seq_ev_ext_t;262#ifdef DOC_HIDDEN263/* redefine typedef for stupid doxygen */264typedef snd_seq_ev_ext snd_seq_ev_ext_t;265#endif266267/** Result events */268typedef struct snd_seq_result {269int event; /**< processed event type */270int result; /**< status */271} snd_seq_result_t;272273/** Queue skew values */274typedef struct snd_seq_queue_skew {275unsigned int value; /**< skew value */276unsigned int base; /**< skew base */277} snd_seq_queue_skew_t;278279/** queue timer control */280typedef struct snd_seq_ev_queue_control {281unsigned char queue; /**< affected queue */282unsigned char unused[3]; /**< reserved */283union {284signed int value; /**< affected value (e.g. tempo) */285snd_seq_timestamp_t time; /**< time */286unsigned int position; /**< sync position */287snd_seq_queue_skew_t skew; /**< queue skew */288unsigned int d32[2]; /**< any data */289unsigned char d8[8]; /**< any data */290} param; /**< data value union */291} snd_seq_ev_queue_control_t;292293294/** Sequencer event */295typedef struct snd_seq_event {296snd_seq_event_type_t type; /**< event type */297unsigned char flags; /**< event flags */298unsigned char tag; /**< tag */299300unsigned char queue; /**< schedule queue */301snd_seq_timestamp_t time; /**< schedule time */302303snd_seq_addr_t source; /**< source address */304snd_seq_addr_t dest; /**< destination address */305306union {307snd_seq_ev_note_t note; /**< note information */308snd_seq_ev_ctrl_t control; /**< MIDI control information */309snd_seq_ev_raw8_t raw8; /**< raw8 data */310snd_seq_ev_raw32_t raw32; /**< raw32 data */311snd_seq_ev_ext_t ext; /**< external data */312snd_seq_ev_queue_control_t queue; /**< queue control */313snd_seq_timestamp_t time; /**< timestamp */314snd_seq_addr_t addr; /**< address */315snd_seq_connect_t connect; /**< connect information */316snd_seq_result_t result; /**< operation result code */317} data; /**< event data... */318} snd_seq_event_t;319320321/** \} */322323#endif /* __ALSA_SEQ_EVENT_H */324325326327