DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

seq_event-compat.h (11951B)


      1 /**
      2  * \file include/seq_event.h
      3  * \brief Application interface library for the ALSA driver
      4  * \author Jaroslav Kysela <perex@perex.cz>
      5  * \author Abramo Bagnara <abramo@alsa-project.org>
      6  * \author Takashi Iwai <tiwai@suse.de>
      7  * \date 1998-2001
      8  *
      9  * Application interface library for the ALSA driver
     10  */
     11 /*
     12  *   This library is free software; you can redistribute it and/or modify
     13  *   it under the terms of the GNU Lesser General Public License as
     14  *   published by the Free Software Foundation; either version 2.1 of
     15  *   the License, or (at your option) any later version.
     16  *
     17  *   This program is distributed in the hope that it will be useful,
     18  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     19  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     20  *   GNU Lesser General Public License for more details.
     21  *
     22  *   You should have received a copy of the GNU Lesser General Public
     23  *   License along with this library; if not, write to the Free Software
     24  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
     25  *
     26  */
     27 
     28 #ifndef __ALSA_SEQ_EVENT_COMPAT_H
     29 #define __ALSA_SEQ_EVENT_COMPAT_H
     30 
     31 /**
     32  * Sequencer event data type
     33  */
     34 typedef unsigned char snd_seq_event_type_t;
     35 
     36 /** Sequencer event type */
     37 enum snd_seq_event_type {
     38         /** system status; event data type = #snd_seq_result_t */
     39         SND_SEQ_EVENT_SYSTEM = 0,
     40         /** returned result status; event data type = #snd_seq_result_t */
     41         SND_SEQ_EVENT_RESULT,
     42 
     43         /** note on and off with duration; event data type = #snd_seq_ev_note_t */
     44         SND_SEQ_EVENT_NOTE = 5,
     45         /** note on; event data type = #snd_seq_ev_note_t */
     46         SND_SEQ_EVENT_NOTEON,
     47         /** note off; event data type = #snd_seq_ev_note_t */
     48         SND_SEQ_EVENT_NOTEOFF,
     49         /** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */
     50         SND_SEQ_EVENT_KEYPRESS,
     51 
     52         /** controller; event data type = #snd_seq_ev_ctrl_t */
     53         SND_SEQ_EVENT_CONTROLLER = 10,
     54         /** program change; event data type = #snd_seq_ev_ctrl_t */
     55         SND_SEQ_EVENT_PGMCHANGE,
     56         /** channel pressure; event data type = #snd_seq_ev_ctrl_t */
     57         SND_SEQ_EVENT_CHANPRESS,
     58         /** pitchwheel; event data type = #snd_seq_ev_ctrl_t; data is from -8192 to 8191) */
     59         SND_SEQ_EVENT_PITCHBEND,
     60         /** 14 bit controller value; event data type = #snd_seq_ev_ctrl_t */
     61         SND_SEQ_EVENT_CONTROL14,
     62         /** 14 bit NRPN;  event data type = #snd_seq_ev_ctrl_t */
     63         SND_SEQ_EVENT_NONREGPARAM,
     64         /** 14 bit RPN; event data type = #snd_seq_ev_ctrl_t */
     65         SND_SEQ_EVENT_REGPARAM,
     66 
     67         /** SPP with LSB and MSB values; event data type = #snd_seq_ev_ctrl_t */
     68         SND_SEQ_EVENT_SONGPOS = 20,
     69         /** Song Select with song ID number; event data type = #snd_seq_ev_ctrl_t */
     70         SND_SEQ_EVENT_SONGSEL,
     71         /** midi time code quarter frame; event data type = #snd_seq_ev_ctrl_t */
     72         SND_SEQ_EVENT_QFRAME,
     73         /** SMF Time Signature event; event data type = #snd_seq_ev_ctrl_t */
     74         SND_SEQ_EVENT_TIMESIGN,
     75         /** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */
     76         SND_SEQ_EVENT_KEYSIGN,
     77 
     78         /** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */
     79         SND_SEQ_EVENT_START = 30,
     80         /** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */
     81         SND_SEQ_EVENT_CONTINUE,
     82         /** MIDI Real Time Stop message; event data type = #snd_seq_ev_queue_control_t */
     83         SND_SEQ_EVENT_STOP,
     84         /** Set tick queue position; event data type = #snd_seq_ev_queue_control_t */
     85         SND_SEQ_EVENT_SETPOS_TICK,
     86         /** Set real-time queue position; event data type = #snd_seq_ev_queue_control_t */
     87         SND_SEQ_EVENT_SETPOS_TIME,
     88         /** (SMF) Tempo event; event data type = #snd_seq_ev_queue_control_t */
     89         SND_SEQ_EVENT_TEMPO,
     90         /** MIDI Real Time Clock message; event data type = #snd_seq_ev_queue_control_t */
     91         SND_SEQ_EVENT_CLOCK,
     92         /** MIDI Real Time Tick message; event data type = #snd_seq_ev_queue_control_t */
     93         SND_SEQ_EVENT_TICK,
     94         /** Queue timer skew; event data type = #snd_seq_ev_queue_control_t */
     95         SND_SEQ_EVENT_QUEUE_SKEW,
     96         /** Sync position changed; event data type = #snd_seq_ev_queue_control_t */
     97         SND_SEQ_EVENT_SYNC_POS,
     98 
     99         /** Tune request; event data type = none */
    100         SND_SEQ_EVENT_TUNE_REQUEST = 40,
    101         /** Reset to power-on state; event data type = none */
    102         SND_SEQ_EVENT_RESET,
    103         /** Active sensing event; event data type = none */
    104         SND_SEQ_EVENT_SENSING,
    105 
    106         /** Echo-back event; event data type = any type */
    107         SND_SEQ_EVENT_ECHO = 50,
    108         /** OSS emulation raw event; event data type = any type */
    109         SND_SEQ_EVENT_OSS,
    110 
    111         /** New client has connected; event data type = #snd_seq_addr_t */
    112         SND_SEQ_EVENT_CLIENT_START = 60,
    113         /** Client has left the system; event data type = #snd_seq_addr_t */
    114         SND_SEQ_EVENT_CLIENT_EXIT,
    115         /** Client status/info has changed; event data type = #snd_seq_addr_t */
    116         SND_SEQ_EVENT_CLIENT_CHANGE,
    117         /** New port was created; event data type = #snd_seq_addr_t */
    118         SND_SEQ_EVENT_PORT_START,
    119         /** Port was deleted from system; event data type = #snd_seq_addr_t */
    120         SND_SEQ_EVENT_PORT_EXIT,
    121         /** Port status/info has changed; event data type = #snd_seq_addr_t */
    122         SND_SEQ_EVENT_PORT_CHANGE,
    123 
    124         /** Ports connected; event data type = #snd_seq_connect_t */
    125         SND_SEQ_EVENT_PORT_SUBSCRIBED,
    126         /** Ports disconnected; event data type = #snd_seq_connect_t */
    127         SND_SEQ_EVENT_PORT_UNSUBSCRIBED,
    128 
    129         /** user-defined event; event data type = any (fixed size) */
    130         SND_SEQ_EVENT_USR0 = 90,
    131         /** user-defined event; event data type = any (fixed size) */
    132         SND_SEQ_EVENT_USR1,
    133         /** user-defined event; event data type = any (fixed size) */
    134         SND_SEQ_EVENT_USR2,
    135         /** user-defined event; event data type = any (fixed size) */
    136         SND_SEQ_EVENT_USR3,
    137         /** user-defined event; event data type = any (fixed size) */
    138         SND_SEQ_EVENT_USR4,
    139         /** user-defined event; event data type = any (fixed size) */
    140         SND_SEQ_EVENT_USR5,
    141         /** user-defined event; event data type = any (fixed size) */
    142         SND_SEQ_EVENT_USR6,
    143         /** user-defined event; event data type = any (fixed size) */
    144         SND_SEQ_EVENT_USR7,
    145         /** user-defined event; event data type = any (fixed size) */
    146         SND_SEQ_EVENT_USR8,
    147         /** user-defined event; event data type = any (fixed size) */
    148         SND_SEQ_EVENT_USR9,
    149 
    150         /** system exclusive data (variable length);  event data type = #snd_seq_ev_ext_t */
    151         SND_SEQ_EVENT_SYSEX = 130,
    152         /** error event;  event data type = #snd_seq_ev_ext_t */
    153         SND_SEQ_EVENT_BOUNCE,
    154         /** reserved for user apps;  event data type = #snd_seq_ev_ext_t */
    155         SND_SEQ_EVENT_USR_VAR0 = 135,
    156         /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
    157         SND_SEQ_EVENT_USR_VAR1,
    158         /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
    159         SND_SEQ_EVENT_USR_VAR2,
    160         /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
    161         SND_SEQ_EVENT_USR_VAR3,
    162         /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
    163         SND_SEQ_EVENT_USR_VAR4,
    164 
    165         /** NOP; ignored in any case */
    166         SND_SEQ_EVENT_NONE = 255
    167 };
    168 
    169 /** Sequencer event address */
    170 typedef struct snd_seq_addr {
    171         unsigned char client;	/**< Client id */
    172         unsigned char port;	/**< Port id */
    173 } snd_seq_addr_t;
    174 
    175 /** Connection (subscription) between ports */
    176 typedef struct snd_seq_connect {
    177         snd_seq_addr_t sender;	/**< sender address */
    178         snd_seq_addr_t dest;	/**< destination address */
    179 } snd_seq_connect_t;
    180 
    181 /** Real-time data record */
    182 typedef struct snd_seq_real_time {
    183         unsigned int tv_sec;		/**< seconds */
    184         unsigned int tv_nsec;		/**< nanoseconds */
    185 } snd_seq_real_time_t;
    186 
    187 /** (MIDI) Tick-time data record */
    188 typedef unsigned int snd_seq_tick_time_t;
    189 
    190 /** unioned time stamp */
    191 typedef union snd_seq_timestamp {
    192         snd_seq_tick_time_t tick;       /**< tick-time */
    193         struct snd_seq_real_time time;  /**< real-time */
    194 } snd_seq_timestamp_t;
    195 
    196 /** Note event */
    197 typedef struct snd_seq_ev_note {
    198         unsigned char channel;		/**< channel number */
    199         unsigned char note;		/**< note */
    200         unsigned char velocity;		/**< velocity */
    201         unsigned char off_velocity;	/**< note-off velocity; only for #SND_SEQ_EVENT_NOTE */
    202         unsigned int duration;		/**< duration until note-off; only for #SND_SEQ_EVENT_NOTE */
    203 } snd_seq_ev_note_t;
    204 
    205 /** Controller event */
    206 typedef struct snd_seq_ev_ctrl {
    207         unsigned char channel;		/**< channel number */
    208         unsigned char unused[3];	/**< reserved */
    209         unsigned int param;		/**< control parameter */
    210         signed int value;		/**< control value */
    211 } snd_seq_ev_ctrl_t;
    212 
    213 /** generic set of bytes (12x8 bit) */
    214 typedef struct snd_seq_ev_raw8 {
    215         unsigned char d[12];		/**< 8 bit value */
    216 } snd_seq_ev_raw8_t;
    217 
    218 /** generic set of integers (3x32 bit) */
    219 typedef struct snd_seq_ev_raw32 {
    220         unsigned int d[3];		/**< 32 bit value */
    221 } snd_seq_ev_raw32_t;
    222 
    223 /** external stored data */
    224 typedef struct snd_seq_ev_ext {
    225         unsigned int len;		/**< length of data */
    226         void *ptr;			/**< pointer to data (note: can be 64-bit) */
    227 } __attribute__((packed)) snd_seq_ev_ext_t;
    228 
    229 /** Result events */
    230 typedef struct snd_seq_result {
    231         int event;		/**< processed event type */
    232         int result;		/**< status */
    233 } snd_seq_result_t;
    234 
    235 /** Queue skew values */
    236 typedef struct snd_seq_queue_skew {
    237         unsigned int value;	/**< skew value */
    238         unsigned int base;	/**< skew base */
    239 } snd_seq_queue_skew_t;
    240 
    241 /** queue timer control */
    242 typedef struct snd_seq_ev_queue_control {
    243         unsigned char queue;			/**< affected queue */
    244         unsigned char unused[3];		/**< reserved */
    245         union {
    246                 signed int value;		/**< affected value (e.g. tempo) */
    247                 snd_seq_timestamp_t time;	/**< time */
    248                 unsigned int position;		/**< sync position */
    249                 snd_seq_queue_skew_t skew;	/**< queue skew */
    250                 unsigned int d32[2];		/**< any data */
    251                 unsigned char d8[8];		/**< any data */
    252         } param;				/**< data value union */
    253 } snd_seq_ev_queue_control_t;
    254 
    255 /** Sequencer event */
    256 typedef struct snd_seq_event {
    257         snd_seq_event_type_t type;      /**< event type */
    258         unsigned char flags;            /**< event flags */
    259         unsigned char tag;              /**< tag */
    260 
    261         unsigned char queue;            /**< schedule queue */
    262         snd_seq_timestamp_t time;       /**< schedule time */
    263 
    264         snd_seq_addr_t source;          /**< source address */
    265         snd_seq_addr_t dest;            /**< destination address */
    266 
    267         union {
    268                 snd_seq_ev_note_t note;         /**< note information */
    269                 snd_seq_ev_ctrl_t control;      /**< MIDI control information */
    270                 snd_seq_ev_raw8_t raw8;         /**< raw8 data */
    271                 snd_seq_ev_raw32_t raw32;       /**< raw32 data */
    272                 snd_seq_ev_ext_t ext;           /**< external data */
    273                 snd_seq_ev_queue_control_t queue; /**< queue control */
    274                 snd_seq_timestamp_t time;       /**< timestamp */
    275                 snd_seq_addr_t addr;            /**< address */
    276                 snd_seq_connect_t connect;      /**< connect information */
    277                 snd_seq_result_t result;        /**< operation result code */
    278         } data;                         /**< event data... */
    279 } snd_seq_event_t;
    280 
    281 #endif /* __ALSA_SEQ_EVENT_COMPAT_H */
    282