Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (03/04/90)
Submitted-by: karl@sugar.uucp Posting-number: Volume 90, Issue 092 Archive-name: midi/new_midi.h Below is a modified version of midi.h for Bill Barton's midi.library. I ran the .FD file through the mapfd program (supplied with Aztec 5.0) to generate the amicall pragmas, and created the function prototypes from the call documentation. #!/bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 1 (of 1)." # Contents: midi.h # Wrapped by tadguy@xanth on Sat Mar 3 19:53:48 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'midi.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'midi.h'\" else echo shar: Extracting \"'midi.h'\" \(14416 characters\) sed "s/^X//" >'midi.h' <<'END_OF_FILE' X#ifndef MIDI_MIDI_H X#define MIDI_MIDI_H X X/* X Definitions pertaining to MIDI are derived from MIDI 1.0 Detailed X Specification v4.0 (published by the Internation MIDI Association) X and is current as of June, 1988. X X v2.0 - 23-Oct-88 X X added function prototypes and pragmas for Aztec 5.0 - Karl Lehenbauer X*/ X X#ifndef EXEC_LISTS_H X #include <exec/lists.h> X#endif X X#ifndef EXEC_PORTS_H X #include <exec/ports.h> X#endif X X X/* midi.library structures & defines */ X X#define MIDINAME "midi.library" X#define MIDIVERSION 7L X X X/* Routes */ X X#define RIM_MAXCOUNT 3 X Xstruct RIMatch { X UBYTE Flags; /* flag bits defined below */ X UBYTE Match[RIM_MAXCOUNT]; X}; X X#define RIMF_COUNTBITS 0x03 /* mask for # of match values (0 for match all) */ X#define RIMF_EXTID 0x40 /* indicates all 3 bytes of match[] == one 3 byte manuf. id (not valid for CtrlMatch) */ X#define RIMF_EXCLUDE 0x80 /* reverses logic of RIMatch so that all except those specified pass */ X X Xstruct MRouteInfo { X UWORD MsgFlags; /* flags enabling message types defined below (MMF_) (msg filters) */ X UWORD ChanFlags; /* incoming channel enable flags (LSB = chan 1, MSB = chan 16) (channel filters) */ X BYTE ChanOffset; /* signed offset applied to channels (simple channelizing) */ X BYTE NoteOffset; /* signed offset applied to note numbers (transposition) */ X struct RIMatch SysExMatch; /* Sys/Ex manufacturer id filtering */ X struct RIMatch CtrlMatch; /* Controller number filtering */ X}; X X/* Msg Flags for MRouteInfo structure and returned by MidiMsgType */ X X#define MMF_CHAN 0x00ff X#define MMF_NOTEOFF 0x0001 X#define MMF_NOTEON 0x0002 X#define MMF_POLYPRESS 0x0004 X#define MMF_CTRL 0x0008 X#define MMF_PROG 0x0010 X#define MMF_CHANPRESS 0x0020 X#define MMF_PITCHBEND 0x0040 X#define MMF_MODE 0x0080 X X#define MMF_SYSCOM 0x0100 X#define MMF_SYSRT 0x0200 X#define MMF_SYSEX 0x0400 X X#define MMF_ALL 0x07ff /* all normal messages */ X X Xstruct MRoutePtr { X struct MinNode node; X struct MRoute *Route; X}; X Xstruct MRoute { X struct MSource *Source; X struct MDest *Dest; X struct MRoutePtr SRoutePtr, DRoutePtr; X struct MRouteInfo RouteInfo; X}; X X X/* Nodes */ X Xstruct MSource { X struct Node Node; X struct Image *Image; X struct MinList RPList; X APTR UserData; /* user data extension */ X X /* new stuff for v2.0 */ X UWORD RouteMsgFlags; /* mask of all route->MsgFlags for this MSource */ X UWORD RouteChanFlags; /* mask of all route->ChanFlags for this MSource */ X}; X X/* node types for Source */ X#define NT_MSOURCE 0x20 X#define NT_RESMSOURCE 0x21 X X Xstruct MDest { X struct Node Node; X struct Image *Image; X struct MinList RPList; X struct MsgPort *DestPort; X APTR UserData; /* user data extension */ X X /* new stuff for v2.0 */ X struct MRouteInfo DefaultRouteInfo; /* used when Routing function doesn't supply a RouteInfo */ X}; X X/* node types for Dest */ X#define NT_MDEST 0x22 X#define NT_RESMDEST 0x23 X X X/* MIDI Packet (new for v2.0) */ X Xstruct MidiPacket { /* returned by GetMidiPacket() */ X struct Message ExecMsg; X UWORD Type; /* MMF_ bit for this message (as returned by MidiMsgType()) */ X UWORD Length; /* length of msg in bytes (as returned by MidiMsgLength()) */ X ULONG reserved; /* reserved for future expansion */ X UBYTE MidiMsg[4]; /* actual MIDI message (real length of this array is Length, always at least this much memory allocated) */ X}; X X X/* Public List Change Signal */ X Xstruct MListSignal { X struct MinNode Node; X struct Task *SigTask; /* task to signal */ X UBYTE SigBit; /* signal bit to use */ X UBYTE Flags; /* flags, see below */ X}; X X /* user flags */ X#define MLSF_SOURCE 0x01L /* causes signal when SourceList changes */ X#define MLSF_DEST 0x02L /* causes signal when DestList changes */ X X X/* MIDI message defininition */ X X/* Status Bytes */ X X /* Channel Voice Messages (1sssnnnn) (OR with channel number) */ X#define MS_NOTEOFF 0x80 X#define MS_NOTEON 0x90 X#define MS_POLYPRESS 0xA0 X#define MS_CTRL 0xB0 X#define MS_MODE 0xB0 X#define MS_PROG 0xC0 X#define MS_CHANPRESS 0xD0 X#define MS_PITCHBEND 0xE0 X X /* System Common Messages (11110sss) */ X#define MS_SYSEX 0xF0 X#define MS_QTRFRAME 0xF1 X#define MS_SONGPOS 0xF2 X#define MS_SONGSELECT 0xF3 X#define MS_TUNEREQ 0xF6 X#define MS_EOX 0xF7 X X /* System Real Time Messages (11111sss) */ X#define MS_CLOCK 0xF8 X#define MS_START 0xFA X#define MS_CONTINUE 0xFB X#define MS_STOP 0xFC X#define MS_ACTVSENSE 0xFE X#define MS_RESET 0xFF X X/* Miscellaneous */ X X#define MIDDLEC 60 /* middle C note value */ X#define DEFAULTVELOCITY 64 /* default Note On or Off velocity */ X#define PITCHBENDCENTER 0x2000 /* pitch bend center position as a 14 bit word */ X#define MCLKSPERQTR 24 /* MIDI clocks per qtr-note */ X#define MCLKSPERSP 6 /* MIDI clocks per song position index */ X#define MCCENTER 64 /* center value for controllers like Pan and Balance */ X X X/* Standard Controllers */ X X /* continuous 14 bit - MSB: 0-1f, LSB: 20-3f */ X#define MC_MODWHEEL 0x01 X#define MC_BREATH 0x02 X#define MC_FOOT 0x04 X#define MC_PORTATIME 0x05 X#define MC_DATAENTRY 0x06 X#define MC_VOLUME 0x07 X#define MC_BALANCE 0x08 X#define MC_PAN 0x0a X#define MC_EXPRESSION 0x0b X#define MC_GENERAL1 0x10 X#define MC_GENERAL2 0x11 X#define MC_GENERAL3 0x12 X#define MC_GENERAL4 0x13 X X /* continuous 7 bit (switches: 0-3f=off, 40-7f=on) */ X#define MC_SUSTAIN 0x40 X#define MC_PORTA 0x41 X#define MC_SUSTENUTO 0x42 X#define MC_SOFTPEDAL 0x43 X#define MC_HOLD2 0x45 X#define MC_GENERAL5 0x50 X#define MC_GENERAL6 0x51 X#define MC_GENERAL7 0x52 X#define MC_GENERAL8 0x53 X#define MC_EXTDEPTH 0x5b X#define MC_TREMOLODEPTH 0x5c X#define MC_CHORUSDEPTH 0x5d X#define MC_CELESTEDEPTH 0x5e X#define MC_PHASERDEPTH 0x5f X X /* parameters */ X#define MC_DATAINCR 0x60 X#define MC_DATADECR 0x61 X#define MC_NRPNL 0x62 X#define MC_NRPNH 0x63 X#define MC_RPNL 0x64 X#define MC_RPNH 0x65 X X#define MC_MAX 0x78 /* max controller value */ X X X/* Channel Modes */ X X#define MM_MIN 0x79 /* min mode value */ X X#define MM_RESETCTRL 0x79 X#define MM_LOCAL 0x7a X#define MM_ALLOFF 0x7b X#define MM_OMNIOFF 0x7c X#define MM_OMNION 0x7d X#define MM_MONO 0x7e X#define MM_POLY 0x7f X X X/* Registered Parameter Numbers */ X/* X These are 16 bit values that need to be separated into two bytes for X use with the MC_RPNH & MC_RPNL messages using 8 bit math (hi = MRP_ X >> 8, lo = MRP_ & 0xff) as opposed to 7 bit math. This is done X so that the defines match the numbers from the MMA. See MIDI 1.0 X Detailed Spec v4.0 pp 12, 23 for more info. X*/ X X#define MRP_PBSENS 0x0000 X#define MRP_FINETUNE 0x0001 X#define MRP_COURSETUNE 0x0002 X X X/* MTC Quarter Frame messages */ X/* X Qtr Frame message is F1 0nnndddd where X X nnn is a message type defined below X dddd is 4 bit data nibble for those message types X X Each pair of nibbles is combined by the receiver into a single byte. X There are masks and type values defined for some of these data bytes X below. X*/ X X /* message types */ X#define MTCQ_FRAMEL 0x00 X#define MTCQ_FRAMEH 0x10 X#define MTCQ_SECL 0x20 X#define MTCQ_SECH 0x30 X#define MTCQ_MINL 0x40 X#define MTCQ_MINH 0x50 X#define MTCQ_HOURL 0x60 X#define MTCQ_HOURH 0x70 /* also contains time code type */ X X /* message masks */ X#define MTCQ_TYPEMASK 0x70 /* mask for type bits in message */ X#define MTCQ_DATAMASK 0x0f /* mask for data bits in message */ X X /* hour byte */ X#define MTCH_TYPEMASK 0x60 /* mask for time code type */ X#define MTCH_HOURMASK 0x1f /* hours mask (range 0-23) */ X X /* time code type values for hour byte */ X#define MTCT_24FPS 0x00 X#define MTCT_25FPS 0x20 X#define MTCT_30FPS_DROP 0x40 X#define MTCT_30FPS_NONDROP 0x60 X X X/* Sys/Ex ID numbers */ X/* X Now includes 3 byte extension for the American Group. This new X format uses a 0x00 as the sys/ex id followed by two additional bytes X that actually identify the manufacturer. These new extended id X constants are 32 bit values (24 significant bits) that can be X managed using SPLIT_MIDX() and MAKE_MIDX() macros defined below. X X You can match or filter off one of the extended id's when using the X RIMF_EXTID bit described above. X X example RIMatch X { X RIMF_EXTID | 1, extend id, match one manufacturer X SPLIT_MIDX (MIDX_IOTA) splits id into 3 bytes X } X*/ X X /* American Group */ X#define MID_XAMERICA 0x00 X#define MID_SEQUENTIAL 0x01 X#define MID_IDP 0x02 X#define MID_OCTAVEPLATEAU 0x03 X#define MID_MOOG 0x04 X#define MID_PASSPORT 0x05 X#define MID_LEXICON 0x06 X#define MID_KURZWEIL 0x07 X#define MID_FENDER 0x08 X#define MID_AKG 0x0a X#define MID_VOYCE 0x0b X#define MID_WAVEFRAME 0x0c X#define MID_ADA 0x0d X#define MID_GARFIELD 0x0e X#define MID_ENSONIQ 0x0f X#define MID_OBERHEIM 0x10 X#define MID_APPLE 0x11 X#define MID_GREYMATTER 0x12 X#define MID_PALMTREE 0x14 X#define MID_JLCOOPER 0x15 X#define MID_LOWREY 0x16 X#define MID_ADAMSSMITH 0x17 X#define MID_EMU 0x18 X#define MID_HARMONY 0x19 X#define MID_ART 0x1a X#define MID_BALDWIN 0x1b X#define MID_EVENTIDE 0x1c X#define MID_INVENTRONICS 0x1d X#define MID_CLARITY 0x1f X X#define MIDX_DIGITALMUSIC 0x000007L X#define MIDX_IOTA 0x000008L X#define MIDX_IVL 0x00000bL X#define MIDX_SOUTHERNMUSIC 0x00000cL X#define MIDX_LAKEBUTLER 0x00000dL X#define MIDX_DOD 0x000010L X#define MIDX_PERFECTFRET 0x000014L X#define MIDX_OPCODE 0x000016L X#define MIDX_SPATIALSOUND 0x000018L X#define MIDX_KMX 0x000019L X#define MIDX_AXXES 0x000020L X X /* European Group */ X#define MID_PASSAC 0x20 X#define MID_SIEL 0x21 X#define MID_SYNTHAXE 0x22 X#define MID_HOHNER 0x24 X#define MID_TWISTER 0x25 X#define MID_SOLTON 0x26 X#define MID_JELLINGHAUS 0x27 X#define MID_SOUTHWORTH 0x28 X#define MID_PPG 0x29 X#define MID_JEN 0x2a X#define MID_SSL 0x2b X#define MID_AUDIOVERITRIEB 0x2c X#define MID_ELKA 0x2f X#define MID_DYNACORD 0x30 X X /* Japanese Group */ X#define MID_KAWAI 0x40 X#define MID_ROLAND 0x41 X#define MID_KORG 0x42 X#define MID_YAMAHA 0x43 X#define MID_CASIO 0x44 X#define MID_MORIDAIRA 0x45 X#define MID_KAMIYA 0x46 X#define MID_AKAI 0x47 X#define MID_JAPANVICTOR 0x48 X#define MID_MEISOSHA 0x49 X#define MID_HOSHINOGAKKI 0x4a X#define MID_FUJITSU 0x4b X#define MID_SONY 0x4c X#define MID_NISSHINONPA 0x4d X#define MID_SYSTEMPRODUCT 0x4f X X /* Universal ID Numbers */ X#define MID_UNC 0x7d X#define MID_UNRT 0x7e X#define MID_URT 0x7f X X/* handy macros */ X X /* pack high/low bytes of a word into midi format (7/14 bit math) */ X#define MIDI_HIBYTE(word) ( (word) >> 7 & 0x7f ) X#define MIDI_LOBYTE(word) ( (word) & 0x7f ) X X /* unpack 2 midi bytes into a word (7/14 bit math) */ X#define MIDI_WORD(hi,lo) ( (hi & 0x7f) << 7 | (lo & 0x7f) ) X X /* unpack a 3 byte sys/ex id into single bytes for argument lists and RIMatch initializers */ X#define SPLIT_MIDX(id) (UBYTE)((id)>>16), (UBYTE)((id)>>8), (UBYTE)(id) X X /* make a 3 byte sys/ex id from single bytes (MAKE_MIDX(msg[1],msg[2],msg[3]) */ X#define MAKE_MIDX(id0,id1,id2) ((ULONG)((id0) & 0xff)<<16 | (ULONG)((id1) & 0xff)<<8 | (ULONG)((id2) & 0xff)) X X X X/* midi.library function prototype declarations */ X Xvoid LockMidiBase(void); X#pragma amicall(MidiBase, 0x1e, LockMidiBase()) X Xvoid UnlockMidiBase(void); X#pragma amicall(MidiBase, 0x24, UnlockMidiBase()) X Xstruct MSource *CreateMSource(char *name, struct Image *image); X#pragma amicall(MidiBase, 0x2a, CreateMSource(a0,a1)) X Xvoid DeleteMSource(struct MSource *source); X#pragma amicall(MidiBase, 0x30, DeleteMSource(a0)) X Xstruct MSource *FindMSource(char *name); X#pragma amicall(MidiBase, 0x36, FindMSource(a0)) X Xstruct MDest *CreateMDest(char *name, struct Image *image); X#pragma amicall(MidiBase, 0x3c, CreateMDest(a0,a1)) X Xvoid DeleteMDest(struct MDest *dest); X#pragma amicall(MidiBase, 0x42, DeleteMDest(a0)) X Xstruct MDest *FindMDest(char *name); X#pragma amicall(MidiBase, 0x48, FindMDest(a0)) X Xstruct MRoute *CreateMRoute(struct MSource *source, struct MDest *dest, struct MRouteInfo *routeinfo); X#pragma amicall(MidiBase, 0x4e, CreateMRoute(a0,a1,a2)) X Xvoid ModifyMRoute(struct MRoute *route, struct MRouteInfo *newrouteinfo); X#pragma amicall(MidiBase, 0x54, ModifyMRoute(a0,a1)) X Xvoid DeleteMRoute(struct MRoute *route); X#pragma amicall(MidiBase, 0x5a, DeleteMRoute(a0)) X Xstruct MRoute *MRouteSource(struct MSource *source, char *destname, struct MRouteInfo *routeinfo); X#pragma amicall(MidiBase, 0x60, MRouteSource(a0,a1,a2)) X Xstruct MRoute *MRouteDest(char *sourcename, struct MDest *dest, struct MRouteInfo *routeinfo); X#pragma amicall(MidiBase, 0x66, MRouteDest(a0,a1,a2)) X Xstruct MRoute *MRoutePublic(char *sourcename, char *destname, struct MRouteInfo *routeinfo); X#pragma amicall(MidiBase, 0x6c, MRoutePublic(a0,a1,a2)) X XUBYTE *GetMidiMsg(struct MDest *dest); X#pragma amicall(MidiBase, 0x72, GetMidiMsg(a0)) X Xvoid PutMidiMsg(struct MSource *source, UBYTE *msg); X#pragma amicall(MidiBase, 0x78, PutMidiMsg(a0,a1)) X Xvoid FreeMidiMsg(UBYTE *msg); X#pragma amicall(MidiBase, 0x7e, FreeMidiMsg(a0)) X XUWORD MidiMsgType(UBYTE *msg); X#pragma amicall(MidiBase, 0x84, MidiMsgType(a0)) X XULONG MidiMsgLength(UBYTE *msg); X#pragma amicall(MidiBase, 0x8a, MidiMsgLength(a0)) X Xvoid PutMidiStream(struct MSource *source, ULONG (*fillbuffer)(), UBYTE *buf, ULONG bufsize, ULONG cursize); X#pragma amicall(MidiBase, 0x90, PutMidiStream(a0,a1,a2,d0,d1)) X Xvoid LockMRoutes(void); X#pragma amicall(MidiBase, 0x96, LockMRoutes()) X Xvoid UnlockMRoutes(void); X#pragma amicall(MidiBase, 0x9c, UnlockMRoutes()) X Xvoid FlushMDest(struct MDest *dest); X#pragma amicall(MidiBase, 0xa2, FlushMDest(a0)) X Xstruct MidiPacket *GetMidiPacket(struct MDest *dest); X#pragma amicall(MidiBase, 0xa8, GetMidiPacket(a0)) X Xvoid FreeMidiPacket(struct MidiPacket *packet); X#pragma amicall(MidiBase, 0xae, FreeMidiPacket(a0)) X XSetDefaultMRouteInfo(struct MDest *dest, struct MRouteInfo *routeinfo); X#pragma amicall(MidiBase, 0xb4, SetDefaultMRouteInfo(a0,a1)) X Xstruct MListSignal *CreateMListSignal(ULONG flags); X#pragma amicall(MidiBase, 0xba, CreateMListSignal(d0)) X Xvoid DeleteMListSignal(struct MListSignal *signal); X#pragma amicall(MidiBase, 0xc0, DeleteMListSignal(a0)) X X#endif END_OF_FILE if test 14416 -ne `wc -c <'midi.h'`; then echo shar: \"'midi.h'\" unpacked with wrong size! fi # end of 'midi.h' fi echo shar: End of archive 1 \(of 1\). cp /dev/null ark1isdone MISSING="" for I in 1 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have the archive. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mail submissions (sources or binaries) to <amiga@cs.odu.edu>. Mail comments to the moderator at <amiga-request@cs.odu.edu>. Post requests for sources, and general discussion to comp.sys.amiga.