/* mpuconst.h */ /* * ---------------------------------------------------------------------- * Copyright 1986 Greg Hendershott. Permission is hereby granted to * use and distribute this material for non-commercial purposes. This * code may not be sold to others, nor used to develop a program which * will be sold to others. * ---------------------------------------------------------------------- */ #ifndef _MPUCONST_H_ #define _MPUCONST_H_ /* definitions of constants for (1) port addresses (2) bit masks (3) MPU command bytes (4) MPU message bytes */ /* PORT ADDRESSES */ #define DATAPORT 0x330 #define STATPORT 0x331 #define COMPORT 0x331 /* BIT MASKS */ #define DSR 0x80 #define DRR 0x40 /* COMMANDS ( HOST => MPU ) */ /* MODE COMMANDS */ /* Commands 0x00 to ox2B are permutations of three categories: record, play, and MIDI realtime commands. Each category has three or four settings, and is thus expressible in two bits. Therefore the following scheme was devised by the MPU designers: Record = bits 5 and 4 Play = bits 3 and 2 RealTime = bits 1 and 0 To send a command, three constants (one from each category) can be bitwise OR'ed to produce the single command byte. E.g., to start Recording, Playing, and other MIDI devices, use put_cmd(RECORD_START | PLAY_START | REALTIME_START); The resulting byte is 00101010b (2Ah, 42d). */ #define RECORD_NOP 0x00 #define RECORD_STOP 0x10 #define RECORD_START 0x20 #define PLAY_NOP 0x00 #define PLAY_STOP 0x04 #define PLAY_START 0x08 #define REALTIME_NOP 0x00 #define REALTIME_STOP 0x01 #define REALTIME_START 0x02 #define REALTIME_CONT 0x03 /* INITIALIZATION SWITCHES */ #define ALLNOTEOFF_OFF 0x30 #define REALTIMEMESSAGES_OFF 0x32 #define ALLTHRU_OFF 0x33 #define LEADINGTIMING_ON 0x34 #define MODEMESSAGES_ON 0x35 #define THRUACTIVESENSING_ON 0x36 #define THRUEXCLUSIVE_ON 0x37 #define COMMONTOHOST_ON 0x38 #define REALTIMETOHOST_ON 0x39 #define UART 0x3F /* "NORMAL" SWITCHES */ #define SYNCTO_INT 0x80 #define SYNCTO_FSK 0x81 #define SYNCTO_MIDI 0x82 #define METRO_ACCENT 0x83 #define METRO_OFF 0x84 #define METRO_ON 0x85 #define OFF_BENDER_TO_HOST 0x86 #define ON_BENDER_TO_HOST 0x87 #define OFF_ACCEPTABLETHRU 0x88 #define ON_ACCEPTABLETHRU 0x89 #define DATAINSTOP_OFF 0x8A #define DATAINSTOP_ON 0x8B #define SENDMEASUREEND_OFF 0x8C #define SENDMEASUREEND_ON 0x8D #define CONDUCTOR_OFF 0x8E #define CONDUCTOR_ON 0x8F #define REALTIMEAFFECTION_OFF 0x90 #define REALTIMEAFFECTION_ON 0x91 #define FSK_RESOLUTION_INT 0x92 #define FSK_RESOLUTION_24 0x93 #define CLOCKTOHOST_OFF 0x94 #define CLOCKTOHOST_ON 0x95 #define SYSXTOHOST_OFF 0x96 #define SYSXTOHOST_ON 0x97 #define TABLEA_OFF 0x98 #define TABLEA_ON 0x99 #define TABLEB_OFF 0x9A #define TABLEB_ON 0x9B #define TABLEC_OFF 0x9C #define TABLEC_ON 0x9D #define TABLED_OFF 0x9E #define TABLED_ON 0x9F /* REQUEST DATA -- MPU will send a data byte back */ #define REQ_VERSION 0xAC #define REQ_TEMPO 0xAF /* MISC. COMMANDS */ #define CLEAR_PLAYCOUNTERS 0xB8 #define CLEAR_PLAYTABLE 0xB9 #define CLEAR_RECORDCOUNTER 0xBA #define TIMEBASE_48 0xC2 #define TIMEBASE_72 0xC3 #define TIMEBASE_96 0xC4 #define TIMEBASE_120 0xC5 #define TIMEBASE_144 0xC6 #define TIMEBASE_168 0xC7 #define TIMEBASE_192 0xC8 /* "WANT TO SEND" COMMANDS -- should be followed by a syntactically correct MIDI message (no leading timing byte, as it bypasses the timed send facility. */ /* the want-to-send data command byte should be OR'ed with the track num (0..7) */ #define SEND_DATA 0xD0 #define SEND_SYSX 0xDF /* SETTING COMMANDS -- a data byte (the setting value) must follow */ #define SET_TEMPO 0xE0 #define SET_RELATIVETEMPO 0xE1 #define SET_GRADUATION 0xE2 #define SET_CPB 0xE4 #define SET_BPM 0xE6 #define SET_CLOCKTOHOST 0xE7 #define SET_ACTIVETRACKS 0xEC #define SET_PLAYCOUNTER 0xED #define SET_ACCEPTCHANS_1TO8 0xEE #define SET_ACCEPTCHANS_9TO16 0xEF #define RESET_MPU 0xFF /* MARKS ( MPU => HOST ) {these preceded by leading timing bytes}*/ #define NOP 0xF8 #define MEASUREEND 0xF9 #define DATAEND 0xFC /* MESSAGES ( MPU => HOST {these NOT preceded by leading timing bytes}*/ #define REQ_DATA 0xF0 /* OR'd with track num (0..7) */ #define OVERFLOW 0xF8 #define REQ_CONDUCTOR 0xF9 #define ALLEND 0xFC #define CLOCK 0xFD #define ACK 0xFE #define SYS 0xFF #define VAL_OVERFLOW 240 /* ticks an OVERFLOW is worth */ #define ttval(t) (((t)==OVERFLOW)?VAL_OVERFLOW:(t)) /* True Time VALue */ #endif /*eof mpuconst.h*/