Diff for /np2/sound/sound.c between versions 1.6 and 1.10

version 1.6, 2003/10/22 15:21:23 version 1.10, 2003/12/08 00:55:33
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 #include        "soundmng.h"  #include        "soundmng.h"
 #include        "i286.h"  #include        "cpucore.h"
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
 #include        "sound.h"  #include        "sound.h"
Line 33  static SNDSTREAM sndstream; Line 33  static SNDSTREAM sndstream;
   
 static void streamreset(void) {  static void streamreset(void) {
   
           SNDCSEC_ENTER;
         sndstream.ptr = sndstream.buffer;          sndstream.ptr = sndstream.buffer;
         sndstream.remain = sndstream.samples + sndstream.reserve;          sndstream.remain = sndstream.samples + sndstream.reserve;
         sndstream.cbreg = sndstream.cb;          sndstream.cbreg = sndstream.cb;
           SNDCSEC_LEAVE;
 }  }
   
 static void streamprepare(UINT samples) {  static void streamprepare(UINT samples) {
Line 95  BOOL sound_create(UINT rate, UINT ms) { Line 97  BOOL sound_create(UINT rate, UINT ms) {
         }          }
         sndstream.samples = samples;          sndstream.samples = samples;
         sndstream.reserve = reserve;          sndstream.reserve = reserve;
         streamreset();  
   
         SNDCSEC_INIT;          SNDCSEC_INIT;
           streamreset();
         return(SUCCESS);          return(SUCCESS);
   
 scre_err2:  scre_err2:
Line 111  void sound_destroy(void) { Line 113  void sound_destroy(void) {
   
         if (sndstream.buffer) {          if (sndstream.buffer) {
                 soundmng_stop();                  soundmng_stop();
                   streamreset();
                 soundmng_destroy();                  soundmng_destroy();
                 SNDCSEC_TERM;                  SNDCSEC_TERM;
                 _MFREE(sndstream.buffer);                  _MFREE(sndstream.buffer);
Line 123  void sound_reset(void) { Line 126  void sound_reset(void) {
         if (sndstream.buffer) {          if (sndstream.buffer) {
                 soundmng_reset();                  soundmng_reset();
                 streamreset();                  streamreset();
                 soundcfg.lastclock = I286_CLOCK;                  soundcfg.lastclock = CPU_CLOCK;
                 beep_eventreset();                  beep_eventreset();
         }          }
 }  }
Line 151  void sound_changeclock(void) { Line 154  void sound_changeclock(void) {
         soundcfg.hzbase = hz;          soundcfg.hzbase = hz;
         soundcfg.clockbase = clock;          soundcfg.clockbase = clock;
         soundcfg.minclock = 2 * clock / hz;          soundcfg.minclock = 2 * clock / hz;
         soundcfg.lastclock = I286_CLOCK;          soundcfg.lastclock = CPU_CLOCK;
 }  }
   
 void sound_streamregist(void *hdl, SOUNDCB cbfn) {  void sound_streamregist(void *hdl, SOUNDCB cbfn) {
Line 177  void sound_sync(void) { Line 180  void sound_sync(void) {
                 return;                  return;
         }          }
   
         length = I286_CLOCK + I286_BASECLOCK - I286_REMCLOCK - soundcfg.lastclock;          length = CPU_CLOCK + CPU_BASECLOCK - CPU_REMCLOCK - soundcfg.lastclock;
         if (length < soundcfg.minclock) {          if (length < soundcfg.minclock) {
                 return;                  return;
         }          }
Line 205  const SINT32 *sound_pcmlock(void) { Line 208  const SINT32 *sound_pcmlock(void) {
 const SINT32 *ret;  const SINT32 *ret;
   
         if (locks) {          if (locks) {
                   TRACEOUT(("sound pcm lock: already locked"));
                 return(NULL);                  return(NULL);
         }          }
         locks++;          locks++;
Line 213  const SINT32 *ret; Line 217  const SINT32 *ret;
                 SNDCSEC_ENTER;                  SNDCSEC_ENTER;
                 if (sndstream.remain > sndstream.reserve) {                  if (sndstream.remain > sndstream.reserve) {
                         streamprepare(sndstream.remain - sndstream.reserve);                          streamprepare(sndstream.remain - sndstream.reserve);
                         soundcfg.lastclock = I286_CLOCK + I286_BASECLOCK - I286_REMCLOCK;                          soundcfg.lastclock = CPU_CLOCK + CPU_BASECLOCK - CPU_REMCLOCK;
                         beep_eventreset();                          beep_eventreset();
                 }                  }
         }          }
           else {
                   locks--;
           }
         return(ret);          return(ret);
 }  }
   

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


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