MIDI.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:32k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       MIDI.h
  3.  
  4.      Contains:   MIDI Manager Interfaces.
  5.  
  6.      Version:    Technology: System 7.5
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1988-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __MIDI__
  18. #define __MIDI__
  19. #ifndef __MACERRORS__
  20. #include "MacErrors.h"
  21. #endif
  22. #ifndef __MACTYPES__
  23. #include "MacTypes.h"
  24. #endif
  25. #ifndef __MIXEDMODE__
  26. #include "MixedMode.h"
  27. #endif
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38.     #pragma options align=mac68k
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40.     #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42.     #pragma pack(2)
  43. #endif
  44. /*
  45.                         * * *  N O T E  * * * 
  46.     This file has been updated to include MIDI 2.0 interfaces.  
  47.     
  48.     The MIDI 2.0 interfaces were developed for the classic 68K runtime.
  49.     Since then, Apple has created the PowerPC and CFM 68K runtimes.
  50.     Currently, the extra functions in MIDI 2.0 are not in InterfaceLib
  51.     and thus not callable from PowerPC and CFM 68K runtimes (you'll
  52.     get a linker error).  
  53. */
  54. enum {
  55.     midiMaxNameLen              = 31                            /*maximum number of characters in port and client names*/
  56. };
  57. enum {
  58.                                                                 /* Time formats */
  59.     midiFormatMSec              = 0,                            /*milliseconds*/
  60.     midiFormatBeats             = 1,                            /*beats*/
  61.     midiFormat24fpsBit          = 2,                            /*24 frames/sec.*/
  62.     midiFormat25fpsBit          = 3,                            /*25 frames/sec.*/
  63.     midiFormat30fpsDBit         = 4,                            /*30 frames/sec. drop-frame*/
  64.     midiFormat30fpsBit          = 5,                            /*30 frames/sec.*/
  65.     midiFormat24fpsQF           = 6,                            /*24 frames/sec. longInt format */
  66.     midiFormat25fpsQF           = 7,                            /*25 frames/sec. longInt format */
  67.     midiFormat30fpsDQF          = 8,                            /*30 frames/sec. drop-frame longInt format */
  68.     midiFormat30fpsQF           = 9                             /*30 frames/sec. longInt format */
  69. };
  70. enum {
  71.     midiInternalSync            = 0,                            /*internal sync*/
  72.     midiExternalSync            = 1                             /*external sync*/
  73. };
  74. enum {
  75.                                                                 /* Port types*/
  76.     midiPortTypeTime            = 0,                            /*time port*/
  77.     midiPortTypeInput           = 1,                            /*input port*/
  78.     midiPortTypeOutput          = 2,                            /*output port*/
  79.     midiPortTypeTimeInv         = 3,                            /*invisible time port*/
  80.     midiPortInvisible           = 0x8000,                       /*logical OR this to other types to make invisible ports*/
  81.     midiPortTypeMask            = 0x0007                        /*logical AND with this to convert new port types to old, i.e. to strip the property bits*/
  82. };
  83. enum {
  84.                                                                 /* OffsetTimes  */
  85.     midiGetEverything           = 0x7FFFFFFF,                   /*get all packets, regardless of time stamps*/
  86.     midiGetNothing              = (long)0x80000000,             /*get no packets, regardless of time stamps*/
  87.     midiGetCurrent              = 0x00000000                    /*get current packets only*/
  88. };
  89. /*    MIDI data and messages are passed in MIDIPacket records (see below).
  90.     The first byte of every MIDIPacket contains a set of flags
  91.     bits 0-1    00 = new MIDIPacket, not continued
  92.                      01 = begining of continued MIDIPacket
  93.                      10 = end of continued MIDIPacket
  94.                      11 = continuation
  95.     bits 2-3     reserved
  96.     bits 4-6      000 = packet contains MIDI data
  97.                   001 = packet contains MIDI Manager message
  98.     bit 7         0 = MIDIPacket has valid stamp
  99.                   1 = stamp with current clock
  100. */
  101. enum {
  102.     midiContMask                = 0x03,
  103.     midiNoCont                  = 0x00,
  104.     midiStartCont               = 0x01,
  105.     midiMidCont                 = 0x03,
  106.     midiEndCont                 = 0x02,
  107.     midiTypeMask                = 0x70,
  108.     midiMsgType                 = 0x00,
  109.     midiMgrType                 = 0x10,
  110.     midiTimeStampMask           = 0x80,
  111.     midiTimeStampCurrent        = 0x80,
  112.     midiTimeStampValid          = 0x00
  113. };
  114. enum {
  115.                                                                 /* MIDIPacket command words (the first word in the data field for midiMgrType messages) */
  116.     midiOverflowErr             = 0x0001,
  117.     midiSCCErr                  = 0x0002,
  118.     midiPacketErr               = 0x0003,                       /*all command words less than this value are error indicators*/
  119.     midiMaxErr                  = 0x00FF
  120. };
  121. enum {
  122.                                                                 /* Valid results to be returned by readHooks */
  123.     midiKeepPacket              = 0,
  124.     midiMorePacket              = 1,
  125.     midiNoMorePacket            = 2,
  126.     midiHoldPacket              = 3
  127. };
  128. enum {
  129.                                                                 /* Driver calls */
  130.     midiOpenDriver              = 1,
  131.     midiCloseDriver             = 2
  132. };
  133. enum {
  134.     mdvrAbortNotesOff           = 0,                            /*abort previous mdvrNotesOff request*/
  135.     mdvrChanNotesOff            = 1,                            /*generate channel note off messages*/
  136.     mdvrAllNotesOff             = 2                             /*generate all note off messages*/
  137. };
  138. enum {
  139.     mdvrStopOut                 = 0,                            /*stop calling MDVROut temporarily*/
  140.     mdvrStartOut                = 1                             /*resume calling MDVROut*/
  141. };
  142. struct MIDIPacket {
  143.     UInt8                           flags;
  144.     UInt8                           len;
  145.     long                            tStamp;
  146.     UInt8                           data[249];
  147. };
  148. typedef struct MIDIPacket               MIDIPacket;
  149. typedef MIDIPacket *                    MIDIPacketPtr;
  150. typedef CALLBACK_API( short , MIDIReadHookProcPtr )(MIDIPacketPtr myPacket, long myRefCon);
  151. typedef CALLBACK_API( void , MIDITimeProcPtr )(long curTime, long myRefCon);
  152. typedef CALLBACK_API( void , MIDIConnectionProcPtr )(short refnum, long refcon, short portType, OSType clientID, OSType portID, Boolean connect, short direction);
  153. typedef CALLBACK_API( long , MDVRCommProcPtr )(short refnum, short request, long refCon);
  154. typedef CALLBACK_API( void , MDVRTimeCodeProcPtr )(short refnum, short newFormat, long refCon);
  155. typedef CALLBACK_API( void , MDVRReadProcPtr )(char *midiChars, short length, long refCon);
  156. typedef STACK_UPP_TYPE(MIDIReadHookProcPtr)                     MIDIReadHookUPP;
  157. typedef STACK_UPP_TYPE(MIDITimeProcPtr)                         MIDITimeUPP;
  158. typedef STACK_UPP_TYPE(MIDIConnectionProcPtr)                   MIDIConnectionUPP;
  159. typedef STACK_UPP_TYPE(MDVRCommProcPtr)                         MDVRCommUPP;
  160. typedef STACK_UPP_TYPE(MDVRTimeCodeProcPtr)                     MDVRTimeCodeUPP;
  161. typedef STACK_UPP_TYPE(MDVRReadProcPtr)                         MDVRReadUPP;
  162. struct MIDIClkInfo {
  163.     short                           syncType;                   /*synchronization external/internal*/
  164.     long                            curTime;                    /*current value of port's clock*/
  165.     short                           format;                     /*time code format*/
  166. };
  167. typedef struct MIDIClkInfo              MIDIClkInfo;
  168. struct MIDIIDRec {
  169.     OSType                          clientID;
  170.     OSType                          portID;
  171. };
  172. typedef struct MIDIIDRec                MIDIIDRec;
  173. struct MIDIPortInfo {
  174.     short                           portType;                   /*type of port*/
  175.     MIDIIDRec                       timeBase;                   /*MIDIIDRec for time base*/
  176.     short                           numConnects;                /*number of connections*/
  177.     MIDIIDRec                       cList[1];                   /*ARRAY [1..numConnects] of MIDIIDRec*/
  178. };
  179. typedef struct MIDIPortInfo             MIDIPortInfo;
  180. typedef MIDIPortInfo *                  MIDIPortInfoPtr;
  181. typedef MIDIPortInfoPtr *               MIDIPortInfoHdl;
  182. typedef MIDIPortInfoPtr *               MIDIPortInfoHandle;
  183. struct MIDIPortParams {
  184.     OSType                          portID;                     /*ID of port, unique within client*/
  185.     short                           portType;                   /*Type of port - input, output, time, etc.*/
  186.     short                           timeBase;                   /*refnum of time base, 0 if none*/
  187.     long                            offsetTime;                 /*offset for current time stamps*/
  188.     MIDIReadHookUPP                 readHook;                   /*routine to call when input data is valid*/
  189.     long                            refCon;                     /*refcon for port (for client use)*/
  190.     MIDIClkInfo                     initClock;                  /*initial settings for a time base*/
  191.     Str255                          name;                       /*name of the port, This is a real live string, not a ptr.*/
  192. };
  193. typedef struct MIDIPortParams           MIDIPortParams;
  194. typedef MIDIPortParams *                MIDIPortParamsPtr;
  195. struct MIDIIDList {
  196.     short                           numIDs;
  197.     OSType                          list[1];
  198. };
  199. typedef struct MIDIIDList               MIDIIDList;
  200. typedef MIDIIDList *                    MIDIIDListPtr;
  201. typedef MIDIIDListPtr *                 MIDIIDListHdl;
  202. typedef MIDIIDListPtr *                 MIDIIDListHandle;
  203. /* MDVR Control structs*/
  204. struct MDVRInCtlRec {
  205.     short                           timeCodeClock;              /*refnum of time base for time code*/
  206.     short                           timeCodeFormat;             /*format of time code output*/
  207.     MDVRReadUPP                     readProc;                   /*proc to call with intput characters*/
  208.     MDVRCommUPP                     commProc;                   /*proc to call for handshaking*/
  209.     long                            refCon;                     /*refCon passed to readProc, commProc*/
  210. };
  211. typedef struct MDVRInCtlRec             MDVRInCtlRec;
  212. typedef MDVRInCtlRec *                  MDVRInCtlPtr;
  213. struct MDVROutCtlRec {
  214.     short                           timeCodeClock;              /*time base driven by time code*/
  215.     short                           timeCodeFormat;             /*format of time code to listen to*/
  216.     MDVRTimeCodeUPP                 timeCodeProc;               /*proc called on time code fmt change*/
  217.     MDVRCommUPP                     commProc;                   /*proc called for handshaking*/
  218.     long                            refCon;                     /*refCon passed to timeCodeProc*/
  219.     Boolean                         timeCodeFilter;             /*filter time code if true*/
  220.     UInt8                           padding;                    /*unused pad byte*/
  221.     long                            midiMsgTicks;               /*value of Ticks when MIDI msg rcvd*/
  222.     long                            timeCodeTicks;              /*value of Ticks when time code rcvd*/
  223. };
  224. typedef struct MDVROutCtlRec            MDVROutCtlRec;
  225. typedef MDVROutCtlRec *                 MDVROutCtlPtr;
  226. typedef void *                          MDVRPtr;
  227. #if CALL_NOT_IN_CARBON
  228. EXTERN_API( NumVersion )
  229. MIDIVersion                     (void)                                                      FOURWORDINLINE(0x203C, 0x0000, 0x0004, 0xA800);
  230. EXTERN_API( OSErr )
  231. MIDISignIn                      (OSType                 clientID,
  232.                                  long                   refCon,
  233.                                  Handle                 icon,
  234.                                  ConstStr255Param       name)                               FOURWORDINLINE(0x203C, 0x0004, 0x0004, 0xA800);
  235. EXTERN_API( void )
  236. MIDISignOut                     (OSType                 clientID)                           FOURWORDINLINE(0x203C, 0x0008, 0x0004, 0xA800);
  237. EXTERN_API( MIDIIDListHandle )
  238. MIDIGetClients                  (void)                                                      FOURWORDINLINE(0x203C, 0x000C, 0x0004, 0xA800);
  239. EXTERN_API( void )
  240. MIDIGetClientName               (OSType                 clientID,
  241.                                  Str255                 name)                               FOURWORDINLINE(0x203C, 0x0010, 0x0004, 0xA800);
  242. EXTERN_API( void )
  243. MIDISetClientName               (OSType                 clientID,
  244.                                  ConstStr255Param       name)                               FOURWORDINLINE(0x203C, 0x0014, 0x0004, 0xA800);
  245. EXTERN_API( MIDIIDListHandle )
  246. MIDIGetPorts                    (OSType                 clientID)                           FOURWORDINLINE(0x203C, 0x0018, 0x0004, 0xA800);
  247. EXTERN_API( OSErr )
  248. MIDIAddPort                     (OSType                 clientID,
  249.                                  short                  BufSize,
  250.                                  short *                refnum,
  251.                                  MIDIPortParamsPtr      init)                               FOURWORDINLINE(0x203C, 0x001C, 0x0004, 0xA800);
  252. EXTERN_API( MIDIPortInfoHandle )
  253. MIDIGetPortInfo                 (OSType                 clientID,
  254.                                  OSType                 portID)                             FOURWORDINLINE(0x203C, 0x0020, 0x0004, 0xA800);
  255. EXTERN_API( OSErr )
  256. MIDIConnectData                 (OSType                 srcClID,
  257.                                  OSType                 srcPortID,
  258.                                  OSType                 dstClID,
  259.                                  OSType                 dstPortID)                          FOURWORDINLINE(0x203C, 0x0024, 0x0004, 0xA800);
  260. EXTERN_API( OSErr )
  261. MIDIUnConnectData               (OSType                 srcClID,
  262.                                  OSType                 srcPortID,
  263.                                  OSType                 dstClID,
  264.                                  OSType                 dstPortID)                          FOURWORDINLINE(0x203C, 0x0028, 0x0004, 0xA800);
  265. EXTERN_API( OSErr )
  266. MIDIConnectTime                 (OSType                 srcClID,
  267.                                  OSType                 srcPortID,
  268.                                  OSType                 dstClID,
  269.                                  OSType                 dstPortID)                          FOURWORDINLINE(0x203C, 0x002C, 0x0004, 0xA800);
  270. EXTERN_API( OSErr )
  271. MIDIUnConnectTime               (OSType                 srcClID,
  272.                                  OSType                 srcPortID,
  273.                                  OSType                 dstClID,
  274.                                  OSType                 dstPortID)                          FOURWORDINLINE(0x203C, 0x0030, 0x0004, 0xA800);
  275. EXTERN_API( void )
  276. MIDIFlush                       (short                  refnum)                             FOURWORDINLINE(0x203C, 0x0034, 0x0004, 0xA800);
  277. EXTERN_API( ProcPtr )
  278. MIDIGetReadHook                 (short                  refnum)                             FOURWORDINLINE(0x203C, 0x0038, 0x0004, 0xA800);
  279. EXTERN_API( void )
  280. MIDISetReadHook                 (short                  refnum,
  281.                                  ProcPtr                hook)                               FOURWORDINLINE(0x203C, 0x003C, 0x0004, 0xA800);
  282. EXTERN_API( void )
  283. MIDIGetPortName                 (OSType                 clientID,
  284.                                  OSType                 portID,
  285.                                  Str255                 name)                               FOURWORDINLINE(0x203C, 0x0040, 0x0004, 0xA800);
  286. EXTERN_API( void )
  287. MIDISetPortName                 (OSType                 clientID,
  288.                                  OSType                 portID,
  289.                                  ConstStr255Param       name)                               FOURWORDINLINE(0x203C, 0x0044, 0x0004, 0xA800);
  290. EXTERN_API( void )
  291. MIDIWakeUp                      (short                  refnum,
  292.                                  long                   time,
  293.                                  long                   period,
  294.                                  MIDITimeUPP            timeProc)                           FOURWORDINLINE(0x203C, 0x0048, 0x0004, 0xA800);
  295. EXTERN_API( void )
  296. MIDIRemovePort                  (short                  refnum)                             FOURWORDINLINE(0x203C, 0x004C, 0x0004, 0xA800);
  297. EXTERN_API( short )
  298. MIDIGetSync                     (short                  refnum)                             FOURWORDINLINE(0x203C, 0x0050, 0x0004, 0xA800);
  299. EXTERN_API( void )
  300. MIDISetSync                     (short                  refnum,
  301.                                  short                  sync)                               FOURWORDINLINE(0x203C, 0x0054, 0x0004, 0xA800);
  302. EXTERN_API( long )
  303. MIDIGetCurTime                  (short                  refnum)                             FOURWORDINLINE(0x203C, 0x0058, 0x0004, 0xA800);
  304. EXTERN_API( void )
  305. MIDISetCurTime                  (short                  refnum,
  306.                                  long                   time)                               FOURWORDINLINE(0x203C, 0x005C, 0x0004, 0xA800);
  307. EXTERN_API( void )
  308. MIDIStartTime                   (short                  refnum)                             FOURWORDINLINE(0x203C, 0x0060, 0x0004, 0xA800);
  309. EXTERN_API( void )
  310. MIDIStopTime                    (short                  refnum)                             FOURWORDINLINE(0x203C, 0x0064, 0x0004, 0xA800);
  311. EXTERN_API( void )
  312. MIDIPoll                        (short                  refnum,
  313.                                  long                   offsetTime)                         FOURWORDINLINE(0x203C, 0x0068, 0x0004, 0xA800);
  314. EXTERN_API( OSErr )
  315. MIDIWritePacket                 (short                  refnum,
  316.                                  MIDIPacketPtr          packet)                             FOURWORDINLINE(0x203C, 0x006C, 0x0004, 0xA800);
  317. EXTERN_API( Boolean )
  318. MIDIWorldChanged                (OSType                 clientID)                           FOURWORDINLINE(0x203C, 0x0070, 0x0004, 0xA800);
  319. EXTERN_API( long )
  320. MIDIGetOffsetTime               (short                  refnum)                             FOURWORDINLINE(0x203C, 0x0074, 0x0004, 0xA800);
  321. EXTERN_API( void )
  322. MIDISetOffsetTime               (short                  refnum,
  323.                                  long                   offsetTime)                         FOURWORDINLINE(0x203C, 0x0078, 0x0004, 0xA800);
  324. EXTERN_API( long )
  325. MIDIConvertTime                 (short                  srcFormat,
  326.                                  short                  dstFormat,
  327.                                  long                   time)                               FOURWORDINLINE(0x203C, 0x007C, 0x0004, 0xA800);
  328. EXTERN_API( long )
  329. MIDIGetRefCon                   (short                  refnum)                             FOURWORDINLINE(0x203C, 0x0080, 0x0004, 0xA800);
  330. EXTERN_API( void )
  331. MIDISetRefCon                   (short                  refnum,
  332.                                  long                   refCon)                             FOURWORDINLINE(0x203C, 0x0084, 0x0004, 0xA800);
  333. EXTERN_API( long )
  334. MIDIGetClRefCon                 (OSType                 clientID)                           FOURWORDINLINE(0x203C, 0x0088, 0x0004, 0xA800);
  335. EXTERN_API( void )
  336. MIDISetClRefCon                 (OSType                 clientID,
  337.                                  long                   refCon)                             FOURWORDINLINE(0x203C, 0x008C, 0x0004, 0xA800);
  338. EXTERN_API( short )
  339. MIDIGetTCFormat                 (short                  refnum)                             FOURWORDINLINE(0x203C, 0x0090, 0x0004, 0xA800);
  340. EXTERN_API( void )
  341. MIDISetTCFormat                 (short                  refnum,
  342.                                  short                  format)                             FOURWORDINLINE(0x203C, 0x0094, 0x0004, 0xA800);
  343. EXTERN_API( void )
  344. MIDISetRunRate                  (short                  refnum,
  345.                                  short                  rate,
  346.                                  long                   time)                               FOURWORDINLINE(0x203C, 0x0098, 0x0004, 0xA800);
  347. EXTERN_API( Handle )
  348. MIDIGetClientIcon               (OSType                 clientID)                           FOURWORDINLINE(0x203C, 0x009C, 0x0004, 0xA800);
  349. EXTERN_API( ProcPtr )
  350. MIDICallAddress                 (short                  callNum)                            FOURWORDINLINE(0x203C, 0x00A4, 0x0004, 0xA800);
  351. EXTERN_API( void )
  352. MIDISetConnectionProc           (short                  refNum,
  353.                                  ProcPtr                connectionProc,
  354.                                  long                   refCon)                             FOURWORDINLINE(0x203C, 0x00A8, 0x0004, 0xA800);
  355. EXTERN_API( void )
  356. MIDIGetConnectionProc           (short                  refnum,
  357.                                  ProcPtr *              connectionProc,
  358.                                  long *                 refCon)                             FOURWORDINLINE(0x203C, 0x00AC, 0x0004, 0xA800);
  359. EXTERN_API( void )
  360. MIDIDiscardPacket               (short                  refnum,
  361.                                  MIDIPacketPtr          packet)                             FOURWORDINLINE(0x203C, 0x00B0, 0x0004, 0xA800);
  362. EXTERN_API( OSErr )
  363. MDVRSignIn                      (OSType                 clientID,
  364.                                  long                   refCon,
  365.                                  Handle                 icon,
  366.                                  Str255                 name)                               FOURWORDINLINE(0x203C, 0x00B4, 0x0004, 0xA800);
  367. EXTERN_API( void )
  368. MDVRSignOut                     (OSType                 clientID)                           FOURWORDINLINE(0x203C, 0x00B8, 0x0004, 0xA800);
  369. EXTERN_API( MDVRPtr )
  370. MDVROpen                        (short                  portType,
  371.                                  short                  refnum)                             FOURWORDINLINE(0x203C, 0x00BC, 0x0004, 0xA800);
  372. EXTERN_API( void )
  373. MDVRClose                       (MDVRPtr                driverPtr)                          FOURWORDINLINE(0x203C, 0x00C0, 0x0004, 0xA800);
  374. EXTERN_API( void )
  375. MDVRControlIn                   (MDVRPtr                portPtr,
  376.                                  MDVRInCtlPtr           inputCtl)                           FOURWORDINLINE(0x203C, 0x00C4, 0x0004, 0xA800);
  377. EXTERN_API( void )
  378. MDVRControlOut                  (MDVRPtr                portPtr,
  379.                                  MDVROutCtlPtr          outputCtl)                          FOURWORDINLINE(0x203C, 0x00C8, 0x0004, 0xA800);
  380. EXTERN_API( void )
  381. MDVRIn                          (MDVRPtr                portPtr)                            FOURWORDINLINE(0x203C, 0x00CC, 0x0004, 0xA800);
  382. EXTERN_API( void )
  383. MDVROut                         (MDVRPtr                portPtr,
  384.                                  char *                 dataPtr,
  385.                                  short                  length)                             FOURWORDINLINE(0x203C, 0x00D0, 0x0004, 0xA800);
  386. EXTERN_API( void )
  387. MDVRNotesOff                    (MDVRPtr                portPtr,
  388.                                  short                  mode)                               FOURWORDINLINE(0x203C, 0x00D4, 0x0004, 0xA800);
  389. #endif  /* CALL_NOT_IN_CARBON */
  390. #if OPAQUE_UPP_TYPES
  391. #if CALL_NOT_IN_CARBON
  392.     EXTERN_API(MIDIReadHookUPP)
  393.     NewMIDIReadHookUPP             (MIDIReadHookProcPtr     userRoutine);
  394.     EXTERN_API(MIDITimeUPP)
  395.     NewMIDITimeUPP                 (MIDITimeProcPtr         userRoutine);
  396.     EXTERN_API(MIDIConnectionUPP)
  397.     NewMIDIConnectionUPP           (MIDIConnectionProcPtr   userRoutine);
  398.     EXTERN_API(MDVRCommUPP)
  399.     NewMDVRCommUPP                 (MDVRCommProcPtr         userRoutine);
  400.     EXTERN_API(MDVRTimeCodeUPP)
  401.     NewMDVRTimeCodeUPP             (MDVRTimeCodeProcPtr     userRoutine);
  402.     EXTERN_API(MDVRReadUPP)
  403.     NewMDVRReadUPP                 (MDVRReadProcPtr         userRoutine);
  404.     EXTERN_API(void)
  405.     DisposeMIDIReadHookUPP         (MIDIReadHookUPP         userUPP);
  406.     EXTERN_API(void)
  407.     DisposeMIDITimeUPP             (MIDITimeUPP             userUPP);
  408.     EXTERN_API(void)
  409.     DisposeMIDIConnectionUPP       (MIDIConnectionUPP       userUPP);
  410.     EXTERN_API(void)
  411.     DisposeMDVRCommUPP             (MDVRCommUPP             userUPP);
  412.     EXTERN_API(void)
  413.     DisposeMDVRTimeCodeUPP         (MDVRTimeCodeUPP         userUPP);
  414.     EXTERN_API(void)
  415.     DisposeMDVRReadUPP             (MDVRReadUPP             userUPP);
  416.     EXTERN_API(short)
  417.     InvokeMIDIReadHookUPP          (MIDIPacketPtr           myPacket,
  418.                                     long                    myRefCon,
  419.                                     MIDIReadHookUPP         userUPP);
  420.     EXTERN_API(void)
  421.     InvokeMIDITimeUPP              (long                    curTime,
  422.                                     long                    myRefCon,
  423.                                     MIDITimeUPP             userUPP);
  424.     EXTERN_API(void)
  425.     InvokeMIDIConnectionUPP        (short                   refnum,
  426.                                     long                    refcon,
  427.                                     short                   portType,
  428.                                     OSType                  clientID,
  429.                                     OSType                  portID,
  430.                                     Boolean                 connect,
  431.                                     short                   direction,
  432.                                     MIDIConnectionUPP       userUPP);
  433.     EXTERN_API(long)
  434.     InvokeMDVRCommUPP              (short                   refnum,
  435.                                     short                   request,
  436.                                     long                    refCon,
  437.                                     MDVRCommUPP             userUPP);
  438.     EXTERN_API(void)
  439.     InvokeMDVRTimeCodeUPP          (short                   refnum,
  440.                                     short                   newFormat,
  441.                                     long                    refCon,
  442.                                     MDVRTimeCodeUPP         userUPP);
  443.     EXTERN_API(void)
  444.     InvokeMDVRReadUPP              (char *                  midiChars,
  445.                                     short                   length,
  446.                                     long                    refCon,
  447.                                     MDVRReadUPP             userUPP);
  448. #endif  /* CALL_NOT_IN_CARBON */
  449. #else
  450.     enum { uppMIDIReadHookProcInfo = 0x000003E0 };                  /* pascal 2_bytes Func(4_bytes, 4_bytes) */
  451.     enum { uppMIDITimeProcInfo = 0x000003C0 };                      /* pascal no_return_value Func(4_bytes, 4_bytes) */
  452.     enum { uppMIDIConnectionProcInfo = 0x0009FB80 };                /* pascal no_return_value Func(2_bytes, 4_bytes, 2_bytes, 4_bytes, 4_bytes, 1_byte, 2_bytes) */
  453.     enum { uppMDVRCommProcInfo = 0x00000EB0 };                      /* pascal 4_bytes Func(2_bytes, 2_bytes, 4_bytes) */
  454.     enum { uppMDVRTimeCodeProcInfo = 0x00000E80 };                  /* pascal no_return_value Func(2_bytes, 2_bytes, 4_bytes) */
  455.     enum { uppMDVRReadProcInfo = 0x00000EC0 };                      /* pascal no_return_value Func(4_bytes, 2_bytes, 4_bytes) */
  456.     #define NewMIDIReadHookUPP(userRoutine)                         (MIDIReadHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMIDIReadHookProcInfo, GetCurrentArchitecture())
  457.     #define NewMIDITimeUPP(userRoutine)                             (MIDITimeUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMIDITimeProcInfo, GetCurrentArchitecture())
  458.     #define NewMIDIConnectionUPP(userRoutine)                       (MIDIConnectionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMIDIConnectionProcInfo, GetCurrentArchitecture())
  459.     #define NewMDVRCommUPP(userRoutine)                             (MDVRCommUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMDVRCommProcInfo, GetCurrentArchitecture())
  460.     #define NewMDVRTimeCodeUPP(userRoutine)                         (MDVRTimeCodeUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMDVRTimeCodeProcInfo, GetCurrentArchitecture())
  461.     #define NewMDVRReadUPP(userRoutine)                             (MDVRReadUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMDVRReadProcInfo, GetCurrentArchitecture())
  462.     #define DisposeMIDIReadHookUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  463.     #define DisposeMIDITimeUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  464.     #define DisposeMIDIConnectionUPP(userUPP)                       DisposeRoutineDescriptor(userUPP)
  465.     #define DisposeMDVRCommUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  466.     #define DisposeMDVRTimeCodeUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  467.     #define DisposeMDVRReadUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  468.     #define InvokeMIDIReadHookUPP(myPacket, myRefCon, userUPP)      (short)CALL_TWO_PARAMETER_UPP((userUPP), uppMIDIReadHookProcInfo, (myPacket), (myRefCon))
  469.     #define InvokeMIDITimeUPP(curTime, myRefCon, userUPP)           CALL_TWO_PARAMETER_UPP((userUPP), uppMIDITimeProcInfo, (curTime), (myRefCon))
  470.     #define InvokeMIDIConnectionUPP(refnum, refcon, portType, clientID, portID, connect, direction, userUPP)  CALL_SEVEN_PARAMETER_UPP((userUPP), uppMIDIConnectionProcInfo, (refnum), (refcon), (portType), (clientID), (portID), (connect), (direction))
  471.     #define InvokeMDVRCommUPP(refnum, request, refCon, userUPP)     (long)CALL_THREE_PARAMETER_UPP((userUPP), uppMDVRCommProcInfo, (refnum), (request), (refCon))
  472.     #define InvokeMDVRTimeCodeUPP(refnum, newFormat, refCon, userUPP)  CALL_THREE_PARAMETER_UPP((userUPP), uppMDVRTimeCodeProcInfo, (refnum), (newFormat), (refCon))
  473.     #define InvokeMDVRReadUPP(midiChars, length, refCon, userUPP)   CALL_THREE_PARAMETER_UPP((userUPP), uppMDVRReadProcInfo, (midiChars), (length), (refCon))
  474. #endif
  475. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  476. #define NewMIDIReadHookProc(userRoutine)                        NewMIDIReadHookUPP(userRoutine)
  477. #define NewMIDITimeProc(userRoutine)                            NewMIDITimeUPP(userRoutine)
  478. #define NewMIDIConnectionProc(userRoutine)                      NewMIDIConnectionUPP(userRoutine)
  479. #define NewMDVRCommProc(userRoutine)                            NewMDVRCommUPP(userRoutine)
  480. #define NewMDVRTimeCodeProc(userRoutine)                        NewMDVRTimeCodeUPP(userRoutine)
  481. #define NewMDVRReadProc(userRoutine)                            NewMDVRReadUPP(userRoutine)
  482. #define CallMIDIReadHookProc(userRoutine, myPacket, myRefCon)   InvokeMIDIReadHookUPP(myPacket, myRefCon, userRoutine)
  483. #define CallMIDITimeProc(userRoutine, curTime, myRefCon)        InvokeMIDITimeUPP(curTime, myRefCon, userRoutine)
  484. #define CallMIDIConnectionProc(userRoutine, refnum, refcon, portType, clientID, portID, connect, direction) InvokeMIDIConnectionUPP(refnum, refcon, portType, clientID, portID, connect, direction, userRoutine)
  485. #define CallMDVRCommProc(userRoutine, refnum, request, refCon)  InvokeMDVRCommUPP(refnum, request, refCon, userRoutine)
  486. #define CallMDVRTimeCodeProc(userRoutine, refnum, newFormat, refCon) InvokeMDVRTimeCodeUPP(refnum, newFormat, refCon, userRoutine)
  487. #define CallMDVRReadProc(userRoutine, midiChars, length, refCon) InvokeMDVRReadUPP(midiChars, length, refCon, userRoutine)
  488. #if PRAGMA_STRUCT_ALIGN
  489.     #pragma options align=reset
  490. #elif PRAGMA_STRUCT_PACKPUSH
  491.     #pragma pack(pop)
  492. #elif PRAGMA_STRUCT_PACK
  493.     #pragma pack()
  494. #endif
  495. #ifdef PRAGMA_IMPORT_OFF
  496. #pragma import off
  497. #elif PRAGMA_IMPORT
  498. #pragma import reset
  499. #endif
  500. #ifdef __cplusplus
  501. }
  502. #endif
  503. #endif /* __MIDI__ */