Diff for /np2/sound/vermouth/midiout.c between versions 1.4 and 1.6

version 1.4, 2003/11/30 12:32:04 version 1.6, 2003/12/24 19:15:51
Line 2 Line 2
 #include        "midiout.h"  #include        "midiout.h"
   
   
 #define MIDIOUT_VERSION         0x103  #define MIDIOUT_VERSION         0x104
 #define MIDIOUT_VERSTRING       "VERMOUTH 1.03"  #define MIDIOUT_VERSTRING       "VERMOUTH 1.04"
   
   
 static const char vermouthver[] = MIDIOUT_VERSTRING;  static const char vermouthver[] = MIDIOUT_VERSTRING;
Line 616  static void allresetmidi(MIDIHDL midi) { Line 616  static void allresetmidi(MIDIHDL midi) {
         CHANNEL chterm;          CHANNEL chterm;
         UINT    flag;          UINT    flag;
   
           midi->master = 127;
         ch = midi->channel;          ch = midi->channel;
         chterm = ch + 16;          chterm = ch + 16;
         ZeroMemory(ch, sizeof(_CHANNEL) * 16);          ZeroMemory(ch, sizeof(_CHANNEL) * 16);
Line 661  MIDIHDL midiout_create(MIDIMOD module, U Line 662  MIDIHDL midiout_create(MIDIMOD module, U
                 ret->samprate = module->samprate;                  ret->samprate = module->samprate;
                 ret->worksize = worksize;                  ret->worksize = worksize;
                 ret->module = module;                  ret->module = module;
                 ret->master = 127;          //      ret->master = 127;
                 ret->bank0[0] = module->tone[0];                  ret->bank0[0] = module->tone[0];
                 ret->bank0[1] = module->tone[1];                  ret->bank0[1] = module->tone[1];
                 ret->sampbuf = (SINT32 *)(ret + 1);                  ret->sampbuf = (SINT32 *)(ret + 1);
Line 731  void midiout_shortmsg(MIDIHDL hdl, UINT3 Line 732  void midiout_shortmsg(MIDIHDL hdl, UINT3
         }          }
 }  }
   
   static void longmsg_gm(MIDIHDL hdl, const BYTE *msg, UINT size) {
   
           if ((size > 5) && (msg[2] == 0x7f) && (msg[3] == 0x09)) {
                   allresetmidi(hdl);                                              // GM reset
           }
   }
   
   static void longmsg_roland(MIDIHDL hdl, const BYTE *msg, UINT size) {
   
           UINT    addr;
   
           if ((size > 10) && (msg[2] == 0x10) &&
                   (msg[3] == 0x42) && (msg[4] == 0x12)) {         // GS data set
                   addr = (msg[5] << 16) + (msg[6] << 8) + msg[7];
                   if ((addr & (~0x400000)) == 0x7f) {                     // GS reset
                           allresetmidi(hdl);
                           TRACEOUT(("GS-Reset"));
                   }
                   else if (addr == 0x400004) {                            // Vol
                           hdl->master = msg[8] & 0x7f;
                           allvolupdate(hdl);
                   }
                   else {
                           TRACEOUT(("Roland GS - %.6x", addr));
                   }
           }
   }
   
 void midiout_longmsg(MIDIHDL hdl, const BYTE *msg, UINT size) {  void midiout_longmsg(MIDIHDL hdl, const BYTE *msg, UINT size) {
   
           UINT    id;
   
         if ((hdl == NULL) || (msg == NULL)) {          if ((hdl == NULL) || (msg == NULL)) {
                 return;                  return;
         }          }
         if ((size > 5) && (msg[1] == 0x7e)) {                   // GM          if (size > 3) {                                                 // (msg[size - 1] == 0xf7)
                 if ((msg[2] == 0x7f) && (msg[3] == 0x09)) {                  id = msg[1];
                         allresetmidi(hdl);                                              // GM reset                  if (id == 0x7e) {                                       // GM
                           longmsg_gm(hdl, msg, size);
                   }
                   else if (id == 0x41) {                          // Roland
                           longmsg_roland(hdl, msg, size);
                 }                  }
         }          }
 }  }

Removed from v.1.4  
changed lines
  Added in v.1.6


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