Diff for /np2/wince/soundmng.cpp between versions 1.3 and 1.8

version 1.3, 2003/11/21 06:51:15 version 1.8, 2005/02/11 21:17:23
Line 16 Line 16
   
 typedef struct {  typedef struct {
         HWAVEOUT        hwave;          HWAVEOUT        hwave;
         BYTE            *buffer;          UINT8           *buffer;
         DWORD           samples;          DWORD           samples;
         DWORD           bufalign;          DWORD           bufalign;
         WAVEHDR         wh[2];          WAVEHDR         wh[2];
Line 111  UINT soundmng_create(UINT rate, UINT ms) Line 111  UINT soundmng_create(UINT rate, UINT ms)
         if (waveopened) {          if (waveopened) {
                 return(0);                  return(0);
         }          }
   
           mute = 1 << SNDPROC_NP2;
   
         switch(rate) {          switch(rate) {
                 case 11025:                  case 11025:
                         type = 0;                          type = 0;
Line 145  UINT soundmng_create(UINT rate, UINT ms) Line 148  UINT soundmng_create(UINT rate, UINT ms)
                 }                  }
                 w_ctrl.samples = (ms * rate) / 1000;                  w_ctrl.samples = (ms * rate) / 1000;
                 w_ctrl.bufalign = w_ctrl.samples * 2 * 2;                  w_ctrl.bufalign = w_ctrl.samples * 2 * 2;
                 w_ctrl.buffer = (BYTE *)_MALLOC(w_ctrl.bufalign * 2, "wave mng");                  w_ctrl.buffer = (UINT8 *)_MALLOC(w_ctrl.bufalign * 2, "wave mng");
                 if (w_ctrl.buffer == NULL) {                  if (w_ctrl.buffer == NULL) {
                         return(0);                          return(0);
                 }                  }
Line 182  UINT soundmng_create(UINT rate, UINT ms) Line 185  UINT soundmng_create(UINT rate, UINT ms)
                         currate = rate;                          currate = rate;
                         curms = ms;                          curms = ms;
                         waveopened = TRUE;                          waveopened = TRUE;
                           TRACEOUT(("soundmng success."));
                         return(w_ctrl.samples);                          return(w_ctrl.samples);
                 }                  }
                 _MFREE(w_ctrl.buffer);                  _MFREE(w_ctrl.buffer);
                   TRACEOUT(("soundmng failure."));
         }          }
         return(0);          return(0);
 }  }
   
 void soundmng_destroy(void) {  void soundmng_destroy(void) {
   
         int             i;  #if defined(_WIN32_WCE)
         int             retry = 10;          OSVERSIONINFO   osvi;
   #endif
           BOOL                    hpc4;
           int                             i;
           int                             retry = 10;
   
         if (waveopened) {          if (waveopened) {
 #if (defined(WIN32_PLATFORM_PSPC)) || (!defined(ARM))  #if defined(_WIN32_WCE)
                 for (i=0; i<2; i++) {                  ZeroMemory(&osvi, sizeof(osvi));
                         waveOutUnprepareHeader(w_ctrl.hwave, w_ctrl.wh + i,                  osvi.dwOSVersionInfoSize = sizeof(osvi);
                   GetVersionEx(&osvi);
                   hpc4 = (osvi.dwMajorVersion >= 4);
   #else
                   hpc4 = FALSE;
   #endif
                   if (!hpc4) {
                           for (i=0; i<2; i++) {
                                   waveOutUnprepareHeader(w_ctrl.hwave, w_ctrl.wh + i,
                                                                                                                         sizeof(WAVEHDR));                                                                                                                          sizeof(WAVEHDR));
                         w_ctrl.wh[i].lpData = NULL;                                  w_ctrl.wh[i].lpData = NULL;
                           }
                           waveOutPause(w_ctrl.hwave);
                           waveOutReset(w_ctrl.hwave);
                 }                  }
                 waveOutPause(w_ctrl.hwave);                  else {
                 waveOutReset(w_ctrl.hwave);                  //      誰かシグマリ3でのマトモな開放方法教えてくだちい…
 #else                  //      waveOutReset(w_ctrl.hwave);
                 waveOutReset(w_ctrl.hwave);                          for (i=0; i<2; i++) {
                 for (i=0; i<2; i++) {                                  waveOutUnprepareHeader(w_ctrl.hwave, w_ctrl.wh + i,
                         waveOutUnprepareHeader(w_ctrl.hwave, w_ctrl.wh + i,  
                                                                                                                         sizeof(WAVEHDR));                                                                                                                          sizeof(WAVEHDR));
                         w_ctrl.wh[i].lpData = NULL;                                  w_ctrl.wh[i].lpData = NULL;
                           }
                 }                  }
 #endif  
                 do {                  do {
                         if (waveOutClose(w_ctrl.hwave) == MMSYSERR_NOERROR) {                          if (waveOutClose(w_ctrl.hwave) == MMSYSERR_NOERROR) {
                                 _HANDLE_REM(w_ctrl.hwave);                                  _HANDLE_REM(w_ctrl.hwave);

Removed from v.1.3  
changed lines
  Added in v.1.8


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