| version 1.2, 2003/11/28 08:01:32 | version 1.5, 2006/12/23 09:48:11 | 
| Line 13 | Line 13 | 
 | #define MIDIOUTS2(a)            ((a)[0] + ((a)[1] << 8)) | #define MIDIOUTS2(a)            ((a)[0] + ((a)[1] << 8)) | 
 | #define MIDIOUTS3(a)            ((a)[0] + ((a)[1] << 8) + ((a)[2] << 16)) | #define MIDIOUTS3(a)            ((a)[0] + ((a)[1] << 8) + ((a)[2] << 16)) | 
 |  |  | 
| static const BYTE EXCV_GMRESET[] = { | static const UINT8 EXCV_GMRESET[] = { | 
 | 0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7}; | 0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7}; | 
 |  |  | 
 | enum { | enum { | 
| Line 21  enum { | Line 21  enum { | 
 | MIDI_TIMECODE           = 0xf1, | MIDI_TIMECODE           = 0xf1, | 
 | MIDI_SONGPOS            = 0xf2, | MIDI_SONGPOS            = 0xf2, | 
 | MIDI_SONGSELECT         = 0xf3, | MIDI_SONGSELECT         = 0xf3, | 
 |  | MIDI_CABLESELECT        = 0xf5, | 
 | MIDI_TUNEREQUEST        = 0xf6, | MIDI_TUNEREQUEST        = 0xf6, | 
 | MIDI_EOX                        = 0xf7, | MIDI_EOX                        = 0xf7, | 
 | MIDI_TIMING                     = 0xf8, | MIDI_TIMING                     = 0xf8, | 
| Line 44  enum { | Line 45  enum { | 
 | }; | }; | 
 |  |  | 
 | typedef struct { | typedef struct { | 
| BYTE    prog; | UINT8   prog; | 
| BYTE    press; | UINT8   press; | 
 | UINT16  bend; | UINT16  bend; | 
| BYTE    ctrl[28]; | UINT8   ctrl[28]; | 
 | } _MIDICH, *MIDICH; | } _MIDICH, *MIDICH; | 
 |  |  | 
 | typedef struct { | typedef struct { | 
| Line 55  typedef struct { | Line 56  typedef struct { | 
 | UINT            midictrl; | UINT            midictrl; | 
 | UINT            midisyscnt; | UINT            midisyscnt; | 
 | UINT            mpos; | UINT            mpos; | 
| BYTE            midilast; | UINT8           midilast; | 
 | _MIDICH         mch[16]; | _MIDICH         mch[16]; | 
| BYTE            buffer[MIDI_BUFFER]; | UINT8           buffer[MIDI_BUFFER]; | 
 | } _CMMIDI, *CMMIDI; | } _CMMIDI, *CMMIDI; | 
 |  |  | 
 | typedef struct { | typedef struct { | 
| Line 65  typedef struct { | Line 66  typedef struct { | 
 | UINT    rate; | UINT    rate; | 
 | } CMVER; | } CMVER; | 
 |  |  | 
| static const BYTE midictrltbl[] = {     0, 1, 5, 7, 10, 11, 64, | static const UINT8 midictrltbl[] = { 0, 1, 5, 7, 10, 11, 64, | 
 | 65, 66, 67, 84, 91, 93, | 65, 66, 67, 84, 91, 93, | 
 | 94,                                             // for SC-88 | 94,                                             // for SC-88 | 
 | 71, 72, 73, 74};                // for XG | 71, 72, 73, 74};                // for XG | 
 |  |  | 
 | static  CMVER   cmver; | static  CMVER   cmver; | 
| static  BYTE    midictrlindex[128]; | static  UINT8   midictrlindex[128]; | 
 |  |  | 
 |  |  | 
 | // ---- | // ---- | 
| Line 99  const SINT32 *ptr; | Line 100  const SINT32 *ptr; | 
 |  |  | 
 | static void midireset(CMMIDI midi) { | static void midireset(CMMIDI midi) { | 
 |  |  | 
| BYTE    work[4]; | UINT8   work[4]; | 
 |  |  | 
 | midiout_longmsg(midi->midihdl, EXCV_GMRESET, sizeof(EXCV_GMRESET)); | midiout_longmsg(midi->midihdl, EXCV_GMRESET, sizeof(EXCV_GMRESET)); | 
 |  |  | 
| Line 114  static void midireset(CMMIDI midi) { | Line 115  static void midireset(CMMIDI midi) { | 
 |  |  | 
 | static void midisetparam(CMMIDI midi) { | static void midisetparam(CMMIDI midi) { | 
 |  |  | 
| BYTE    i; | UINT8   i; | 
 | UINT    j; | UINT    j; | 
 | MIDICH  mch; | MIDICH  mch; | 
 |  |  | 
| Line 127  static void midisetparam(CMMIDI midi) { | Line 128  static void midisetparam(CMMIDI midi) { | 
 | if (mch->bend != 0xffff) { | if (mch->bend != 0xffff) { | 
 | midiout_shortmsg(midi->midihdl, (mch->bend << 8) + 0xe0+i); | midiout_shortmsg(midi->midihdl, (mch->bend << 8) + 0xe0+i); | 
 | } | } | 
| for (j=0; j<sizeof(midictrltbl)/sizeof(BYTE); j++) { | for (j=0; j<NELEMENTS(midictrltbl); j++) { | 
 | if (mch->ctrl[j+1] != 0xff) { | if (mch->ctrl[j+1] != 0xff) { | 
 | midiout_shortmsg(midi->midihdl, | midiout_shortmsg(midi->midihdl, | 
 | MIDIOUTS(0xb0+i, midictrltbl[j], mch->ctrl[j+1])); | MIDIOUTS(0xb0+i, midictrltbl[j], mch->ctrl[j+1])); | 
| Line 142  static void midisetparam(CMMIDI midi) { | Line 143  static void midisetparam(CMMIDI midi) { | 
 |  |  | 
 | // ---- | // ---- | 
 |  |  | 
| static UINT midiread(COMMNG self, BYTE *data) { | static UINT midiread(COMMNG self, UINT8 *data) { | 
 |  |  | 
 | (void)self; | (void)self; | 
 | (void)data; | (void)data; | 
 | return(0); | return(0); | 
 | } | } | 
 |  |  | 
| static UINT midiwrite(COMMNG self, BYTE data) { | static UINT midiwrite(COMMNG self, UINT8 data) { | 
 |  |  | 
 | CMMIDI  midi; | CMMIDI  midi; | 
 | MIDICH  mch; | MIDICH  mch; | 
| Line 202  static UINT midiwrite(COMMNG self, BYTE | Line 203  static UINT midiwrite(COMMNG self, BYTE | 
 | midi->midisyscnt = 2; | midi->midisyscnt = 2; | 
 | break; | break; | 
 |  |  | 
| case MIDI_TUNEREQUEST: | case MIDI_CABLESELECT: | 
 | midi->midictrl = MIDICTRL_SYSTEM; | midi->midictrl = MIDICTRL_SYSTEM; | 
 | midi->midisyscnt = 1; | midi->midisyscnt = 1; | 
 | break; | break; | 
 |  |  | 
 |  | //                                              case MIDI_TUNEREQUEST: | 
 | //                                              case MIDI_EOX: | //                                              case MIDI_EOX: | 
 | default: | default: | 
 | return(1); | return(1); | 
| Line 256  static UINT midiwrite(COMMNG self, BYTE | Line 258  static UINT midiwrite(COMMNG self, BYTE | 
 | if (midi->buffer[1] == 123) { | if (midi->buffer[1] == 123) { | 
 | mch->press = 0; | mch->press = 0; | 
 | mch->bend = 0x4000; | mch->bend = 0x4000; | 
| mch->ctrl[1] = 0;                       // Modulation | mch->ctrl[1+1] = 0;                     // Modulation | 
| mch->ctrl[5] = 127;                     // Explession | mch->ctrl[5+1] = 127;           // Explession | 
| mch->ctrl[6] = 0;                       // Hold | mch->ctrl[6+1] = 0;                     // Hold | 
| mch->ctrl[7] = 0;                       // Portament | mch->ctrl[7+1] = 0;                     // Portament | 
| mch->ctrl[8] = 0;                       // Sostenute | mch->ctrl[8+1] = 0;                     // Sostenute | 
| mch->ctrl[9] = 0;                       // Soft | mch->ctrl[9+1] = 0;                     // Soft | 
 | } | } | 
 | else { | else { | 
 | mch->ctrl[midictrlindex[midi->buffer[1]]] | mch->ctrl[midictrlindex[midi->buffer[1]]] | 
| Line 315  static UINT midiwrite(COMMNG self, BYTE | Line 317  static UINT midiwrite(COMMNG self, BYTE | 
 | return(0); | return(0); | 
 | } | } | 
 |  |  | 
| static BYTE midigetstat(COMMNG self) { | static UINT8 midigetstat(COMMNG self) { | 
 |  |  | 
 | return(0x00); | return(0x00); | 
 | } | } | 
| Line 375  void cmvermouth_initialize(void) { | Line 377  void cmvermouth_initialize(void) { | 
 | UINT    i; | UINT    i; | 
 |  |  | 
 | ZeroMemory(midictrlindex, sizeof(midictrlindex)); | ZeroMemory(midictrlindex, sizeof(midictrlindex)); | 
| for (i=0; i<sizeof(midictrltbl)/sizeof(BYTE); i++) { | for (i=0; i<NELEMENTS(midictrltbl); i++) { | 
| midictrlindex[midictrltbl[i]] = (BYTE)(i + 1); | midictrlindex[midictrltbl[i]] = (UINT8)(i + 1); | 
 | } | } | 
 | midictrlindex[32] = 1; | midictrlindex[32] = 1; | 
 | } | } |