[BACK]Return to sysex.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / aucat

Annotation of src/usr.bin/aucat/sysex.h, Revision 1.5

1.5     ! jmc         1: /*     $OpenBSD: sysex.h,v 1.4 2015/01/21 08:43:55 ratchov Exp $       */
1.1       ratchov     2: /*
                      3:  * Copyright (c) 2011 Alexandre Ratchov <alex@caoua.org>
                      4:  *
                      5:  * Permission to use, copy, modify, and distribute this software for any
                      6:  * purpose with or without fee is hereby granted, provided that the above
                      7:  * copyright notice and this permission notice appear in all copies.
                      8:  *
                      9:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     10:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     11:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     12:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     13:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     14:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     15:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     16:  */
1.4       ratchov    17: #ifndef SYSEX_H
                     18: #define SYSEX_H
1.1       ratchov    19:
                     20: #include <stdint.h>
                     21:
                     22: /*
                     23:  * start and end markers
                     24:  */
                     25: #define SYSEX_START            0xf0
                     26: #define SYSEX_END              0xf7
                     27:
                     28: /*
                     29:  * type/vendor namespace IDs we use
                     30:  */
                     31: #define SYSEX_TYPE_RT          0x7f    /* real-time universal */
1.2       ratchov    32: #define SYSEX_TYPE_EDU         0x7d    /* non-comercial */
1.1       ratchov    33:
                     34: /*
                     35:  * realtime messages in the "universal real-time" namespace
                     36:  */
                     37: #define SYSEX_MTC              0x01            /* mtc messages */
                     38: #define   SYSEX_MTC_FULL       0x01            /* mtc full frame message */
1.3       ratchov    39: #define SYSEX_CONTROL          0x04
                     40: #define   SYSEX_MASTER         0x01
1.1       ratchov    41: #define SYSEX_MMC              0x06
                     42: #define   SYSEX_MMC_STOP       0x01
                     43: #define   SYSEX_MMC_START      0x02
                     44: #define   SYSEX_MMC_LOC                0x44
                     45: #define   SYSEX_MMC_LOC_LEN    0x06
                     46: #define   SYSEX_MMC_LOC_CMD    0x01
                     47:
                     48: /*
1.5     ! jmc        49:  * special "any" midi device number
1.2       ratchov    50:  */
1.4       ratchov    51: #define SYSEX_DEV_ANY          0x7f
1.2       ratchov    52:
                     53: /*
1.1       ratchov    54:  * minimum size of sysex message we accept
                     55:  */
                     56: #define SYSEX_SIZE(m)  (5 + sizeof(struct sysex_ ## m))
                     57:
                     58: /*
1.4       ratchov    59:  * all possible system exclusive messages we support.
1.1       ratchov    60:  */
                     61: struct sysex {
                     62:        uint8_t start;
                     63:        uint8_t type;                           /* type or vendor id */
                     64:        uint8_t dev;                            /* device or product id */
                     65:        uint8_t id0;                            /* message id */
                     66:        uint8_t id1;                            /* sub-id */
                     67:        union sysex_all {
                     68:                struct sysex_empty {
                     69:                        uint8_t end;
                     70:                } empty;
1.3       ratchov    71:                struct sysex_master {
                     72:                        uint8_t fine;
                     73:                        uint8_t coarse;
                     74:                        uint8_t end;
                     75:                } master;
1.1       ratchov    76:                struct sysex_start {
                     77:                        uint8_t end;
                     78:                } start;
                     79:                struct sysex_stop {
                     80:                        uint8_t end;
                     81:                } stop;
                     82:                struct sysex_loc {
                     83:                        uint8_t len;
                     84:                        uint8_t cmd;
1.4       ratchov    85: #define MTC_FPS_24     0
                     86: #define MTC_FPS_25     1
                     87: #define MTC_FPS_30     3
                     88:                        uint8_t hr;             /* MSB contain MTC_FPS */
1.1       ratchov    89:                        uint8_t min;
                     90:                        uint8_t sec;
                     91:                        uint8_t fr;
                     92:                        uint8_t cent;
                     93:                        uint8_t end;
                     94:                } loc;
                     95:                struct sysex_full {
                     96:                        uint8_t hr;
                     97:                        uint8_t min;
                     98:                        uint8_t sec;
                     99:                        uint8_t fr;
                    100:                        uint8_t end;
                    101:                } full;
                    102:        } u;
                    103: };
                    104:
1.4       ratchov   105: #endif /* !defined(SYSEX_H) */