The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/midiio.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: midiio.h,v 1.10 2003/12/04 13:57:32 keihan Exp $       */
    2 
    3 /*-
    4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Lennart Augustsson (augustss@NetBSD.org).
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *      This product includes software developed by the NetBSD
   21  *      Foundation, Inc. and its contributors.
   22  * 4. Neither the name of The NetBSD Foundation nor the names of its
   23  *    contributors may be used to endorse or promote products derived
   24  *    from this software without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   36  * POSSIBILITY OF SUCH DAMAGE.
   37  */
   38 
   39 #ifndef _SYS_MIDIIO_H_
   40 #define _SYS_MIDIIO_H_
   41 
   42 /*
   43  * The API defined here is compatible with the OSS MIDI API except
   44  * for naming.
   45  */
   46 
   47 #include <machine/endian_machdep.h>
   48 
   49 /*
   50  * ioctl() commands for /dev/midi##
   51  */
   52 typedef struct {
   53         unsigned        char cmd;
   54         char            nr_args, nr_returns;
   55         unsigned char   data[30];
   56 } mpu_command_rec;
   57 
   58 #define MIDI_PRETIME            _IOWR('m', 0, int)
   59 #define MIDI_MPUMODE            _IOWR('m', 1, int)
   60 #define MIDI_MPUCMD             _IOWR('m', 2, mpu_command_rec)
   61 
   62 
   63 /* The MPU401 command acknowledge and active sense command */
   64 #define MIDI_ACK        0xfe
   65 
   66 
   67 /* Sequencer */
   68 #define SEQUENCER_RESET                 _IO  ('Q', 0)
   69 #define SEQUENCER_SYNC                  _IO  ('Q', 1)
   70 #define SEQUENCER_INFO                  _IOWR('Q', 2, struct synth_info)
   71 #define SEQUENCER_CTRLRATE              _IOWR('Q', 3, int)
   72 #define SEQUENCER_GETOUTCOUNT           _IOR ('Q', 4, int)
   73 #define SEQUENCER_GETINCOUNT            _IOR ('Q', 5, int)
   74 /*#define SEQUENCER_PERCMODE            _IOW ('Q', 6, int)*/
   75 /*#define SEQUENCER_TESTMIDI            _IOW ('Q', 8, int)*/
   76 #define SEQUENCER_RESETSAMPLES          _IOW ('Q', 9, int)
   77 #define SEQUENCER_NRSYNTHS              _IOR ('Q',10, int)
   78 #define SEQUENCER_NRMIDIS               _IOR ('Q',11, int)
   79 /*#define SEQUENCER_MIDI_INFO           _IOWR('Q',12, struct midi_info)*/
   80 #define SEQUENCER_THRESHOLD             _IOW ('Q',13, int)
   81 #define SEQUENCER_MEMAVL                _IOWR('Q',14, int)
   82 /*#define SEQUENCER_FM_4OP_ENABLE               _IOW ('Q',15, int)*/
   83 #define SEQUENCER_PANIC                 _IO  ('Q',17)
   84 #define SEQUENCER_OUTOFBAND             _IOW ('Q',18, struct seq_event_rec)
   85 #define SEQUENCER_GETTIME               _IOR ('Q',19, int)
   86 /*#define SEQUENCER_ID                  _IOWR('Q',20, struct synth_info)*/
   87 /*#define SEQUENCER_CONTROL             _IOWR('Q',21, struct synth_control)*/
   88 /*#define SEQUENCER_REMOVESAMPLE                _IOWR('Q',22, struct remove_sample)*/
   89 
   90 #if 0
   91 typedef struct synth_control {
   92         int     devno;          /* Synthesizer # */
   93         char    data[4000];     /* Device specific command/data record */
   94 } synth_control;
   95 
   96 typedef struct remove_sample {
   97         int     devno;          /* Synthesizer # */
   98         int     bankno;         /* MIDI bank # (0=General MIDI) */
   99         int     instrno;        /* MIDI instrument number */
  100 } remove_sample;
  101 #endif
  102 
  103 #define CMDSIZE 8
  104 typedef struct seq_event_rec {
  105         u_char  arr[CMDSIZE];
  106 } seq_event_rec;
  107 
  108 struct synth_info {
  109         char    name[30];
  110         int     device;
  111         int     synth_type;
  112 #define SYNTH_TYPE_FM                   0
  113 #define SYNTH_TYPE_SAMPLE               1
  114 #define SYNTH_TYPE_MIDI                 2
  115 
  116         int     synth_subtype;
  117 #define SYNTH_SUB_FM_TYPE_ADLIB         0x00
  118 #define SYNTH_SUB_FM_TYPE_OPL3          0x01
  119 #define SYNTH_SUB_MIDI_TYPE_MPU401      0x401
  120 
  121 #define SYNTH_SUB_SAMPLE_TYPE_BASIC     0x10
  122 #define SYNTH_SUB_SAMPLE_TYPE_GUS       SAMPLE_TYPE_BASIC
  123 
  124         int     nr_voices;
  125         int     instr_bank_size;
  126         u_int   capabilities;   
  127 #define SYNTH_CAP_OPL3                  0x00000002
  128 #define SYNTH_CAP_INPUT                 0x00000004
  129 };
  130 
  131 /* Sequencer timer */
  132 #define SEQUENCER_TMR_TIMEBASE          _IOWR('T', 1, int)
  133 #define SEQUENCER_TMR_START             _IO  ('T', 2)
  134 #define SEQUENCER_TMR_STOP              _IO  ('T', 3)
  135 #define SEQUENCER_TMR_CONTINUE          _IO  ('T', 4)
  136 #define SEQUENCER_TMR_TEMPO             _IOWR('T', 5, int)
  137 #define SEQUENCER_TMR_SOURCE            _IOWR('T', 6, int)
  138 #  define SEQUENCER_TMR_INTERNAL        0x00000001
  139 #if 0
  140 #  define SEQUENCER_TMR_EXTERNAL        0x00000002
  141 #  define SEQUENCER_TMR_MODE_MIDI       0x00000010
  142 #  define SEQUENCER_TMR_MODE_FSK        0x00000020
  143 #  define SEQUENCER_TMR_MODE_CLS        0x00000040
  144 #  define SEQUENCER_TMR_MODE_SMPTE      0x00000080
  145 #endif
  146 #define SEQUENCER_TMR_METRONOME         _IOW ('T', 7, int)
  147 #define SEQUENCER_TMR_SELECT            _IOW ('T', 8, int)
  148 
  149 
  150 #define MIDI_CTRL_BANK_SELECT_MSB       0
  151 #define MIDI_CTRL_MODULATION_MSB        1
  152 #define MIDI_CTRL_BREATH_MSB            2
  153 #define MIDI_CTRL_FOOT_MSB              4
  154 #define MIDI_CTRL_PORTAMENTO_TIME_MSB   5
  155 #define MIDI_CTRL_DATA_ENTRY_MSB        6
  156 #define MIDI_CTRL_CHANNEL_VOLUME_MSB    7
  157 #define MIDI_CTRL_BALANCE_MSB           8
  158 #define MIDI_CTRL_PAN_MSB               10
  159 #define MIDI_CTRL_EXPRESSION_MSB        11
  160 #define MIDI_CTRL_GENERAL_PURPOSE_1_MSB 16
  161 #define MIDI_CTRL_GENERAL_PURPOSE_2_MSB 17
  162 #define MIDI_CTRL_GENERAL_PURPOSE_3_MSB 18
  163 #define MIDI_CTRL_GENERAL_PURPOSE_4_MSB 19
  164 #define MIDI_CTRL_BANK_SELECT_LSB       32
  165 #define MIDI_CTRL_MODULATION_LSB        33
  166 #define MIDI_CTRL_BREATH_LSB            34
  167 #define MIDI_CTRL_FOOT_LSB              36
  168 #define MIDI_CTRL_PORTAMENTO_TIME_LSB   37
  169 #define MIDI_CTRL_DATA_ENTRY_LSB        38
  170 #define MIDI_CTRL_CHANNEL_VOLUME_LSB    39
  171 #define MIDI_CTRL_BALANCE_LSB           40
  172 #define MIDI_CTRL_PAN_LSB               42
  173 #define MIDI_CTRL_EXPRESSION_LSB        43
  174 #define MIDI_CTRL_GENERAL_PURPOSE_1_LSB 48
  175 #define MIDI_CTRL_GENERAL_PURPOSE_2_LSB 49
  176 #define MIDI_CTRL_GENERAL_PURPOSE_3_LSB 50
  177 #define MIDI_CTRL_GENERAL_PURPOSE_4_LSB 51
  178 #define MIDI_CTRL_HOLD_1                64
  179 #define MIDI_CTRL_PORTAMENTO            65
  180 #define MIDI_CTRL_SOSTENUTO             66
  181 #define MIDI_CTRL_SOFT_PEDAL            67
  182 #define MIDI_CTRL_HOLD_2                69
  183 #define MIDI_CTRL_SOUND_VARIATION       70
  184 #define MIDI_CTRL_HARMONIC_INTENSITY    71
  185 #define MIDI_CTRL_RELEASE_TIME          72
  186 #define MIDI_CTRL_ATTACK_TIME           73
  187 #define MIDI_CTRL_BRIGHTNESS            74
  188 #define MIDI_CTRL_DECAY_TIME            75
  189 #define MIDI_CTRL_VIBRATO_RATE          76
  190 #define MIDI_CTRL_VIBRATO_DEPTH         77
  191 #define MIDI_CTRL_VIBRATO_DECAY         78
  192 #define MIDI_CTRL_GENERAL_PURPOSE_5     80
  193 #define MIDI_CTRL_GENERAL_PURPOSE_6     81
  194 #define MIDI_CTRL_GENERAL_PURPOSE_7     82
  195 #define MIDI_CTRL_GENERAL_PURPOSE_8     83
  196 #define MIDI_CTRL_PORTAMENTO_CONTROL    84
  197 #define MIDI_CTRL_EFFECT_DEPTH_1        91
  198 #define MIDI_CTRL_EFFECT_DEPTH_2        92
  199 #define MIDI_CTRL_EFFECT_DEPTH_3        93
  200 #define MIDI_CTRL_EFFECT_DEPTH_4        94
  201 #define MIDI_CTRL_EFFECT_DEPTH_5        95
  202 #define MIDI_CTRL_RPN_INCREMENT         96
  203 #define MIDI_CTRL_RPN_DECREMENT         97
  204 #define MIDI_CTRL_NRPN_LSB              98
  205 #define MIDI_CTRL_NRPN_MSB              99
  206 #define MIDI_CTRL_RPN_LSB               100
  207 #define MIDI_CTRL_RPN_MSB               101
  208 #define MIDI_CTRL_SOUND_OFF             120
  209 #define MIDI_CTRL_RESET                 121
  210 #define MIDI_CTRL_ALLOFF                123
  211 
  212 #define MIDI_BEND_NEUTRAL       (1<<13)
  213 
  214 #define MIDI_NOTEOFF            0x80
  215 #define MIDI_NOTEON             0x90
  216 #define MIDI_KEY_PRESSURE       0xA0
  217 #define MIDI_CTL_CHANGE         0xB0
  218 #define MIDI_PGM_CHANGE         0xC0
  219 #define MIDI_CHN_PRESSURE       0xD0
  220 #define MIDI_PITCH_BEND         0xE0
  221 #define MIDI_SYSTEM_PREFIX      0xF0
  222 
  223 #define MIDI_IS_STATUS(d) ((d) >= 0x80)
  224 #define MIDI_IS_COMMON(d) ((d) >= 0xf0)
  225 
  226 #define MIDI_SYSEX_START        0xF0
  227 #define MIDI_SYSEX_END          0xF7
  228 
  229 #define MIDI_GET_STATUS(d) ((d) & 0xf0)
  230 #define MIDI_GET_CHAN(d) ((d) & 0x0f)
  231 
  232 #define MIDI_HALF_VEL 64
  233 
  234 #define SEQ_LOCAL               0x80
  235 #define SEQ_TIMING              0x81
  236 #define SEQ_CHN_COMMON          0x92
  237 #define SEQ_CHN_VOICE           0x93
  238 #define SEQ_SYSEX               0x94
  239 #define SEQ_FULLSIZE            0xfd
  240 
  241 #define SEQ_MK_CHN_VOICE(e, unit, cmd, chan, key, vel) (\
  242     (e)->arr[0] = SEQ_CHN_VOICE, (e)->arr[1] = (unit), (e)->arr[2] = (cmd),\
  243     (e)->arr[3] = (chan), (e)->arr[4] = (key), (e)->arr[5] = (vel),\
  244     (e)->arr[6] = 0, (e)->arr[7] = 0)
  245 #define SEQ_MK_CHN_COMMON(e, unit, cmd, chan, p1, p2, w14) (\
  246     (e)->arr[0] = SEQ_CHN_COMMON, (e)->arr[1] = (unit), (e)->arr[2] = (cmd),\
  247     (e)->arr[3] = (chan), (e)->arr[4] = (p1), (e)->arr[5] = (p2),\
  248     *(short*)&(e)->arr[6] = (w14))
  249 
  250 #if _BYTE_ORDER == _BIG_ENDIAN
  251 /* big endian */
  252 #define SEQ_PATCHKEY(id) (0xfd00|id)
  253 #else
  254 /* little endian */
  255 #define SEQ_PATCHKEY(id) ((id<<8)|0xfd)
  256 #endif
  257 struct sysex_info {
  258         u_int16_t       key;    /* Use SYSEX_PATCH or MAUI_PATCH here */
  259 #define SEQ_SYSEX_PATCH SEQ_PATCHKEY(0x05)
  260 #define SEQ_MAUI_PATCH  SEQ_PATCHKEY(0x06)
  261         int16_t device_no;      /* Synthesizer number */
  262         int32_t len;            /* Size of the sysex data in bytes */
  263         u_char  data[1];        /* Sysex data starts here */
  264 };
  265 #define SEQ_SYSEX_HDRSIZE ((u_long)((struct sysex_info *)0)->data)
  266 
  267 typedef unsigned char sbi_instr_data[32];
  268 struct sbi_instrument {
  269         u_int16_t key;  /* FM_PATCH or OPL3_PATCH */
  270 #define SBI_FM_PATCH    SEQ_PATCHKEY(0x01)
  271 #define SBI_OPL3_PATCH  SEQ_PATCHKEY(0x03)
  272         int16_t         device;
  273         int32_t         channel;
  274         sbi_instr_data  operators;
  275 };
  276 
  277 #define TMR_RESET               0
  278 #define TMR_WAIT_REL            1       /* Time relative to the prev time */
  279 #define TMR_WAIT_ABS            2       /* Absolute time since TMR_START */
  280 #define TMR_STOP                3
  281 #define TMR_START               4
  282 #define TMR_CONTINUE            5
  283 #define TMR_TEMPO               6
  284 #define TMR_ECHO                8
  285 #define TMR_CLOCK               9       /* MIDI clock */
  286 #define TMR_SPP                 10      /* Song position pointer */
  287 #define TMR_TIMESIG             11      /* Time signature */
  288 
  289 /* Old sequencer definitions */
  290 #define SEQOLD_CMDSIZE 4
  291 
  292 #define SEQOLD_NOTEOFF          0
  293 #define SEQOLD_NOTEON           1
  294 #define SEQOLD_WAIT             TMR_WAIT_ABS
  295 #define SEQOLD_PGMCHANGE        3
  296 #define SEQOLD_SYNCTIMER        TMR_START
  297 #define SEQOLD_MIDIPUTC         5
  298 #define SEQOLD_ECHO             TMR_ECHO
  299 #define SEQOLD_AFTERTOUCH       9
  300 #define SEQOLD_CONTROLLER       10
  301 #define SEQOLD_PRIVATE          0xfe
  302 #define SEQOLD_EXTENDED         0xff
  303 
  304 #endif /* !_SYS_MIDIIO_H_ */

Cache object: 498bc08144924e69729a9dac12ed6a33


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.