Max 5 API Reference
00001 // sysmidi.h 00002 #ifndef _SYSMIDI_H_ 00003 #define _SYSMIDI_H_ 00004 00005 #ifdef __cplusplus 00006 extern "C" { 00007 #endif 00008 00009 #if C74_PRAGMA_STRUCT_PACKPUSH 00010 #pragma pack(push, 2) 00011 #elif C74_PRAGMA_STRUCT_PACK 00012 #pragma pack(2) 00013 #endif 00014 00015 enum { 00016 SYSMIDI_ENABLED = 1, 00017 SYSMIDI_DYNAMIC = 2, 00018 SYSMIDI_PERMANENT = 4 00019 }; 00020 00021 typedef struct midistate 00022 { 00023 long arg1; /* the second byte of a three-byte message */ 00024 long midicmd; /* top nibble of the most recent status byte */ 00025 long chan; /* midi channel (if not sysex) */ 00026 long sysex; /* true if we are getting a sysex message */ 00027 long argc; /* # of bytes received in msg excluding status byte */ 00028 long miditime; /* time the most recent byte was received */ 00029 long gotbyte; /* received but unparsed byte (-1 if none) */ 00030 Byte *data; 00031 } t_midistate; 00032 00033 typedef struct _iq { 00034 long q_head; 00035 long q_tail; 00036 long q_nitems; 00037 long q_size; 00038 long q_busy; 00039 long q_busy2; 00040 Byte *q_data; 00041 Byte q_psysex; 00042 Byte q_gsysex; 00043 } t_iq; 00044 00045 typedef struct _midiportinfo { 00046 t_symbol *p_name; 00047 struct _sysmididriver *p_driver; 00048 long p_refnum; 00049 short p_id; 00050 short p_abbrev; 00051 short p_chanoffset; 00052 char p_enabled; 00053 char p_dynamic; // is (was) a dynamically created port 00054 char p_permanent; // should be saved in prefs 00055 char p_delete; 00056 void *p_data1; 00057 long p_data2; 00058 void *p_wait; 00059 t_midistate p_state; 00060 } t_midiportinfo; 00061 00062 typedef struct _sysmididriver { 00063 t_object d_ob; 00064 t_symbol *d_name; 00065 char d_available; // positive response on informational instantiation 00066 char d_hastimer; 00067 method d_sendmethod; 00068 method d_bytesreceivedmethod; 00069 // driver-specific info follows 00070 } t_sysmididriver; 00071 00072 typedef struct _sysmidi { 00073 t_object s_ob; 00074 short s_inchans; 00075 short s_outchans; 00076 long s_qsize; 00077 t_iq s_q; 00078 void *s_drivers; 00079 void *s_inports; 00080 void *s_outports; 00081 t_patcher *s_dialog; 00082 Point s_topleft; // saved location of dialog 00083 t_box *s_ibp; 00084 t_box *s_obp; 00085 void *s_qelem; 00086 short s_portsopened; 00087 long s_loaddelay; 00088 short s_dstpath; 00089 } t_sysmidi; 00090 00091 short sysmidi_numinports(void); 00092 short sysmidi_numoutports(void); 00093 t_symbol *sysmidi_indextoname(long index, short io); 00094 void sysmidi_iterate(method meth, void *arg, short io); 00095 void sysmidi_enqbigpacket(t_midiportinfo *port, Byte *data, double ts, long len, short contFlags); 00096 t_midiportinfo *sysmidi_createport(long id, long refnum, t_symbol *name, t_sysmididriver *dx, short io, long flags); 00097 void sysmidi_deletemarked(short io); 00098 t_midiportinfo *sysmidi_idtoport(long id, short io); 00099 long sysmidi_uniqueid(void); 00100 t_midiportinfo *sysmidi_data1toport(void *data, short io); 00101 00102 00103 #if C74_PRAGMA_STRUCT_PACKPUSH 00104 #pragma pack(pop) 00105 #elif C74_PRAGMA_STRUCT_PACK 00106 #pragma pack() 00107 #endif 00108 00109 #ifdef __cplusplus 00110 } 00111 #endif 00112 00113 #endif // _SYSMIDI_H_
Copyright © 2008, Cycling '74