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.3  2000/11/29 23:21:27  leigh
00014   Renamed MD functions to MKMD
00015 
00016   Revision 1.2  2000/01/27 18:15:43  leigh
00017   upgraded to new typedef names for Mach
00018 
00019   Revision 1.1.1.1  1999/09/12 00:20:18  leigh
00020   separated out from MusicKit framework
00021 
00022   Revision 1.2  1999/07/29 01:26:08  leigh
00023   Added Win32 compatibility, CVS logs, SBs changes
00024 
00025 */
00026 #ifndef _MKMDDRIVER_TYPES_
00027 #define _MKMDDRIVER_TYPES_
00028 
00029 /*** IMPORTANT:  Any changes to this file must be migrated over to
00030   mididriver.h.  The reason for having two files is to simplify the
00031   API for users, allowing them to import only one file. ***/
00032 
00033 
00034 #import <mach/kern_return.h>
00035 #import <mach/message.h>
00036 #import <mach/port.h>
00037 
00038 /* Each event consists of a byte and a time stamp. */
00039 typedef struct {
00040     int time;             /* Absolute time in quanta */
00041     unsigned char byte;   /* The byte */
00042 } MKMDRawEvent, *MKMDRawEventPtr;
00043 
00044 /* MKMD_MAX_EVENT is the maximum number of events that can be
00045  * sent to or received from the driver in a single package. 
00046  */
00047 #define MKMD_MAX_EVENT 100
00048    
00049 /* MKMD_MAX_MSG_SIZE is the maximum size of the message you
00050  * can receive from the driver. 
00051  */
00052 #define MKMD_MAX_MSG_SIZE 1024  // More than enough
00053 
00054 /* Clock modes */
00055 #define MKMD_CLOCK_MODE_INTERNAL 0
00056 #define MKMD_CLOCK_MODE_MTC_SYNC 1
00057 
00058 /* error codes */
00059 #define MKMD_ERROR_BUSY 100
00060 #define MKMD_ERROR_NOT_OWNER 101
00061 #define MKMD_ERROR_QUEUE_FULL 102
00062 #define MKMD_ERROR_BAD_MODE 103
00063 #define MKMD_ERROR_UNIT_UNAVAILABLE 104
00064 #define MKMD_ERROR_ILLEGAL_OPERATION 105
00065 #define MKMD_ERROR_UNKNOWN_ERROR 106
00066 
00067 /* exception codes */
00068 #define MKMD_EXCEPTION_MTC_STOPPED 1
00069 #define MKMD_EXCEPTION_MTC_STARTED_FORWARD 2
00070 #define MKMD_EXCEPTION_MTC_STARTED_REVERSE 3
00071 
00072 /* Defines for system ignores. */
00073 #define MKMD_IGNORE_CLOCK        0x0100
00074 #define MKMD_IGNORE_START        0x0400
00075 #define MKMD_IGNORE_CONTINUE     0x0800
00076 #define MKMD_IGNORE_STOP         0x1000
00077 #define MKMD_IGNORE_ACTIVE       0x4000
00078 #define MKMD_IGNORE_RESET        0x8000
00079 #define MKMD_IGNORE_REAL_TIME    0xdd00  /* All of the above */
00080 
00081 #define MKMD_PORT_A_UNIT 0
00082 #define MKMD_PORT_B_UNIT 1
00083 
00084 /* Reply function types. */
00085 typedef void (*MKMDDataReplyFunction)(mach_port_t replyPort, short unit, MKMDRawEvent *events, unsigned int count);
00086 typedef void (*MKMDAlarmReplyFunction)(mach_port_t replyPort, int requestedTime, int actualTime);
00087 typedef void (*MKMDExceptionReplyFunction)(mach_port_t replyPort, int exception);
00088 typedef void (*MKMDQueueReplyFunction)(mach_port_t replyPort, short unit);
00089 
00090 /* Struct for passing reply functions to mididriver library. */
00091 typedef struct MKMDReplyFunctions {
00092     MKMDDataReplyFunction dataReply;
00093     MKMDAlarmReplyFunction alarmReply;
00094     MKMDExceptionReplyFunction exceptionReply;
00095     MKMDQueueReplyFunction queueReply;
00096 } MKMDReplyFunctions;
00097 
00098 #endif _MKMDDRIVER_TYPES_