github.com/256dpi/max-go@v0.7.0/lib/max/ext_sysmidi.h (about) 1 // sysmidi.h 2 #ifndef _EXT_SYSMIDI_H_ 3 #define _EXT_SYSMIDI_H_ 4 5 #include "ext_prefix.h" 6 #include "ext_mess.h" 7 8 BEGIN_USING_C_LINKAGE 9 10 #if C74_PRAGMA_STRUCT_PACKPUSH 11 #pragma pack(push, 2) 12 #elif C74_PRAGMA_STRUCT_PACK 13 #pragma pack(2) 14 #endif 15 16 enum { 17 SYSMIDI_ENABLED = 1, 18 SYSMIDI_DYNAMIC = 2, 19 SYSMIDI_PERMANENT = 4 20 }; 21 22 typedef struct midistate 23 { 24 long midicmd; /* top nibble of the most recent status byte */ 25 long chan; /* midi channel (if not sysex) */ 26 long sysex; /* true if we are getting a sysex message */ 27 long argc; /* # of bytes received in msg excluding status byte */ 28 t_uint8 *data; 29 } t_midistate; 30 31 typedef struct _midiportinfo { 32 t_symbol *p_name; 33 struct _sysmididriver *p_driver; 34 long p_refnum; 35 long p_id; 36 short p_abbrev; 37 short p_chanoffset; 38 char p_enabled; 39 char p_dynamic; // is (was) a dynamically created port 40 char p_permanent; // should be saved in prefs 41 char p_delete; 42 void *p_data1; 43 long p_data2; 44 void *p_wait; 45 t_midistate p_state; 46 char p_mappingenabled; 47 } t_midiportinfo; 48 49 typedef struct _sysmididriver { 50 t_object d_ob; 51 t_symbol *d_name; 52 char d_available; // positive response on informational instantiation 53 char d_hastimer; 54 method d_sendmethod; 55 method d_bytesreceivedmethod; 56 // driver-specific info follows 57 } t_sysmididriver; 58 59 void sysmidi_enqbigpacket(t_midiportinfo *port, t_uint8 *data, double ts, long len, long contFlags); 60 long sysmidi_numinports(void); 61 long sysmidi_numoutports(void); 62 t_symbol *sysmidi_indextoname(long index, long io); 63 void sysmidi_iterate(method meth, void *arg, long io); 64 t_midiportinfo *sysmidi_createport(long id, long refnum, t_symbol *name, t_sysmididriver *dx, long io, long flags); 65 void sysmidi_deletemarked(long io); 66 t_midiportinfo *sysmidi_idtoport(long id, long io); 67 long sysmidi_uniqueid(void); 68 t_midiportinfo *sysmidi_data1toport(void *data, long io); 69 t_midiportinfo *sysmidi_nametoport(t_symbol *name, long io); 70 71 #if C74_PRAGMA_STRUCT_PACKPUSH 72 #pragma pack(pop) 73 #elif C74_PRAGMA_STRUCT_PACK 74 #pragma pack() 75 #endif 76 77 END_USING_C_LINKAGE 78 79 #endif // _EXT_SYSMIDI_H_