Diff for /xmil/sound/sound.c between versions 1.3 and 1.6

version 1.3, 2004/08/11 12:08:16 version 1.6, 2008/06/02 20:07:32
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 // #include     "wavefile.h"  
   #if !defined(DISABLE_SOUND)
   
   #include        "wavefile.h"
 #include        "dosio.h"  #include        "dosio.h"
 #include        "soundmng.h"  #include        "soundmng.h"
 #include        "z80core.h"  #include        "z80core.h"
 #include        "pccore.h"  #include        "pccore.h"
 // #include     "iocore.h"  
 #include        "sound.h"  #include        "sound.h"
 #include        "sndcsec.h"  #include        "sndcsec.h"
 // #include     "getsnd.h"  /* #include     "getsnd.h" */
   
   
         SOUNDCFG        soundcfg;          SOUNDCFG        soundcfg;
Line 65  static void streamprepare(UINT samples)  Line 67  static void streamprepare(UINT samples) 
   
   
 #if defined(SUPPORT_WAVEREC)  #if defined(SUPPORT_WAVEREC)
 // ---- wave rec  /* wave rec */
   
 BOOL sound_recstart(const char *filename) {  BRESULT sound_recstart(const OEMCHAR *filename) {
   
         WAVEWR  rec;          WAVEWR  rec;
   
Line 124  static void streamfilewrite(UINT samples Line 126  static void streamfilewrite(UINT samples
                         else if (samp < -32768) {                          else if (samp < -32768) {
                                 samp = -32768;                                  samp = -32768;
                         }                          }
                         // little endianなので satuation_s16は使えない                          /* little endianなので satuation_s16は使えない */
                         buf[i*2+0] = (UINT8)samp;                          buf[i*2+0] = (UINT8)samp;
                         buf[i*2+1] = (UINT8)(samp >> 8);                          buf[i*2+1] = (UINT8)(samp >> 8);
                 }                  }
Line 164  static void filltailsample(UINT count) { Line 166  static void filltailsample(UINT count) {
 #endif  #endif
   
   
 // ----  /* ---- */
   
 BOOL sound_create(UINT rate, UINT ms) {  BRESULT sound_create(UINT rate, UINT ms) {
   
         UINT    samples;          UINT    samples;
         UINT    reserve;          UINT    reserve;
Line 238  void sound_changeclock(void) { Line 240  void sound_changeclock(void) {
                 return;                  return;
         }          }
   
         // とりあえず 25で割り切れる。          /* とりあえず 25で割り切れる。 */
         clock = pccore.realclock / 25;          clock = pccore.realclock / 25;
         hz = soundcfg.rate / 25;          hz = soundcfg.rate / 25;
   
         // で、クロック数に合せて調整。(64bit演算しろよな的)          /* で、クロック数に合せて調整。(64bit演算しろよな的) */
         hzmax = (1 << (32 - 8)) / (clock >> 8);          hzmax = (1 << (32 - 8)) / (clock >> 8);
         while(hzmax < hz) {          while(hzmax < hz) {
                 clock = (clock + 1) >> 1;                  clock = (clock + 1) >> 1;
Line 268  void sound_streamregist(void *hdl, SOUND Line 270  void sound_streamregist(void *hdl, SOUND
 }  }
   
   
 // ----  /* ---- */
   
 void sound_sync(void) {  void sound_sync(void) {
   
Line 311  const SINT32 *sound_pcmlock(void) { Line 313  const SINT32 *sound_pcmlock(void) {
 const SINT32 *ret;  const SINT32 *ret;
   
         if (locks) {          if (locks) {
 //              TRACEOUT(("sound pcm lock: already locked"));                  /* TRACEOUT(("sound pcm lock: already locked")); */
                 return(NULL);                  return(NULL);
         }          }
         locks++;          locks++;
Line 349  void sound_pcmunlock(const SINT32 *hdl)  Line 351  void sound_pcmunlock(const SINT32 *hdl) 
                 }                  }
                 sndstream.ptr = sndstream.buffer + (leng * 2);                  sndstream.ptr = sndstream.buffer + (leng * 2);
                 sndstream.remain = sndstream.samples + sndstream.reserve - leng;                  sndstream.remain = sndstream.samples + sndstream.reserve - leng;
 //              sndstream.remain += sndstream.samples;                  /* sndstream.remain += sndstream.samples; */
                 SNDCSEC_LEAVE;                  SNDCSEC_LEAVE;
                 locks--;                  locks--;
         }          }
 }  }
   
   #endif
   

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


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