Diff for /np2/win9xc/soundmng.cpp between versions 1.1.1.1 and 1.4

version 1.1.1.1, 2003/10/16 17:59:22 version 1.4, 2005/02/07 14:46:15
Line 6 Line 6
 #include        "soundmng.h"  #include        "soundmng.h"
 #include        "sound.h"  #include        "sound.h"
 #if defined(VERMOUTH_LIB)  #if defined(VERMOUTH_LIB)
 #include        "vermouth.h"  #include        "commng.h"
   #include        "cmver.h"
 #endif  #endif
   
   
Line 27 Line 28
 static  LPDIRECTSOUND           pDSound;  static  LPDIRECTSOUND           pDSound;
 static  LPDIRECTSOUNDBUFFER     pDSData3;  static  LPDIRECTSOUNDBUFFER     pDSData3;
 static  UINT                            dsstreambytes;  static  UINT                            dsstreambytes;
 static  BYTE                            dsstreamevent;  static  UINT8                           dsstreamevent;
 static  BYTE                            mute;  static  UINT                            mute;
   static  void                            (PARTSCALL *fnmix)(SINT16 *dst,
 #if defined(VERMOUTH_LIB)                                                                                                  const SINT32 *src, UINT size);
                 MIDIMOD         vermouth_module = NULL;  
 #endif  
   
   
 // ---- directsound  // ---- directsound
Line 62  UINT soundmng_create(UINT rate, UINT ms) Line 61  UINT soundmng_create(UINT rate, UINT ms)
         UINT                    samples;          UINT                    samples;
         DSBUFFERDESC    dsbdesc;          DSBUFFERDESC    dsbdesc;
         PCMWAVEFORMAT   pcmwf;          PCMWAVEFORMAT   pcmwf;
 #if defined(VERMOUTH_LIB)  
         UINT                    num;  
 #endif  
   
         if ((pDSound == NULL) ||          if ((pDSound == NULL) ||
                 (rate != 11025) && (rate != 22050) && (rate != 44100)) {                  (rate != 11025) && (rate != 22050) && (rate != 44100)) {
Line 78  UINT soundmng_create(UINT rate, UINT ms) Line 74  UINT soundmng_create(UINT rate, UINT ms)
         }          }
   
         // キーボード表示のディレイ設定          // キーボード表示のディレイ設定
 //      keydispr_delayinit((BYTE)((ms * 10 + 563) / 564));  //      keydispr_delayinit((UINT8)((ms * 10 + 563) / 564));
   
         samples = (rate * ms) / 2000;          samples = (rate * ms) / 2000;
         samples = (samples + 3) & (~3);          samples = (samples + 3) & (~3);
         dsstreambytes = samples * 2 * sizeof(SINT16);          dsstreambytes = samples * 2 * sizeof(SINT16);
           soundmng_setreverse(FALSE);
   
         ZeroMemory(&pcmwf, sizeof(PCMWAVEFORMAT));          ZeroMemory(&pcmwf, sizeof(PCMWAVEFORMAT));
         pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM;          pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM;
Line 104  UINT soundmng_create(UINT rate, UINT ms) Line 101  UINT soundmng_create(UINT rate, UINT ms)
         }          }
   
 #if defined(VERMOUTH_LIB)  #if defined(VERMOUTH_LIB)
         vermouth_module = midimod_create(rate);          cmvermouth_load(rate);
         for (num=0; num<128; num++) {  
                 midimod_loadprogram(vermouth_module, num);  
                 midimod_loadrhythm(vermouth_module, num);  
         }  
 #endif  #endif
         dsstreamevent = (BYTE)-1;          dsstreamevent = (UINT8)-1;
         soundmng_reset();          soundmng_reset();
         return(samples);          return(samples);
   
Line 138  void soundmng_reset(void) { Line 131  void soundmng_reset(void) {
                 }                  }
                 pDSData3->Unlock(blockptr1, blocksize1, blockptr2, blocksize2);                  pDSData3->Unlock(blockptr1, blocksize1, blockptr2, blocksize2);
                 pDSData3->SetCurrentPosition(0);                  pDSData3->SetCurrentPosition(0);
                 dsstreamevent = (BYTE)-1;                  dsstreamevent = (UINT8)-1;
         }          }
 }  }
   
Line 146  void soundmng_destroy(void) { Line 139  void soundmng_destroy(void) {
   
         if (pDSData3) {          if (pDSData3) {
 #if defined(VERMOUTH_LIB)  #if defined(VERMOUTH_LIB)
                 midimod_destroy(vermouth_module);                  cmvermouth_unload();
                 vermouth_module = NULL;  
 #endif  #endif
                 pDSData3->Stop();                  pDSData3->Stop();
                 pDSData3->Release();                  pDSData3->Release();
Line 202  const SINT32 *pcm; Line 194  const SINT32 *pcm;
         }          }
         if (SUCCEEDED(hr)) {          if (SUCCEEDED(hr)) {
                 if (pcm) {                  if (pcm) {
                         satuation_s16((SINT16 *)blockptr1, pcm, blocksize1);                          (*fnmix)((SINT16 *)blockptr1, pcm, blocksize1);
                 }                  }
                 else {                  else {
                         ZeroMemory(blockptr1, blocksize1);                          ZeroMemory(blockptr1, blocksize1);
Line 236  void soundmng_sync(void) { Line 228  void soundmng_sync(void) {
 }  }
   
 void soundmng_setreverse(BOOL reverse) {  void soundmng_setreverse(BOOL reverse) {
   
           if (!reverse) {
                   fnmix = satuation_s16;
           }
           else {
                   fnmix = satuation_s16x;
           }
 }  }
   
   
Line 262  void soundmng_deinitialize(void) { Line 261  void soundmng_deinitialize(void) {
   
 // ----  // ----
   
 void soundmng_enable(void) {  void soundmng_enable(UINT proc) {
   
         if (mute) {          if (!(mute & (1 << proc))) {
                 mute = 0;                  return;
           }
           mute &= ~(1 << proc);
           if (!mute) {
                 soundmng_reset();                  soundmng_reset();
                 streamenable(TRUE);                  streamenable(TRUE);
         }          }
 }  }
   
 void soundmng_disable(void) {  void soundmng_disable(UINT proc) {
   
         if (!mute) {          if (!mute) {
                 mute = 1;  
                 streamenable(FALSE);                  streamenable(FALSE);
         }          }
           mute |= 1 << proc;
 }  }
   

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


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