Diff for /np2/win9x/cmmidi.cpp between versions 1.7 and 1.12

version 1.7, 2005/03/02 04:28:08 version 1.12, 2011/03/07 09:54:11
Line 1 Line 1
 #include        "compiler.h"  /**
 #include        "np2.h"   * @file        cmmidi.cpp
 #include        "mimpidef.h"   * @brief       Communication port manager (MIDI)
 #include        "commng.h"   *
    * @author      $Author$
    * @date        $Date$
    */
   
   #include "compiler.h"
   #include "np2.h"
   #include "mimpidef.h"
   #include "commng.h"
 #if defined(VERMOUTH_LIB) || defined(MT32SOUND_DLL)  #if defined(VERMOUTH_LIB) || defined(MT32SOUND_DLL)
 #include        "sound.h"  #include "sound.h"
 #endif  #endif
 #if defined(VERMOUTH_LIB)  #if defined(VERMOUTH_LIB)
 #include        "vermouth.h"  #include "vermouth.h"
 #endif  #endif
 #if defined(MT32SOUND_DLL)  #if defined(MT32SOUND_DLL)
 #include        "mt32snd.h"  #include "mt32snd.h"
 #endif  #endif
 #include        "keydisp.h"  #include "keydisp.h"
   
   #if !defined(__GNUC__)
   #pragma comment(lib, "winmm.lib")
   #endif  // !defined(__GNUC__)
   
 #if defined(VERMOUTH_LIB)  #if defined(VERMOUTH_LIB)
 extern  MIDIMOD vermouth_module;  extern  MIDIMOD vermouth_module;
Line 44  enum {  MIDI_MT32 = 0, MIDI_CM32L,  MIDI Line 55  enum {  MIDI_MT32 = 0, MIDI_CM32L,  MIDI
                         MIDI_GM,                MIDI_GS,                MIDI_XG,        MIDI_OTHER};                          MIDI_GM,                MIDI_GS,                MIDI_XG,        MIDI_OTHER};
   
 static const UINT8 EXCV_MTRESET[] = {  static const UINT8 EXCV_MTRESET[] = {
                         0xfe, 0xfe, 0xfe};                          0xf0,0x41,0x10,0x16,0x12,0x7f,0x00,0x00,0x00,0x01,0xf7};
 static const UINT8 EXCV_GMRESET[] = {  static const UINT8 EXCV_GMRESET[] = {
                         0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7};                          0xf0,0x7e,0x7f,0x09,0x01,0xf7};
   static const UINT8 EXCV_GM2RESET[] = {
                           0xf0,0x7e,0x7f,0x09,0x03,0xf7};
 static const UINT8 EXCV_GSRESET[] = {  static const UINT8 EXCV_GSRESET[] = {
                         0xf0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7f, 0x00, 0x41, 0xf7};                          0xf0,0x41,0x10,0x42,0x12,0x40,0x00,0x7f,0x00,0x41,0xf7};
 static const UINT8 EXCV_XGRESET[] = {  static const UINT8 EXCV_XGRESET[] = {
                         0xf0, 0x43, 0x10, 0x4C, 0x00, 0x00, 0x7E, 0x00, 0xf7};                          0xf0,0x43,0x10,0x4c,0x00,0x00,0x7e,0x00,0xf7};
 static const UINT8 EXCV_GMVOLUME[] = {  
                         0xf0, 0x7F, 0x7F, 0x04, 0x01, 0x00, 0x00, 0xF7};  
   
 enum {  enum {
         MIDI_EXCLUSIVE          = 0xf0,          MIDI_EXCLUSIVE          = 0xf0,
         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 208  static UINT module2number(const OEMCHAR  Line 220  static UINT module2number(const OEMCHAR 
         UINT    i;          UINT    i;
   
         for (i=0; i<NELEMENTS(cmmidi_mdlname); i++) {          for (i=0; i<NELEMENTS(cmmidi_mdlname); i++) {
                 if (milstr_extendcmp(module, cmmidi_mdlname[i])) {                  if (!milstr_extendcmp(module, cmmidi_mdlname[i])) {
                         break;                          break;
                 }                  }
         }          }
Line 329  static void SOUNDCALL mt32_getpcm(MIDIHD Line 341  static void SOUNDCALL mt32_getpcm(MIDIHD
   
 // ----  // ----
   
   static void midiallnoteoff(CMMIDI midi) {
   
           UINT    i;
           UINT8   msg[4];
   
           for (i=0; i<0x10; i++) {
                   msg[0] = (UINT8)(0xb0 + i);
                   msg[1] = 0x7b;
                   msg[2] = 0x00;
                   keydisp_midi(msg);
                   midi->shortout(midi, MIDIOUTS3(msg));
           }
   }
   
 static void midireset(CMMIDI midi) {  static void midireset(CMMIDI midi) {
   
 const UINT8     *excv;  const UINT8     *excv;
         UINT    excvsize;          UINT    excvsize;
         UINT8   work[4];  
   
         switch(midi->midimodule) {          switch(midi->midimodule) {
                 case MIDI_GM:                  case MIDI_GM:
Line 372  const UINT8 *excv; Line 397  const UINT8 *excv;
         if (excv) {          if (excv) {
                 midi->longout(midi, excv, excvsize);                  midi->longout(midi, excv, excvsize);
         }          }
           midiallnoteoff(midi);
         work[1] = 0x7b;  
         work[2] = 0x00;  
         for (work[0]=0xb0; work[0]<0xc0; work[0]++) {  
                 keydisp_midi(work);  
                 midi->shortout(midi, MIDIOUTS3(work));  
         }  
 }  }
   
 static void midisetparam(CMMIDI midi) {  static void midisetparam(CMMIDI midi) {
Line 478  static UINT midiwrite(COMMNG self, UINT8 Line 497  static UINT midiwrite(COMMNG self, UINT8
                                                         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 694  static void midirelease(COMMNG self) { Line 714  static void midirelease(COMMNG self) {
         CMMIDI  midi;          CMMIDI  midi;
   
         midi = (CMMIDI)(self + 1);          midi = (CMMIDI)(self + 1);
           midiallnoteoff(midi);
         if (midi->opened & CMMIDI_MIDIOUT) {          if (midi->opened & CMMIDI_MIDIOUT) {
                 waitlastexclusiveout(midi);                  waitlastexclusiveout(midi);
                 midiOutReset(midi->out.win32.hmidiout);                  midiOutReset(midi->out.win32.hmidiout);
Line 762  COMMNG cmmidi_create(const OEMCHAR *midi Line 783  COMMNG cmmidi_create(const OEMCHAR *midi
                 }                  }
         }          }
         if (getmidiinid(midiin, &id) == SUCCESS) {          if (getmidiinid(midiin, &id) == SUCCESS) {
                 if (midiInOpen(&hmidiin, id, (DWORD)hWndMain, 0, CALLBACK_WINDOW)                  if (midiInOpen(&hmidiin, id, (DWORD)g_hWndMain, 0, CALLBACK_WINDOW)
                                                                                                                 == MMSYSERR_NOERROR) {                                                                                                                  == MMSYSERR_NOERROR) {
                         midiInReset(hmidiin);                          midiInReset(hmidiin);
                         opened |= CMMIDI_MIDIIN;                          opened |= CMMIDI_MIDIIN;

Removed from v.1.7  
changed lines
  Added in v.1.12


RetroPC.NET-CVS <cvs@retropc.net>