MusicKit  0.0.0
mididriver_types.h
00001 /*
00002   $Id$
00003   Defined In: The MusicKit
00004 
00005   Description: MIDI driver typedefs, defines, etc.
00006 
00007   Author: David Jaffe
00008 */
00009 /*
00010 Modification history:
00011 
00012   $Log$
00013   Revision 1.1  1999/11/17 17:57:14  leigh
00014   Initial revision
00015 
00016   Revision 1.2  1999/07/29 01:26:08  leigh
00017   Added Win32 compatibility, CVS logs, SBs changes
00018 
00019 */
00020 #ifndef _MDDRIVER_TYPES_
00021 #define _MDDRIVER_TYPES_
00022 
00023 /*** IMPORTANT:  Any changes to this file must be migrated over to
00024   mididriver.h.  The reason for having two files is to simplify the
00025   API for users, allowing them to import only one file. ***/
00026 
00027 /*
00028 #import <mach/kern_return.h>
00029 #import <mach/message.h>
00030 #import <mach/port.h>
00031 */
00032 
00033 /* Each event consists of a byte and a time stamp. */
00034 typedef struct {
00035     int time;             /* Absolute time in quanta */
00036     unsigned char byte;   /* The byte */
00037 } MDRawEvent, *MDRawEventPtr;
00038 
00039 /* MD_MAX_EVENT is the maximum number of events that can be
00040  * sent to or received from the driver in a single package. 
00041  */
00042 #define MD_MAX_EVENT 100
00043    
00044 /* MD_MAX_MSG_SIZE is the maximum size of the message you
00045  * can receive from the driver. 
00046  */
00047 #define MD_MAX_MSG_SIZE 1024  // More than enough
00048 
00049 /* Clock modes */
00050 #define MD_CLOCK_MODE_INTERNAL 0
00051 #define MD_CLOCK_MODE_MTC_SYNC 1
00052 
00053 /* error codes */
00054 #define MD_ERROR_BUSY 100
00055 #define MD_ERROR_NOT_OWNER 101
00056 #define MD_ERROR_QUEUE_FULL 102
00057 #define MD_ERROR_BAD_MODE 103
00058 #define MD_ERROR_UNIT_UNAVAILABLE 104
00059 #define MD_ERROR_ILLEGAL_OPERATION 105
00060 #define MD_ERROR_UNKNOWN_ERROR 106
00061 
00062 /* exception codes */
00063 #define MD_EXCEPTION_MTC_STOPPED 1
00064 #define MD_EXCEPTION_MTC_STARTED_FORWARD 2
00065 #define MD_EXCEPTION_MTC_STARTED_REVERSE 3
00066 
00067 /* Defines for system ignores. */
00068 #define MD_IGNORE_CLOCK  0x0100
00069 #define MD_IGNORE_START  0x0400
00070 #define MD_IGNORE_CONTINUE       0x0800
00071 #define MD_IGNORE_STOP   0x1000
00072 #define MD_IGNORE_ACTIVE         0x4000
00073 #define MD_IGNORE_RESET  0x8000
00074 #define MD_IGNORE_REAL_TIME    0xdd00  /* All of the above */
00075 
00076 #define MD_PORT_A_UNIT 0
00077 #define MD_PORT_B_UNIT 1
00078 
00079 /* Reply function types. */
00080 typedef void (*MDDataReplyFunction)(port_t replyPort, short unit, MDRawEvent *events, unsigned int count);
00081 typedef void (*MDAlarmReplyFunction)(port_t replyPort, int requestedTime, int actualTime);
00082 typedef void (*MDExceptionReplyFunction)(port_t replyPort, int exception);
00083 typedef void (*MDQueueReplyFunction)(port_t replyPort, short unit);
00084 
00085 /* Struct for passing reply functions to mididriver library. */
00086 typedef struct MDReplyFunctions {
00087     MDDataReplyFunction dataReply;
00088     MDAlarmReplyFunction alarmReply;
00089     MDExceptionReplyFunction exceptionReply;
00090     MDQueueReplyFunction queueReply;
00091 } MDReplyFunctions;
00092 
00093 #endif _MDDRIVER_TYPES_