home *** CD-ROM | disk | FTP | other *** search
/ Computer Music Interactif…cial Edition 1999 Winter / cd 3.iso / mac / Mac / Shares / Midishare™1.68 / Development Tools / MidiShare.h next >
Encoding:
C/C++ Source or Header  |  1993-03-24  |  22.9 KB  |  566 lines  |  [TEXT/MPS ]

  1. #define _H_MidiShare
  2.  
  3. #ifndef __MidiShare__
  4. #define __MidiShare__
  5.  
  6. #ifndef __TYPES__
  7. #include <Types.h>
  8. #endif
  9.  
  10. /*****************************************************************************
  11.  *                                MIDI SHARE                                    
  12.  *----------------------------------------------------------------------------
  13.  * MidiShare is a multi-tasking, real-time software environment, specially 
  14.  * devised for the developing of MIDI applications with a triple target :
  15.  * 
  16.  *     •To propose solutions to currently met problems when developing 
  17.  *      a real-time MIDI application : memory management, communication management, 
  18.  *     time management, task management. 
  19.  * 
  20.  *     •To enable the real-time and multi-tasking functioning of these applications, 
  21.  *      i.e. to enable the sharing of all the necessary resources and their 
  22.  *      simultaneous access.
  23.  *
  24.  *     •To make easier cooperation between independent MIDI applications by  proposing 
  25.  *      a real-time mechanism of inter-application communications.
  26.  * 
  27.  * This file contains a complete description of all the MidiShare functions and 
  28.  * procedures, as well as all the data structures in use.
  29.  *----------------------------------------------------------------------------
  30.  *                     © GRAME 1989, 1990, 1991, 1992 
  31.  *              [Yann Orlarey, Hervé Lequay, Dominique fober]                        
  32.  *----------------------------------------------------------------------------
  33.  *
  34.  *    version 1.20 
  35.  *    version Lightspeed C version 3.01 G. Bloch Aout 1989 (modif YO 9-9-89)
  36.  *    version Think C 4.0 : YO [13-11-89]
  37.  *  extensions tâches différées : YO [05-12-89]
  38.  *    version MPW C++ 3.1 : YO [09-03-90]
  39.  *    harmonisation prototypes: YO [12-05-90]
  40.  *    harmonisation MPW & TC: YO [12-05-90]
  41.  *    implémentation de 'MidiShare()' sous forme de macro: YO [15-03-91]
  42.  *  english version : YO [29-01-92]
  43.  *  changes for TC5 : YO [03-02-93]
  44. ******************************************************************************/
  45.  
  46. /*******************************************************************************
  47.  *                             MIDISHARE EVENTS                                    
  48.  *------------------------------------------------------------------------------
  49.  *     The listing below presents the different types of MidiShare handled events. 
  50.  *     This typology contains the whole of the standard Midi messages, plus specific 
  51.  *     messages such as typeNote corresponding to a note with its duration;  
  52.  *     or typeStream corresponding to a series of arbitrary bytes, possibly including 
  53.  *     data and status codes, sent directly without any processing; or typePrivate 
  54.  *     that are application private messages.
  55.  *     
  56.  *     All these codes may be used in the MidiNewEv function to allocate an event
  57.  *     of the desirable type and are accessible in an event evType field.
  58.  *******************************************************************************/
  59.             
  60. #define typeNote        0     /* note with pitch, velocity and duration        */    
  61.         
  62. #define typeKeyOn        1     /* Note On with pitch, velocity                 */
  63. #define typeKeyOff        2     /* Note Off with pitch, velocity                 */
  64. #define typeKeyPress     3     /* Poly Key Pressure with pitch and pressure    */
  65. #define typeCtrlChange    4     /* Control Change with controller ID and value    */
  66. #define typeProgChange    5     /* Program Change with program ID number        */
  67. #define typeChanPress    6     /* Channel Pressure with pressure value            */
  68. #define typePitchWheel    7     /* Pitch Bend Change with LSB and MSB values    */
  69.         
  70. #define typeSongPos        8     /* Song Position Pointer with LSB and MSB values*/
  71. #define typeSongSel        9     /* Song Select with song ID number                */
  72. #define typeClock        10     /* Timing Clock                                    */
  73. #define typeStart        11     /* Start                                        */
  74. #define typeContinue    12     /* Continue                                        */
  75. #define typeStop        13    /* Stop                                            */
  76.         
  77. #define typeTune        14     /* Tune Request                                    */
  78. #define typeActiveSens    15     /* Active Sensing                                */
  79. #define typeReset        16    /* System Reset                                    */
  80.     
  81. #define typeSysEx        17     /* System Exclusive (only data bytes)            */
  82. #define typeStream        18     /* arbitrary midi bytes (data and status codes)    */
  83.         
  84. #define typePrivate        19    /*19..127 Private events for applications internal use*/
  85. #define typeProcess        128    /* used by MidiShare for MidiCall and MidiTask    */
  86. #define typeDProcess    129    /* used by MidiShare for MidiDTask                */
  87. #define typeQuarterFrame 130 /* Midi time code quarter frame                */
  88.  
  89. #define typeCtrl14b        131    
  90. #define typeNonRegParam    132
  91. #define typeRegParam    133
  92.  
  93. #define typeSeqNum        134        /* numéro de séquence                    */
  94. #define typeText        135        /* événement texte                        */
  95. #define typeCopyright    136        /* message copyright                    */
  96. #define typeSeqName        137        /* nom de séquence ou de piste            */
  97. #define typeInstrName    138        /* nom d'instrument                        */
  98. #define typeLyric        139        /* paroles déstinées à etre chantées    */
  99. #define typeMarker        140        /* marqueur                                */
  100. #define typeCuePoint    141        /* cue point                            */
  101. #define typeChanPrefix    142        /* Midi Channel Prefix                    */
  102. #define typeEndTrack    143        /* fin de piste                            */
  103. #define typeTempo        144        /* changement de tempo                    */
  104. #define typeSMPTEOffset    145        /* offset smpte                            */
  105.  
  106. #define typeTimeSign    146        /* indication de mesure                    */
  107. #define typeKeySign        147        /* signature tonale                        */
  108. #define typeSpecific    148        /* méta evt spécifique à un séquenceur    */
  109.  
  110. #define typeReserved    149    /*149..254    reserved for future extensions        */
  111.         
  112. #define typeDead        255    /* dead Task or DTask                            */
  113.         
  114.  
  115.  
  116. /******************************************************************************
  117. *                                  MIDI STATUS CODE                                
  118. *******************************************************************************/
  119.  
  120. #define NoteOff        0x80    
  121. #define NoteOn        0x90
  122. #define PolyTouch    0xa0
  123. #define ControlChg    0xb0
  124. #define ProgramChg    0xc0
  125. #define AfterTouch    0xd0
  126. #define PitchBend    0xe0
  127. #define SysRealTime    0xf0
  128. #define SysEx        0xf0
  129. #define QFrame        0xf1
  130. #define SongPos        0xf2
  131. #define SongSel        0xf3
  132. #define UnDef2        0xf4
  133. #define UnDef3        0xf5
  134. #define Tune        0xf6
  135. #define EndSysX        0xf7
  136. #define MClock        0xf8
  137. #define UnDef4        0xf9
  138. #define MStart        0xfa
  139. #define MCont        0xfb
  140. #define MStop        0xfc
  141. #define UnDef5        0xfd
  142. #define ActSense    0xfe
  143. #define MReset        0xff
  144.  
  145.  
  146. /*******************************************************************************
  147. *                                     SERIAL PORTS                                    
  148. *------------------------------------------------------------------------------
  149. * The Modem and printer serial ports ID numbers.                            
  150. *******************************************************************************/
  151.             
  152. #define ModemPort    0
  153. #define PrinterPort    1
  154.         
  155.  
  156. /******************************************************************************
  157. *                                     ERROR CODES                                
  158. *------------------------------------------------------------------------------
  159. * List of the error codes returned by some MidiShare functions.                                                                    
  160. *******************************************************************************/
  161.         
  162. #define MIDIerrSpace     -1        /* plus de place dans la freeList */
  163. #define MIDIerrRefNum    -2        /* mauvais numero de reference */
  164. #define MIDIerrBadType    -3        /* mauvais type d'événement */
  165. #define MIDIerrIndex    -4        /* mauvais index d'acces à un événement */
  166.         
  167.  
  168. /******************************************************************************
  169. *                                 SYNCHRONISATION CODES                                
  170. *------------------------------------------------------------------------------
  171. * List of the error codes returned by some MidiShare functions.                                                                    
  172. *******************************************************************************/
  173.         
  174. #define MIDISyncExternal     0x8000        /* bit-15 for external synchronisation */
  175. #define MIDISyncAnyPort        0x4000        /* bit-14 for synchronisation on any port */
  176.  
  177.  
  178. /******************************************************************************
  179. *                                   CHANGE CODES                            
  180. *------------------------------------------------------------------------------
  181. When an application need to know about context modifications like opening and
  182. closing of applications, opening and closing of midi ports, changes in 
  183. connections between applications, it can install an ApplAlarm (with 
  184. MidiSetApplAlarm). This ApplAlarm is then called by MidiShare every time a 
  185. context modification happens with a 32-bits code describing the modification. 
  186. The hi 16-bits part of this code is the refNum of the application involved in 
  187. the context modification, the low 16-bits part describe the type of change as
  188. listed here.
  189. *******************************************************************************/
  190.         
  191. enum{    MIDIOpenAppl=1,
  192.         MIDICloseAppl,
  193.         MIDIChgName,
  194.         MIDIChgConnect,
  195.         MIDIOpenModem,
  196.         MIDICloseModem,
  197.         MIDIOpenPrinter,
  198.         MIDIClosePrinter,
  199.         MIDISyncStart,
  200.         MIDISyncStop,
  201.         MIDIChangeSync
  202. };
  203.     
  204.         
  205. /******************************************************************************
  206. *                                 EVENTS STRUCTURES                            
  207. *------------------------------------------------------------------------------
  208. * Tous les événements sont construits à l'aide d'une ou plusieurs cellules de    
  209. * taille fixe (16 octets). La plupart nécessitent une seule cellule. D'autres    
  210. * comme les System Exclusive nécessitent plusieurs cellules chaînées.            
  211. *******************************************************************************/
  212.  
  213.  
  214. /*------------------------ System Exclusive extension cell ----------------------*/
  215.  
  216.     typedef struct TMidiSEX *MidiSEXPtr;    
  217.     typedef struct TMidiSEX
  218.     {
  219.         MidiSEXPtr link;                    /* link to next cell                */
  220.         Byte data[12];                        /* 12 data bytes                    */
  221.     }    TMidiSEX;                        
  222.     
  223.  
  224. /*------------------------------ Private extension cell -------------------------*/
  225.  
  226.     typedef struct TMidiST *MidiSTPtr;        
  227.     typedef struct TMidiST                    
  228.     {
  229.         Ptr ptr1;                            /* 4 32-bits fields                 */
  230.         Ptr ptr2;                            
  231.         Ptr ptr3;
  232.         Ptr ptr4;                        
  233.     }    TMidiST;                        
  234.         
  235.  
  236. /*------------------------- Common Event Structure ----------------------*/
  237.  
  238.     typedef struct TMidiEv *MidiEvPtr;        
  239.     typedef struct TMidiEv
  240.     {
  241.         MidiEvPtr link;                        /* link to next event                */
  242.         unsigned long date;                    /* event date (in ms)                 */
  243.         Byte evType;                        /* event type                         */
  244.         Byte refNum;                        /* sender reference number             */
  245.         Byte port;                            /* Midi port                         */
  246.         Byte chan;                            /* Midi channel                         */
  247.         union {                                /* info depending of event type :    */
  248.             struct {                            /* for notes                    */
  249.                 Byte pitch;                            /* pitch                      */
  250.                 Byte vel;                            /* velocity                 */
  251.                 unsigned short dur;                    /* duration                 */
  252.             } note;
  253.  
  254.             struct {                            /* for MidiFile time signature  */
  255.                 Byte numerator;                        /* numerator                */
  256.                 Byte denominator;                    /* denominator as neg power    */
  257.                                                     /* of 2. (2= quarter note)    */
  258.                 Byte nClocks;                        /* number of Midi clocks in */
  259.                                                     /* a metronome click        */
  260.                 Byte n32nd;                            /* number of 32nd notes in    */
  261.                                                     /* a Midi quarter note        */
  262.             } timeSign;
  263.  
  264.             struct {                            /* for MidiFile key signature    */
  265.                 char ton;                            /* 0: key of C, 1: 1 sharp    */
  266.                                                     /* -1: 1 flat etc...        */
  267.                 Byte mode;                            /* 0: major 1: minor        */
  268.                 Byte unused[2];
  269.             } keySign;
  270.  
  271.             struct {                            /* for MidiFile sequence number */
  272.                 unsigned short number;
  273.                 short unused;
  274.             } seqNum;
  275.             long tempo;                            /* MidiFile tempo in            */
  276.                                                 /* microsec/Midi quarter note    */
  277.             Byte data[4];                        /* for other small events         */
  278.             MidiSEXPtr linkSE;                    /* link to last sysex extension    */
  279.             MidiSTPtr linkST;                    /* link to private extension    */
  280.         } info;
  281.     } TMidiEv;        
  282.  
  283.     
  284. /*------------------------------ sequence header ---------------------------*/
  285.  
  286.     typedef struct TMidiSeq *MidiSeqPtr;    
  287.     typedef struct TMidiSeq
  288.     {
  289.         MidiEvPtr first;                    /* first event pointer                 */
  290.         MidiEvPtr last;                        /* last event pointer                 */
  291.         Ptr undef1;
  292.         Ptr undef2;
  293.     }    TMidiSeq;
  294.     
  295.  
  296. /*-------------------------------- input Filter -------------------------------*/
  297.  
  298.     typedef struct TFilter *FilterPtr;
  299.     typedef struct TFilter
  300.     {
  301.         char port[32];                        /* 256 bits    */
  302.         char evType[32];                    /* 256 bits */
  303.         char channel[2];                    /*  16 bits    */
  304.         char unused[2];                        /*  16 bits */
  305.     } TFilter; 
  306.     
  307.  
  308. /*------------------------ MidiShare application name ------------------------*/
  309.  
  310.     typedef unsigned char* MidiName;
  311.     
  312.  
  313. /*------------------------ Synchronisation informations -----------------------*/
  314.  
  315.     typedef struct TSyncInfo *SyncInfoPtr;
  316.     typedef struct TSyncInfo
  317.     {
  318.          long        time;
  319.          long        reenter;
  320.          unsigned short    syncMode;
  321.          Byte        syncLocked; 
  322.          Byte        syncPort;
  323.         long        syncStart;
  324.         long        syncStop;
  325.         long        syncOffset;
  326.         long        syncSpeed;
  327.         long        syncBreaks;
  328.         short        syncFormat;
  329.     } TSyncInfo; 
  330.  
  331.     typedef struct TSmpteLocation *SmpteLocPtr;
  332.     typedef struct TSmpteLocation
  333.     {
  334.          short        format;            // (0:24f/s, 1:25f/s, 2:30DFf/s, 3:30f/s)
  335.          short        hours;            // 0..23
  336.          short        minutes;        // 0..59
  337.          short        seconds;        // 0..59
  338.          short        frames;            // 0..30 (according to format)
  339.          short        fracs;            // 0..99 (1/100 of frames)
  340.     } TSmpteLocation; 
  341.     
  342.     
  343. /*----------------------------- Alarms prototypes ----------------------------*/
  344.  
  345.     typedef pascal void (* TaskPtr)( long date, short refNum, long a1,long a2,long a3 );
  346.     typedef pascal void (* RcvAlarmPtr)( short refNum );
  347.     typedef pascal void (* ApplAlarmPtr)( short refNum, long code );
  348.     typedef pascal void (* ApplyProcPtr)( MidiEvPtr e );
  349.  
  350.  
  351. /******************************************************************************
  352. *                                FIELD MACROS                            
  353. *------------------------------------------------------------------------------
  354. * Somes macros to read and write event's fields                     
  355. *******************************************************************************/
  356.  
  357.     #define Link(e)     ( (e)->link )
  358.     #define Date(e)     ( (e)->date )
  359.     #define EvType(e)     ( (e)->evType )
  360.     #define RefNum(e)     ( (e)->refNum )    
  361.     #define Port(e)     ( (e)->port )
  362.     #define Canal(e)    ( (e)->chan )
  363.     #define Chan(e)        ( (e)->chan )
  364.     #define Pitch(e)     ( (e)->info.note.pitch ) 
  365.     #define Vel(e)         ( (e)->info.note.vel ) 
  366.     #define Dur(e)         ( (e)->info.note.dur )
  367.     #define Data(e)     ( (e)->info.data )
  368.     #define LinkSE(e)     ( (e)->info.linkSE )
  369.     #define LinkST(e)     ( (e)->info.linkST )
  370.  
  371.     #define TSNum(e)    ( (e)->info.timeSign.numerator )
  372.     #define TSDenom(e)    ( (e)->info.timeSign.denominator )
  373.     #define TSClocks(e)    ( (e)->info.timeSign.nClocks )
  374.     #define TS32nd(e)    ( (e)->info.timeSign.n32nd )
  375.  
  376.     #define KSTon(e)    ( (e)->info.keySign.ton )
  377.     #define KSMode(e)    ( (e)->info.keySign.mode )
  378.  
  379.     #define Tempo(e)    ( (e)->info.tempo )
  380.     #define SeqNum(e)    ( (e)->info.seqNum.number )
  381.     #define ChanPrefix(e) ((e)->info.data[0] )
  382.  
  383.     #define First(e)    ( (e)->first )
  384.     #define Last(e)        ( (e)->last )
  385.     #define FirstEv(e)    ( (e)->first )
  386.     #define LastEv(e)    ( (e)->last )
  387.  
  388. /******************************************************************************
  389. *                               FILTER MACROS                            
  390. *------------------------------------------------------------------------------
  391. * somes macros to set and reset filter's bits. 
  392. *******************************************************************************/
  393.  
  394. #ifdef __cplusplus
  395. inline void     AcceptBit( char* a, Byte n)         { (a)[(n)>>3] |=  (1<<((n)&7)); }
  396. inline void     RejectBit( char* a, Byte n)         { (a)[(n)>>3] &= ~(1<<((n)&7)); }
  397. inline void     InvertBit( char* a, Byte n)         { (a)[(n)>>3] ^=  (1<<((n)&7)); }
  398.  
  399. inline Boolean     IsAcceptedBit( char* a, Byte n)     { return (a)[(n)>>3] & (1<<((n)&7)); }
  400.  
  401. #else
  402.  
  403.     #define AcceptBit(a,n)             ( ((char*) (a))[(n)>>3] |=   (1<<((n)&7)) )
  404.     #define RejectBit(a,n)             ( ((char*) (a))[(n)>>3] &=  ~(1<<((n)&7)) )
  405.     #define InvertBit(a,n)             ( ((char*) (a))[(n)>>3] ^=   (1<<((n)&7)) )
  406.  
  407.     #define IsAcceptedBit(a,n)         ( ((char*) (a))[(n)>>3]  &   (1<<((n)&7)) )
  408. #endif
  409.  
  410.  
  411. /*******************************************************************************
  412. *                                 ENTRY POINTS                                    
  413. *------------------------------------------------------------------------------
  414. * All the MidiShare entry point are implemented as below :
  415. *            moveq    #nn, d0    ;move entry point ID number into reg d0                                                    
  416. *            move.l    $B8, a0    ;read address of MS dispatch routine from vector $B8                                                    
  417. *            jmp        (a0)    ;jump to dispatch,                                                    
  418. *                                                                                
  419. * Vector $B8 is initialy set by MidiShare Init at boot time.        
  420. *******************************************************************************/
  421.  
  422. #ifdef __cplusplus
  423. extern "C" {
  424. #endif
  425.  
  426. /*--------------------------- Global MidiShare environment --------------------*/
  427.  
  428. pascal    void         MidiShareSpecialInit    (void)                         ={0x7037, 0x2078, 0x00B8, 0x4E90};
  429. pascal    short         MidiGetVersion    (void)                                 ={0x7000, 0x2078, 0x00B8, 0x4E90};
  430.  
  431. pascal    short         MidiCountAppls    (void)                                 ={0x7001, 0x2078, 0x00B8, 0x4E90};
  432. pascal    short         MidiGetIndAppl     (short index)                         ={0x7002, 0x2078, 0x00B8, 0x4E90};        
  433. pascal    short         MidiGetNamedAppl(MidiName name)                     ={0x7003, 0x2078, 0x00B8, 0x4E90};
  434.  
  435. /*----------------------------- SMPTE synchronization -------------------------*/
  436.  
  437. pascal    void         MidiGetSyncInfo    (SyncInfoPtr p)                     ={0x7038, 0x2078, 0x00B8, 0x4E90};
  438. pascal    void         MidiSetSyncMode    (unsigned short mode)                 ={0x7039, 0x2078, 0x00B8, 0x4E90};
  439. pascal    long         MidiGetExtTime    (void)                                 ={0x703D, 0x2078, 0x00B8, 0x4E90};                        
  440. pascal    long         MidiInt2ExtTime    (long)                                 ={0x703E, 0x2078, 0x00B8, 0x4E90};                        
  441. pascal    long         MidiExt2IntTime    (long)                                 ={0x703F, 0x2078, 0x00B8, 0x4E90};                        
  442. pascal    void         MidiTime2Smpte    (long time, short format, SmpteLocPtr loc) ={0x7040, 0x2078, 0x00B8, 0x4E90};                        
  443. pascal    long         MidiSmpte2Time    (SmpteLocPtr loc)                     ={0x7041, 0x2078, 0x00B8, 0x4E90};                        
  444.  
  445. pascal     long*        MidiGetTimeAddr    ()                                    ={0x7042, 0x2078, 0x00B8, 0x4E90};
  446.  
  447. /*----------------------------- Open / close application ----------------------*/
  448.  
  449. pascal short         MidiOpen         (MidiName applName)                 ={0x7004, 0x2078, 0x00B8, 0x4E90};
  450. pascal void         MidiClose         (short refNum)                         ={0x7005, 0x2078, 0x00B8, 0x4E90};    
  451.  
  452.  
  453. /*--------------------------- Application configuration -----------------------*/
  454.  
  455. pascal    MidiName     MidiGetName     (short refNum)                         ={0x7006, 0x2078, 0x00B8, 0x4E90};
  456. pascal    void         MidiSetName     (short refNum, MidiName applName)     ={0x7007, 0x2078, 0x00B8, 0x4E90};
  457. pascal    void*         MidiGetInfo     (short refNum)                         ={0x7008, 0x2078, 0x00B8, 0x4E90};    
  458. pascal    void         MidiSetInfo     (short refNum, void* InfoZone)         ={0x7009, 0x2078, 0x00B8, 0x4E90};
  459. pascal    FilterPtr     MidiGetFilter     (short refNum)                         ={0x700A, 0x2078, 0x00B8, 0x4E90};
  460. pascal    void         MidiSetFilter     (short refNum, FilterPtr f)         ={0x700B, 0x2078, 0x00B8, 0x4E90};
  461. pascal    RcvAlarmPtr MidiGetRcvAlarm (short refNum)                         ={0x700C, 0x2078, 0x00B8, 0x4E90};        
  462. pascal    void         MidiSetRcvAlarm (short refNum, RcvAlarmPtr alarm)     ={0x700D, 0x2078, 0x00B8, 0x4E90};    
  463. pascal    ApplAlarmPtr MidiGetApplAlarm (short refNum)                     ={0x700E, 0x2078, 0x00B8, 0x4E90};        
  464. pascal    void         MidiSetApplAlarm (short refNum, ApplAlarmPtr alarm) ={0x700F, 0x2078, 0x00B8, 0x4E90};
  465.  
  466.  
  467. /*------------------------- Inter-Application Connections ---------------------*/
  468.  
  469. pascal    void     MidiConnect     (short src, short dest , Boolean state) ={0x7010, 0x2078, 0x00B8, 0x4E90};
  470. pascal    Boolean MidiIsConnected (short src, short dest)                 ={0x7011, 0x2078, 0x00B8, 0x4E90};
  471.  
  472.  
  473. /*-------------------------------- Serial ports -------------------------------*/
  474.  
  475. pascal    Boolean MidiGetPortState (short port)                             ={0x7012, 0x2078, 0x00B8, 0x4E90};    
  476. pascal    void     MidiSetPortState (short port, Boolean state)             ={0x7013, 0x2078, 0x00B8, 0x4E90};
  477.  
  478.  
  479. /*-------------------------- Events and memory managing -----------------------*/
  480.  
  481. pascal    long     MidiFreeSpace    (void)                                     ={0x7014, 0x2078, 0x00B8, 0x4E90};                        
  482.  
  483. pascal    MidiEvPtr MidiNewCell     (void)                                     ={0x7033, 0x2078, 0x00B8, 0x4E90};            
  484. pascal    void       MidiFreeCell     (MidiEvPtr e)                             ={0x7034, 0x2078, 0x00B8, 0x4E90};                    
  485. pascal    long       MidiTotalSpace (void)                                    ={0x7035, 0x2078, 0x00B8, 0x4E90};
  486. pascal    long       MidiGrowSpace (long n)                                ={0x7036, 0x2078, 0x00B8, 0x4E90};
  487.  
  488. pascal    MidiEvPtr MidiNewEv     (short typeNum)                         ={0x7015, 0x2078, 0x00B8, 0x4E90};            
  489. pascal    MidiEvPtr MidiCopyEv     (MidiEvPtr e)                             ={0x7016, 0x2078, 0x00B8, 0x4E90};            
  490. pascal    void       MidiFreeEv     (MidiEvPtr e)                             ={0x7017, 0x2078, 0x00B8, 0x4E90};                    
  491.  
  492. pascal    void     OldMidiSetField     (MidiEvPtr e, short f, long v)         ={0x7018, 0x2078, 0x00B8, 0x4E90};
  493. pascal    long    OldMidiGetField     (MidiEvPtr e, short f)                 ={0x7019, 0x2078, 0x00B8, 0x4E90};
  494. pascal    short     OldMidiCountFields (MidiEvPtr e)                         ={0x701B, 0x2078, 0x00B8, 0x4E90};
  495.  
  496. pascal    void     MidiSetField     (MidiEvPtr e, long f, long v)             ={0x703A, 0x2078, 0x00B8, 0x4E90};
  497. pascal    long    MidiGetField     (MidiEvPtr e, long f)                     ={0x703B, 0x2078, 0x00B8, 0x4E90};
  498. pascal    void     MidiAddField     (MidiEvPtr e, long v)                     ={0x701A, 0x2078, 0x00B8, 0x4E90};
  499. pascal    long     MidiCountFields (MidiEvPtr e)                             ={0x703C, 0x2078, 0x00B8, 0x4E90};
  500.  
  501.  
  502. /*------------------------------- Sequence managing ---------------------------*/
  503.  
  504. pascal    MidiSeqPtr MidiNewSeq    (void)                                     ={0x701D, 0x2078, 0x00B8, 0x4E90};                             
  505. pascal    void     MidiAddSeq         (MidiSeqPtr s, MidiEvPtr e)             ={0x701E, 0x2078, 0x00B8, 0x4E90};
  506. pascal    void     MidiFreeSeq     (MidiSeqPtr s)                             ={0x701F, 0x2078, 0x00B8, 0x4E90};        
  507. pascal    void     MidiClearSeq     (MidiSeqPtr s)                             ={0x7020, 0x2078, 0x00B8, 0x4E90};            
  508. pascal    void     MidiApplySeq     (MidiSeqPtr s, ApplyProcPtr proc)        ={0x7021, 0x2078, 0x00B8, 0x4E90}; 
  509.  
  510.  
  511. /*------------------------------------- Time ----------------------------------*/
  512.  
  513. pascal    long     MidiGetTime        (void)                                     ={0x7022, 0x2078, 0x00B8, 0x4E90};        
  514.  
  515.  
  516. /*------------------------------------ Sending --------------------------------*/
  517.  
  518. pascal    void     MidiSendIm         (short refNum, MidiEvPtr e)             ={0x7023, 0x2078, 0x00B8, 0x4E90};
  519. pascal    void     MidiSend         (short refNum, MidiEvPtr e)             ={0x7024, 0x2078, 0x00B8, 0x4E90};
  520. pascal    void     MidiSendAt         (short refNum, MidiEvPtr e, long d)     ={0x7025, 0x2078, 0x00B8, 0x4E90};    
  521.  
  522.  
  523. /*------------------------------------ Receving -------------------------------*/
  524.  
  525. pascal    long     MidiCountEvs     (short refNum)                             ={0x7026, 0x2078, 0x00B8, 0x4E90};
  526. pascal    MidiEvPtr MidiGetEv     (short refNum)                             ={0x7027, 0x2078, 0x00B8, 0x4E90};
  527. pascal    MidiEvPtr MidiAvailEv     (short refNum)                             ={0x7028, 0x2078, 0x00B8, 0x4E90};
  528. pascal    void     MidiFlushEvs     (short refNum)                             ={0x7029, 0x2078, 0x00B8, 0x4E90};    
  529.  
  530.  
  531. /*----------------------------------- Mail boxes ------------------------------*/
  532.  
  533. pascal    void*     MidiReadSync     (void* adrMem)                             ={0x702A, 0x2078, 0x00B8, 0x4E90};
  534. pascal    void*     MidiWriteSync     (void* adrMem, void* val)                 ={0x702B, 0x2078, 0x00B8, 0x4E90};
  535.  
  536.  
  537. /*---------------------------------- Task Managing ----------------------------*/
  538.  
  539. pascal    void    MidiCall (TaskPtr routine, long date, short refNum, long a1,long a2,long a3)
  540.                                                                          ={0x702C, 0x2078, 0x00B8, 0x4E90};
  541.  
  542. pascal    MidiEvPtr    MidiTask     (TaskPtr routine, long date, short refNum, long a1,long a2,long a3)
  543.                                                                          ={0x702D, 0x2078, 0x00B8, 0x4E90};
  544. pascal    MidiEvPtr    MidiDTask     (TaskPtr routine, long date, short refNum, long a1,long a2,long a3)
  545.                                                                          ={0x702E, 0x2078, 0x00B8, 0x4E90};
  546.  
  547. pascal    void        MidiForgetTask (MidiEvPtr *e)                         ={0x702F, 0x2078, 0x00B8, 0x4E90};
  548.  
  549. pascal    long        MidiCountDTasks (short refnum)                         ={0x7030, 0x2078, 0x00B8, 0x4E90};
  550.  
  551. pascal    void        MidiFlushDTasks (short refnum)                         ={0x7031, 0x2078, 0x00B8, 0x4E90};
  552.  
  553. pascal    void        MidiExec1DTask     (short refnum)                         ={0x7032, 0x2078, 0x00B8, 0x4E90};
  554.  
  555.  
  556. /*----------------------------------- MidiShare -------------------------------*/
  557.  
  558. #define MidiShare()     ( **((long**)0xB8) == 0xD080D080 )
  559.  
  560.  
  561. #ifdef __cplusplus
  562. }
  563. #endif
  564.  
  565. #endif
  566.