home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d563 / m2midi.lha / M2Midi / MidiLib.LZH / include.i / midi / midi.i next >
Text File  |  1989-06-25  |  8KB  |  378 lines

  1. ; midi/midi.i
  2.  
  3.     ifnd    MIDI_MIDI_I
  4. MIDI_MIDI_I set 1
  5.  
  6. ; Definitions pertaining to MIDI are derived from MIDI 1.0 Detailed
  7. ; Specification v4.0 (published by the Internation MIDI Association)
  8. ; and is current as of June, 1988.
  9.  
  10. ; v2.0 - 23-Oct-88
  11.  
  12.  
  13.     ifnd    EXEC_LISTS_I
  14.     include "exec/lists.i"
  15.     endc
  16.  
  17.     ifnd    EXEC_PORTS_I
  18.     include "exec/ports.i"
  19.     endc
  20.  
  21.  
  22. MIDINAME macro
  23.      dc.b     'midi.library',0
  24.      endm
  25.  
  26. MIDIVERSION equ 7
  27.  
  28.  
  29. ; Routes
  30.  
  31. RIM_MAXCOUNT    equ  3
  32.  
  33.     STRUCTURE    RIMatch,0
  34.     UBYTE    rim_Flags   ; flag bits defined below
  35.     STRUCT    rim_Match,RIM_MAXCOUNT
  36.     LABEL    sizeof_RIMatch
  37.  
  38.  
  39. RIMF_COUNTBITS    equ  $03    ; mask for # of match values (0 for match all)
  40.  
  41.     BITDEF  RIM,EXTID,6     ; indicates all 3 bytes of rim_match = one 3 byte manuf. id
  42.     BITDEF  RIM,EXCLUDE,7   ; reverses logic of RIMatch so that all except those specified pass
  43.  
  44.  
  45.     STRUCTURE    MRouteInfo,0
  46.     UWORD    ri_MsgFlags
  47.     UWORD    ri_ChanFlags
  48.     BYTE    ri_ChanOffset
  49.     BYTE    ri_NoteOffset
  50.     STRUCT    ri_SysExMatch,sizeof_RIMatch
  51.     STRUCT    ri_CtrlMatch,sizeof_RIMatch
  52.     LABEL    sizeof_MRouteInfo
  53.  
  54. ; Midi Msg Type Flags for RouteInfo and returned by MidiMsgType
  55.  
  56. MMF_CHAN    equ  $00ff
  57.  
  58.     BITDEF  MM,NOTEOFF,0
  59.     BITDEF  MM,NOTEON,1
  60.     BITDEF  MM,POLYPRESS,2
  61.     BITDEF  MM,CTRL,3
  62.     BITDEF  MM,PROG,4
  63.     BITDEF  MM,CHANPRESS,5
  64.     BITDEF  MM,PITCHBEND,6
  65.     BITDEF  MM,MODE,7
  66.  
  67.     BITDEF  MM,SYSCOM,8
  68.     BITDEF  MM,SYSRT,9
  69.     BITDEF  MM,SYSEX,10
  70.  
  71. MMF_ALL     equ  $07ff        ; all normal messages
  72.  
  73.  
  74.     STRUCTURE    MRoutePtr,MLN_SIZE
  75.     APTR    rp_Route
  76.     LABEL    sizeof_MRoutePtr
  77.  
  78.     STRUCTURE    MRoute,0
  79.     APTR    mr_Source
  80.     APTR    mr_Dest
  81.     STRUCT    mr_SRoutePtr,sizeof_MRoutePtr
  82.     STRUCT    mr_DRoutePtr,sizeof_MRoutePtr
  83.     STRUCT    mr_RouteInfo,sizeof_MRouteInfo
  84.     LABEL    sizeof_MRoute
  85.  
  86.  
  87. ; Nodes
  88.  
  89.     STRUCTURE    MSource,LN_SIZE
  90.     APTR    ms_Image
  91.     STRUCT    ms_RPList,MLH_SIZE
  92.     APTR    ms_UserData
  93.     UWORD    ms_RouteMsgFlags
  94.     UWORD    ms_RouteChanFlags
  95.     LABEL    sizeof_MSource
  96.  
  97. ; Node Types for MSource nodes
  98. NT_MSOURCE    equ  $20
  99. NT_RESMSOURCE    equ  $21
  100.  
  101.  
  102.     STRUCTURE    MDest,LN_SIZE
  103.     APTR    md_Image
  104.     STRUCT    md_RPList,MLH_SIZE
  105.     APTR    md_DestPort
  106.     APTR    md_UserData
  107.     STRUCT    md_DefaultRouteInfo,sizeof_MRouteInfo
  108.     LABEL    sizeof_MDest
  109.  
  110. ; Node Types for MDest nodes
  111. NT_MDEST    equ  $22
  112. NT_RESMDEST    equ  $23
  113.  
  114.  
  115. ; MIDI Packet
  116.  
  117.     STRUCTURE    MidiPacket,MN_SIZE    ; packet received by GetMidiPacket()
  118.     UWORD    mpkt_Type        ; MMF_ bits for this message (as returned by MidiMsgType())
  119.     UWORD    mpkt_Length        ; length of msg in bytes (as returned by MidiMsgLength())
  120.     STRUCT    mpkt_reserved,4     ; reserved for future expansion
  121.     STRUCT    mpkt_MidiMsg,4        ; actual MIDI message
  122.     LABEL    sizeof_MidiPacket
  123.  
  124.  
  125. ; Public List Change Signal
  126.  
  127.     STRUCTURE    MListSignal,MLN_SIZE
  128.     APTR    mls_SigTask
  129.     UBYTE    mls_SigBit
  130.     UBYTE    mls_Flags
  131.     LABEL    sizeof_MListSignal
  132.  
  133.     ; user flags
  134.     BITDEF  MLS,SOURCE,0
  135.     BITDEF  MLS,DEST,1
  136.  
  137.  
  138. ; MIDI message definitions
  139.  
  140. ; Status Bytes
  141.  
  142.    ; Channel Voice Messages (1sssnnnn)
  143. MS_NOTEOFF    equ $80
  144. MS_NOTEON     equ $90
  145. MS_POLYPRESS  equ $A0
  146. MS_CTRL       equ $B0
  147. MS_MODE       equ $B0
  148. MS_PROG       equ $C0
  149. MS_CHANPRESS  equ $D0
  150. MS_PITCHBEND  equ $E0
  151.  
  152.    ; System Common Messages
  153. MS_SYSEX      equ $F0
  154. MS_QTRFRAME   equ $F1
  155. MS_SONGPOS    equ $F2
  156. MS_SONGSELECT equ $F3
  157. MS_TUNEREQ    equ $F6
  158. MS_EOX          equ $F7
  159.  
  160.    ; System Real Time Messages
  161. MS_CLOCK      equ $F8
  162. MS_START      equ $FA
  163. MS_CONTINUE   equ $FB
  164. MS_STOP       equ $FC
  165. MS_ACTVSENSE  equ $FE
  166. MS_RESET      equ $FF
  167.  
  168.  
  169. ; Miscellaneous
  170.  
  171. MIDDLEC     equ 60        ; middle C note value
  172. DEFAULTVELOCITY equ 64        ; default Note On or Off velocity
  173. PITCHBENDCENTER equ $2000   ; pitch bend center position as a 14 bit word
  174. MCLKSPERQTR    equ 24        ; MIDI clocks per qtr-note
  175. MCLKSPERSP    equ 6        ; MIDI clocks per song position index
  176. MCCENTER    equ 64        ; center value for controllers like Pan and Balance
  177.  
  178.  
  179. ; Standard Controllers
  180.  
  181.    ; continuous 14 bit - MSB: 0-1f, LSB: 20-3f
  182. MC_MODWHEEL  equ $01
  183. MC_BREATH    equ $02
  184. MC_FOOT      equ $04
  185. MC_PORTATIME equ $05
  186. MC_DATAENTRY equ $06
  187. MC_VOLUME    equ $07
  188. MC_BALANCE   equ $08
  189. MC_PAN         equ $0a
  190. MC_EXPRESSION equ $0b
  191. MC_GENERAL1  equ $10
  192. MC_GENERAL2  equ $11
  193. MC_GENERAL3  equ $12
  194. MC_GENERAL4  equ $13
  195.  
  196.    ; continuous 7 bit (switches: 0-3f=off, 40-7f=on)
  197. MC_SUSTAIN   equ $40
  198. MC_PORTA     equ $41
  199. MC_SUSTENUTO equ $42
  200. MC_SOFTPEDAL equ $43
  201. MC_HOLD2     equ $45
  202. MC_GENERAL5  equ $50
  203. MC_GENERAL6  equ $51
  204. MC_GENERAL7  equ $52
  205. MC_GENERAL8  equ $53
  206. MC_EXTDEPTH  equ $5b
  207. MC_TREMOLODEPTH equ $5c
  208. MC_CHORUSDEPTH    equ $5d
  209. MC_CELESTEDEPTH equ $5e
  210. MC_PHASERDEPTH    equ $5f
  211.  
  212.     ; parameters
  213. MC_DATAINCR  equ $60
  214. MC_DATADECR  equ $61
  215. MC_NRPNL     equ $62
  216. MC_NRPNH     equ $63
  217. MC_RPNL      equ $64
  218. MC_RPNH      equ $65
  219.  
  220. MM_MAX         equ $78
  221.  
  222.  
  223. ; Channel Modes
  224.  
  225. MM_MIN       equ $79
  226.  
  227. MM_RESETCTRL equ $79
  228. MM_LOCAL   equ $7a
  229. MM_ALLOFF  equ $7b
  230. MM_OMNIOFF equ $7c
  231. MM_OMNION  equ $7d
  232. MM_MONO    equ $7e
  233. MM_POLY    equ $7f
  234.  
  235.  
  236. ; Registered Parameter Numbers
  237.  
  238. ; These are 16 bit values that need to be separated into two bytes for use
  239. ; with the MC_RPNH & MC_RPNL messages using 8 bit math (as opposed to 7
  240. ; bit math).  This is done so that the defines match the numbers from the
  241. ; MMA.    See MIDI 1.0 Detailed Spec v4.0 pp 12, 23 for more info.
  242.  
  243. MRP_PBSENS    equ $0000
  244. MRP_FINETUNE    equ $0001
  245. MRP_COURSETUNE    equ $0002
  246.  
  247.  
  248. ; MTC Quarter Frame messages
  249.  
  250. ; Qtr Frame message is F1 0nnndddd where
  251. ;
  252. ;     nnn is a message type defined below
  253. ;     dddd is 4 bit data nibble for those message types
  254. ;
  255. ; Each pair of nibbles is combined by the receiver into a single byte.
  256. ; There are masks and type values defined for some of these data bytes
  257. ; below.
  258.  
  259.     ; message types
  260. MTCQ_FRAMEL equ $00
  261. MTCQ_FRAMEH equ $10
  262. MTCQ_SECL   equ $20
  263. MTCQ_SECH   equ $30
  264. MTCQ_MINL   equ $40
  265. MTCQ_MINH   equ $50
  266. MTCQ_HOURL  equ $60
  267. MTCQ_HOURH  equ $70       ; also contains time code type
  268.  
  269.     ; message masks
  270. MTCQ_TYPEMASK equ $70       ; mask for type bits in message
  271. MTCQ_DATAMASK equ $0f       ; mask for data bits in message
  272.  
  273.     ; hour byte
  274. MTCH_TYPEMASK equ $60       ; mask for time code type
  275. MTCH_HOURMASK equ $1f       ; hours mask (range 0-23)
  276.  
  277.     ; time code type values for hour byte
  278. MTCT_24FPS        equ $00
  279. MTCT_25FPS        equ $20
  280. MTCT_30FPS_DROP     equ $40
  281. MTCT_30FPS_NONDROP  equ $60
  282.  
  283.  
  284. ; Sys/Ex ID numbers
  285.  
  286. ; Now includes 3 byte extension for the American Group.  This new
  287. ; format uses a $00 as the sys/ex id followed by two additional bytes
  288. ; that actually identify the manufacturer.  These new extended id
  289. ; constants are 32 bit values (24 significant bits) that you will have
  290. ; to break apart manually.
  291.  
  292. ; You can match or filter off one of the extended id's when using the
  293. ; RIMF_EXTID bit described above.
  294.  
  295.     ; American Group
  296. MID_XAMERICA        equ $00
  297. MID_SEQUENTIAL        equ $01
  298. MID_IDP         equ $02
  299. MID_OCTAVEPLATEAU   equ $03
  300. MID_MOOG        equ $04
  301. MID_PASSPORT        equ $05
  302. MID_LEXICON        equ $06
  303. MID_KURZWEIL        equ $07
  304. MID_FENDER        equ $08
  305. MID_AKG         equ $0a
  306. MID_VOYCE        equ $0b
  307. MID_WAVEFRAME        equ $0c
  308. MID_ADA         equ $0d
  309. MID_GARFIELD        equ $0e
  310. MID_ENSONIQ        equ $0f
  311. MID_OBERHEIM        equ $10
  312. MID_APPLE        equ $11
  313. MID_GREYMATTER        equ $12
  314. MID_PALMTREE        equ $14
  315. MID_JLCOOPER        equ $15
  316. MID_LOWREY        equ $16
  317. MID_ADAMSSMITH        equ $17
  318. MID_EMU         equ $18
  319. MID_HARMONY        equ $19
  320. MID_ART         equ $1a
  321. MID_BALDWIN        equ $1b
  322. MID_EVENTIDE        equ $1c
  323. MID_INVENTRONICS    equ $1d
  324. MID_CLARITY        equ $1f
  325.  
  326. MIDX_DIGITALMUSIC   equ $000007
  327. MIDX_IOTA        equ $000008
  328. MIDX_IVL        equ $00000b
  329. MIDX_SOUTHERNMUSIC  equ $00000c
  330. MIDX_LAKEBUTLER     equ $00000d
  331. MIDX_DOD        equ $000010
  332. MIDX_PERFECTFRET    equ $000014
  333. MIDX_OPCODE        equ $000016
  334. MIDX_SPATIALSOUND   equ $000018
  335. MIDX_KMX        equ $000019
  336. MIDX_AXXES        equ $000020
  337.  
  338.  
  339.     ; European Group
  340. MID_PASSAC        equ $20
  341. MID_SIEL        equ $21
  342. MID_SYNTHAXE        equ $22
  343. MID_HOHNER        equ $24
  344. MID_TWISTER        equ $25
  345. MID_SOLTON        equ $26
  346. MID_JELLINGHAUS     equ $27
  347. MID_SOUTHWORTH        equ $28
  348. MID_PPG         equ $29
  349. MID_JEN         equ $2a
  350. MID_SSL         equ $2b
  351. MID_AUDIOVERITRIEB  equ $2c
  352. MID_ELKA        equ $2f
  353. MID_DYNACORD        equ $30
  354.  
  355.     ; Japanese Group
  356. MID_KAWAI        equ $40
  357. MID_ROLAND        equ $41
  358. MID_KORG        equ $42
  359. MID_YAMAHA        equ $43
  360. MID_CASIO        equ $44
  361. MID_MORIDAIRA        equ $45
  362. MID_KAMIYA        equ $46
  363. MID_AKAI        equ $47
  364. MID_JAPANVICTOR     equ $48
  365. MID_MEISOSHA        equ $49
  366. MID_HOSHINOGAKKI    equ $4a
  367. MID_FUJITSU        equ $4b
  368. MID_SONY        equ $4c
  369. MID_NISSHINONPA     equ $4d
  370. MID_SYSTEMPRODUCT   equ $4f
  371.  
  372.     ; Universal ID Numbers
  373. MID_NC        equ $7d
  374. MID_NRT     equ $7e
  375. MID_RT        equ $7f
  376.  
  377.     endc
  378.