--- np2/win9x/cmmidi.cpp 2003/10/25 09:08:24 1.3 +++ np2/win9x/cmmidi.cpp 2005/02/09 20:11:35 1.6 @@ -19,30 +19,30 @@ extern MIDIMOD vermouth_module; #define MIDIOUTS3(a) ((*(UINT32 *)(a)) & 0xffffff) -const char cmmidi_midimapper[] = "MIDI MAPPER"; +const OEMCHAR cmmidi_midimapper[] = OEMTEXT("MIDI MAPPER"); #if defined(VERMOUTH_LIB) -const char cmmidi_vermouth[] = "VERMOUTH"; +const OEMCHAR cmmidi_vermouth[] = OEMTEXT("VERMOUTH"); #endif -const char *cmmidi_mdlname[12] = { - "MT-32", "CM-32L", "CM-64", - "CM-300", "CM-500(LA)", "CM-500(GS)", - "SC-55", "SC-88", "LA", - "GM", "GS", "XG"}; +const OEMCHAR *cmmidi_mdlname[12] = { + OEMTEXT("MT-32"), OEMTEXT("CM-32L"), OEMTEXT("CM-64"), + OEMTEXT("CM-300"), OEMTEXT("CM-500(LA)"), OEMTEXT("CM-500(GS)"), + OEMTEXT("SC-55"), OEMTEXT("SC-88"), OEMTEXT("LA"), + OEMTEXT("GM"), OEMTEXT("GS"), OEMTEXT("XG")}; enum { MIDI_MT32 = 0, MIDI_CM32L, MIDI_CM64, MIDI_CM300, MIDI_CM500LA, MIDI_CM500GS, MIDI_SC55, MIDI_SC88, MIDI_LA, MIDI_GM, MIDI_GS, MIDI_XG, MIDI_OTHER}; -static const BYTE EXCV_MTRESET[] = { +static const UINT8 EXCV_MTRESET[] = { 0xfe, 0xfe, 0xfe}; -static const BYTE EXCV_GMRESET[] = { +static const UINT8 EXCV_GMRESET[] = { 0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7}; -static const BYTE EXCV_GSRESET[] = { +static const UINT8 EXCV_GSRESET[] = { 0xf0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7f, 0x00, 0x41, 0xf7}; -static const BYTE EXCV_XGRESET[] = { +static const UINT8 EXCV_XGRESET[] = { 0xf0, 0x43, 0x10, 0x4C, 0x00, 0x00, 0x7E, 0x00, 0xf7}; -static const BYTE EXCV_GMVOLUME[] = { +static const UINT8 EXCV_GMVOLUME[] = { 0xf0, 0x7F, 0x7F, 0x04, 0x01, 0x00, 0x00, 0xF7}; enum { @@ -84,10 +84,10 @@ typedef struct _cmmidi _CMMIDI; typedef struct _cmmidi *CMMIDI; typedef struct { - BYTE prog; - BYTE press; + UINT8 prog; + UINT8 press; UINT16 bend; - BYTE ctrl[28]; + UINT8 ctrl[28]; } _MIDICH, *MIDICH; struct _cmmidi { @@ -104,21 +104,21 @@ struct _cmmidi { UINT midisyscnt; UINT mpos; - BYTE midilast; - BYTE midiexcvwait; - BYTE midimodule; + UINT8 midilast; + UINT8 midiexcvwait; + UINT8 midimodule; - BYTE buffer[MIDI_BUFFER]; + UINT8 buffer[MIDI_BUFFER]; _MIDICH mch[16]; - BYTE excvbuf[MIDI_BUFFER]; + UINT8 excvbuf[MIDI_BUFFER]; - BYTE def_en; + UINT8 def_en; MIMPIDEF def; UINT recvpos; UINT recvsize; - BYTE recvbuf[MIDI_BUFFER]; - BYTE midiinbuf[MIDI_BUFFER]; + UINT8 recvbuf[MIDI_BUFFER]; + UINT8 midiinbuf[MIDI_BUFFER]; }; typedef struct { @@ -129,17 +129,17 @@ typedef struct { static UINT midiinhdls; static MIDIINHDL midiinhdl[MIDIIN_MAX]; -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, 94, // for SC-88 71, 72, 73, 74}; // for XG -static BYTE midictrlindex[128]; +static UINT8 midictrlindex[128]; // ---- -static BOOL getmidioutid(const char *midiout, UINT *ret) { +static BOOL getmidioutid(const OEMCHAR *midiout, UINT *ret) { UINT num; UINT i; @@ -160,7 +160,7 @@ static BOOL getmidioutid(const char *mid return(FAILURE); } -static BOOL getmidiinid(const char *midiin, UINT *ret) { +static BOOL getmidiinid(const OEMCHAR *midiin, UINT *ret) { UINT num; UINT i; @@ -181,11 +181,11 @@ static BOOL getmidiinid(const char *midi return(FAILURE); } -static UINT module2number(const char *module) { +static UINT module2number(const OEMCHAR *module) { UINT i; - for (i=0; i<(sizeof(cmmidi_mdlname)/sizeof(char *)); i++) { + for (i=0; iexcvbuf, buf, leng); midi->hmidiouthdr.lpData = (char *)midi->excvbuf; @@ -256,9 +256,9 @@ const SINT32 *ptr; static void midireset(CMMIDI midi) { -const BYTE *excv; +const UINT8 *excv; UINT excvsize; - BYTE work[4]; + UINT8 work[4]; switch(midi->midimodule) { case MIDI_GM: @@ -316,7 +316,7 @@ const BYTE *excv; static void midisetparam(CMMIDI midi) { - BYTE i; + UINT8 i; UINT j; MIDICH mch; @@ -328,7 +328,7 @@ static void midisetparam(CMMIDI midi) { if (mch->bend != 0xffff) { midi->outfn(midi, (mch->bend << 8) + 0xe0+i); } - for (j=0; jctrl[j+1] != 0xff) { midi->outfn(midi, MIDIOUTS(0xb0+i, midictrltbl[j], mch->ctrl[j+1])); @@ -343,7 +343,7 @@ static void midisetparam(CMMIDI midi) { // ---- -static UINT midiread(COMMNG self, BYTE *data) { +static UINT midiread(COMMNG self, UINT8 *data) { CMMIDI midi; @@ -357,7 +357,7 @@ static UINT midiread(COMMNG self, BYTE * return(0); } -static UINT midiwrite(COMMNG self, BYTE data) { +static UINT midiwrite(COMMNG self, UINT8 data) { CMMIDI midi; MIDICH mch; @@ -470,12 +470,12 @@ static UINT midiwrite(COMMNG self, BYTE if (midi->buffer[1] == 123) { mch->press = 0; mch->bend = 0x4000; - mch->ctrl[1] = 0; // Modulation - mch->ctrl[5] = 127; // Explession - mch->ctrl[6] = 0; // Hold - mch->ctrl[7] = 0; // Portament - mch->ctrl[8] = 0; // Sostenute - mch->ctrl[9] = 0; // Soft + mch->ctrl[1+1] = 0; // Modulation + mch->ctrl[5+1] = 127; // Explession + mch->ctrl[6+1] = 0; // Hold + mch->ctrl[7+1] = 0; // Portament + mch->ctrl[8+1] = 0; // Sostenute + mch->ctrl[9+1] = 0; // Soft } else { mch->ctrl[midictrlindex[midi->buffer[1]]] @@ -536,7 +536,7 @@ static UINT midiwrite(COMMNG self, BYTE return(0); } -static BYTE midigetstat(COMMNG self) { +static UINT8 midigetstat(COMMNG self) { return(0x00); } @@ -577,7 +577,7 @@ static long midimsg(COMMNG self, UINT ms break; case COMMSG_MIMPIDEFFILE: - mimpidef_load(&midi->def, (char *)param); + mimpidef_load(&midi->def, (OEMCHAR *)param); return(1); case COMMSG_MIMPIDEFEN: @@ -666,14 +666,14 @@ void cmmidi_initailize(void) { UINT i; ZeroMemory(midictrlindex, sizeof(midictrlindex)); - for (i=0; imidilast = 0x80; // midi->midiexcvwait = 0; - midi->midimodule = (BYTE)module2number(module); + midi->midimodule = (UINT8)module2number(module); FillMemory(midi->mch, sizeof(midi->mch), 0xff); return(ret); @@ -777,7 +777,7 @@ cmcre_err1: // ---- midiin callback -static void midiinrecv(CMMIDI midi, const BYTE *data, UINT size) { +static void midiinrecv(CMMIDI midi, const UINT8 *data, UINT size) { UINT wpos; UINT wsize; @@ -831,7 +831,7 @@ void cmmidi_recvdata(HMIDIIN hdr, UINT32 break; #endif } - midiinrecv(midi, (BYTE *)&data, databytes); + midiinrecv(midi, (UINT8 *)&data, databytes); } } @@ -841,7 +841,7 @@ void cmmidi_recvexcv(HMIDIIN hdr, MIDIHD midi = midiinhdlget(hdr); if (midi) { - midiinrecv(midi, (BYTE *)data->lpData, data->dwBytesRecorded); + midiinrecv(midi, (UINT8 *)data->lpData, data->dwBytesRecorded); midiInUnprepareHeader(midi->hmidiin, &midi->hmidiinhdr, sizeof(MIDIHDR)); midiInPrepareHeader(midi->hmidiin,