home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 066.lha / MidiDev / midi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-20  |  4.1 KB  |  196 lines

  1. #ifndef MIDI_MIDI_H
  2. #define MIDI_MIDI_H
  3.  
  4. #ifndef EXEC_LISTS_H
  5.  #include <exec/lists.h>
  6. #endif
  7.  
  8. #ifndef EXEC_PORTS_H
  9.  #include <exec/ports.h>
  10. #endif
  11.  
  12. /* midi.library structures & defines */
  13.  
  14. #define MIDINAME    "midi.library"
  15. #define MIDIVERSION 1L
  16.  
  17.  
  18. struct MSource {
  19.     struct Node Node;
  20.     struct Image *Image;
  21.     struct MinList RPList;
  22.     APTR UserData;        /* user data extension */
  23. };
  24.  
  25. /* node types for Source */
  26. #define NT_MSOURCE    0x20
  27. #define NT_PERMMSOURCE    0x21
  28.  
  29. struct MDest {
  30.     struct Node Node;
  31.     struct Image *Image;
  32.     struct MinList RPList;
  33.     struct MsgPort *DestPort;
  34.     APTR UserData;        /* user data extension */
  35. };
  36.  
  37. /* node types for Dest */
  38. #define NT_MDEST    0x22
  39. #define NT_PERMMDEST    0x23
  40.  
  41.  
  42. struct RIMatch {
  43.     UBYTE count;    /* 0 for match all */
  44.     UBYTE match[3];
  45. };
  46.  
  47. struct MRouteInfo {
  48.     UWORD MsgFlags;
  49.     UWORD ChanFlags;
  50.     BYTE  ChanOffset;
  51.     BYTE  NoteOffset;
  52.     struct RIMatch SysExMatch;
  53.     struct RIMatch CtrlMatch;
  54. };
  55.  
  56. /* Msg Flags for MRouteInfo structure and returned by MidiMsgType */
  57.  
  58. #define MMF_CHAN    0x00ff
  59. #define MMF_NOTEOFF    0x0001
  60. #define MMF_NOTEON    0x0002
  61. #define MMF_POLYPRESS    0x0004
  62. #define MMF_CTRL    0x0008
  63. #define MMF_PROG    0x0010
  64. #define MMF_CHANPRESS    0x0020
  65. #define MMF_PITCHBEND    0x0040
  66. #define MMF_MODE    0x0080
  67.  
  68. #define MMF_SYSCOM    0x0100
  69. #define MMF_SYSRT    0x0200
  70. #define MMF_SYSEX    0x0400
  71.  
  72. struct MRoutePtr {
  73.     struct MinNode node;
  74.     struct MRoute *Route;
  75. };
  76.  
  77. struct MRoute {
  78.     struct MSource *Source;
  79.     struct MDest *Dest;
  80.     struct MRoutePtr SRoutePtr, DRoutePtr;
  81.     struct MRouteInfo RouteInfo;
  82. };
  83.  
  84.  
  85.  
  86. /* MIDI message defines - based on IMA MIDI Spec 1.0 except where noted */
  87.  
  88. /* Status Bytes */
  89.  
  90.    /* Channel Voice Messages (1sssnnnn) */
  91. #define MS_NOTEOFF    0x80
  92. #define MS_NOTEON     0x90
  93. #define MS_POLYPRESS  0xA0
  94. #define MS_CTRL       0xB0
  95. #define MS_MODE       0xB0
  96. #define MS_PROG       0xC0
  97. #define MS_CHANPRESS  0xD0
  98. #define MS_PITCHBEND  0xE0
  99.  
  100.    /* System Common Messages */
  101. #define MS_SYSEX      0xF0
  102. #define MS_SONGPOS    0xF2
  103. #define MS_SONGSELECT 0xF3
  104. #define MS_TUNEREQ    0xF6
  105. #define MS_EOX          0xF7
  106.  
  107.    /* System Real Time Messages */
  108. #define MS_CLOCK      0xF8
  109. #define MS_START      0xFA
  110. #define MS_CONTINUE   0xFB
  111. #define MS_STOP       0xFC
  112. #define MS_ACTVSENSE  0xFE
  113. #define MS_RESET      0xFF
  114.  
  115.  
  116. /* Standard Controllers (from MMA - 8-86)
  117.  
  118.    /* proportional MSB - 0-31, LSB - 32-63 */
  119. #define MC_MODWHEEL  1
  120. #define MC_BREATH    2
  121. #define MC_FOOT      4
  122. #define MC_PORTATIME 5
  123. #define MC_DATAENTRY 6
  124. #define MC_VOLUME    7
  125. #define MC_BALANCE   8
  126. #define MC_PAN         10
  127.  
  128.    /* switches/pedals - either on(7F) or off(00) */
  129. #define MC_SUSTAIN   64
  130. #define MC_PORTA     65
  131. #define MC_SUSTENUTO 66
  132. #define MC_SOFTPEDAL 67
  133. #define MC_HOLD2     69
  134. #define MC_DATAINCR  96
  135. #define MC_DATADECR  97
  136.  
  137. /* Channel Modes */
  138.  
  139. #define MM_LOCAL     122
  140. #define MM_ALLOFF    123
  141. #define MM_OMNIOFF   124
  142. #define MM_OMNION    125
  143. #define MM_MONO      126
  144. #define MM_POLY      127
  145.  
  146.  
  147. /* Sys/Ex ID numbers (from MMA as described in IMA bulletin) */
  148.  
  149. #define MID_SCI      0x01
  150. #define MID_BIGBRIAR 0x02
  151. #define MID_OCTAVEPLATEAU 0x03
  152. #define MID_MOOG     0x04
  153. #define MID_PASSPORT 0x05
  154. #define MID_LEXICON  0x06
  155.  
  156. #define MID_OBERHEIM 0x10
  157. #define MID_PAIA     0x11
  158. #define MID_SIMMONS  0x12
  159. #define MID_FAIRLIGHT 0x14
  160.  
  161. #define MID_BONTEMPI 0x20
  162. #define MID_SIEL     0x21
  163. #define MID_SYNTHAXE 0x23
  164.  
  165. #define MID_KAWAI    0x40
  166. #define MID_ROLAND   0x41
  167. #define MID_KORG     0x42
  168. #define MID_YAMAHA   0x43
  169.  
  170. /* special Sys/Ex ID numbers: Non-Commercial, Non-Real Time, Real Time */
  171. #define MID_NC    0x7d
  172. #define MID_NRT 0x7e
  173. #define MID_RT    0x7f
  174.  
  175.  
  176. /* handy macros */
  177.  
  178.     /* pack high/low bytes of a word into midi format */
  179. #define MIDI_HIBYTE(word) ( (word) >> 7 & 0x7f )
  180. #define MIDI_LOBYTE(word) ( (word) & 0x7f )
  181.  
  182.     /* unpack 2 midi bytes into a word */
  183. #define MIDI_WORD(hi,lo) ( (hi & 0x7f) << 7 | (lo & 0x7f) )
  184.  
  185.  
  186. /* midi.library routine declarations */
  187.  
  188. struct MSource *CreateMSource(), *FindMSource();
  189. struct MDest *CreateMDest(), *FindMDest();
  190. struct MRoute *CreateMRoute(), *MRouteSource(), *MRouteDest(), *MRoutePublic();
  191. UBYTE *GetMidiMsg();
  192. BOOL PutMidiMsg();
  193. ULONG MidiMsgLength(), MidiMsgType();
  194.  
  195. #endif
  196.