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  2001/07/02 22:03:48  sbrandon
00014   - initial revision. Still a work in progress, but does allow the MusicKit
00015     and SndKit to compile on GNUstep.
00016 
00017   Revision 1.1.1.1  2000/01/14 00:14:34  leigh
00018   Initial revision
00019 
00020   Revision 1.1.1.1  1999/11/17 17:57:14  leigh
00021   Initial working version
00022 
00023   Revision 1.2  1999/07/29 01:26:08  leigh
00024   Added Win32 compatibility, CVS logs, SBs changes
00025 
00026 */
00027 #ifndef _MDDRIVER_TYPES_
00028 #define _MDDRIVER_TYPES_
00029 
00030 /*** IMPORTANT:  Any changes to this file must be migrated over to
00031   mididriver.h.  The reason for having two files is to simplify the
00032   API for users, allowing them to import only one file. ***/
00033 
00034 /*
00035 #import <mach/kern_return.h>
00036 #import <mach/message.h>
00037 #import <mach/port.h>
00038 */
00039 
00040 /* Each event consists of a byte and a time stamp. */
00041 typedef struct {
00042     int time;             /* Absolute time in quanta */
00043     unsigned char byte;   /* The byte */
00044 } MDRawEvent, *MDRawEventPtr;
00045 
00046 /* MD_MAX_EVENT is the maximum number of events that can be
00047  * sent to or received from the driver in a single package. 
00048  */
00049 #define MD_MAX_EVENT 100
00050    
00051 /* MD_MAX_MSG_SIZE is the maximum size of the message you
00052  * can receive from the driver. 
00053  */
00054 #define MD_MAX_MSG_SIZE 1024  // More than enough
00055 
00056 /* Clock modes */
00057 #define MD_CLOCK_MODE_INTERNAL 0
00058 #define MD_CLOCK_MODE_MTC_SYNC 1
00059 
00060 /* error codes */
00061 #define MD_ERROR_BUSY 100
00062 #define MD_ERROR_NOT_OWNER 101
00063 #define MD_ERROR_QUEUE_FULL 102
00064 #define MD_ERROR_BAD_MODE 103
00065 #define MD_ERROR_UNIT_UNAVAILABLE 104
00066 #define MD_ERROR_ILLEGAL_OPERATION 105
00067 #define MD_ERROR_UNKNOWN_ERROR 106
00068 
00069 /* exception codes */
00070 #define MD_EXCEPTION_MTC_STOPPED 1
00071 #define MD_EXCEPTION_MTC_STARTED_FORWARD 2
00072 #define MD_EXCEPTION_MTC_STARTED_REVERSE 3
00073 
00074 /* Defines for system ignores. */
00075 #define MD_IGNORE_CLOCK  0x0100
00076 #define MD_IGNORE_START  0x0400
00077 #define MD_IGNORE_CONTINUE       0x0800
00078 #define MD_IGNORE_STOP   0x1000
00079 #define MD_IGNORE_ACTIVE         0x4000
00080 #define MD_IGNORE_RESET  0x8000
00081 #define MD_IGNORE_REAL_TIME    0xdd00  /* All of the above */
00082 
00083 #define MD_PORT_A_UNIT 0
00084 #define MD_PORT_B_UNIT 1
00085 
00086 /* Reply function types. */
00087 typedef void (*MDDataReplyFunction)(port_t replyPort, short unit, MDRawEvent *events, unsigned int count);
00088 typedef void (*MDAlarmReplyFunction)(port_t replyPort, int requestedTime, int actualTime);
00089 typedef void (*MDExceptionReplyFunction)(port_t replyPort, int exception);
00090 typedef void (*MDQueueReplyFunction)(port_t replyPort, short unit);
00091 
00092 /* Struct for passing reply functions to mididriver library. */
00093 typedef struct MDReplyFunctions {
00094     MDDataReplyFunction dataReply;
00095     MDAlarmReplyFunction alarmReply;
00096     MDExceptionReplyFunction exceptionReply;
00097     MDQueueReplyFunction queueReply;
00098 } MDReplyFunctions;
00099 
00100 #endif _MDDRIVER_TYPES_