Diff for /np2/sound/psggeng.c between versions 1.1 and 1.4

version 1.1, 2003/10/16 17:58:05 version 1.4, 2003/10/25 17:29:38
Line 5 Line 5
   
 extern  PSGGENCFG       psggencfg;  extern  PSGGENCFG       psggencfg;
   
   // ¥Æ¥¹¥È
   
   static UINT32   rnds;
   
   static UINT psg_rand(void) {
   
           UINT32  rand0;
           UINT32  rand1;
           UINT    c;
   
           rand0 = rnds & 0xffff;
           rand1 = rnds >> 16;
           rand0 = (rand0 >> 5) + (rand0 << 11);
           rand0 += 60043;
           rand1 -= 4953 + ((rand0 >> 16) & 1);
           c = (rand1 >> 15) & 1;
           rand1 = (rand1 << 1) + c;
           rand0 += rand1 + c;
           rnds = (rand1 << 16) + (rand0 & 0xffff);
           return(rand0);
   }
   
 void SOUNDCALL psggen_getpcm(PSGGEN psg, SINT32 *pcm, UINT count) {  void SOUNDCALL psggen_getpcm(PSGGEN psg, SINT32 *pcm, UINT count) {
   
Line 19  void SOUNDCALL psggen_getpcm(PSGGEN psg, Line 40  void SOUNDCALL psggen_getpcm(PSGGEN psg,
         UINT    i;          UINT    i;
         UINT    noise;          UINT    noise;
   
         while(count--) {          if ((psg->mixer & 0x3f) == 0) {
                   count = min(count, psg->puchicount);
                   psg->puchicount -= count;
           }
           if (count == 0) {
                   return;
           }
           do {
                 noisevol = 0;                  noisevol = 0;
                 if (psg->envcnt) {                  if (psg->envcnt) {
                         psg->envcnt--;                          psg->envcnt--;
Line 51  void SOUNDCALL psggen_getpcm(PSGGEN psg, Line 79  void SOUNDCALL psggen_getpcm(PSGGEN psg,
                                 countbak = psg->noise.count;                                  countbak = psg->noise.count;
                                 psg->noise.count -= psg->noise.freq;                                  psg->noise.count -= psg->noise.freq;
                                 if (psg->noise.count > countbak) {                                  if (psg->noise.count > countbak) {
                                         psg->noise.base = rand() & (1 << (1 << PSGADDEDBIT));  //                                      psg->noise.base = GETRAND() & (1 << (1 << PSGADDEDBIT));
                                           psg->noise.base = psg_rand() & (1 << (1 << PSGADDEDBIT));
                                 }                                  }
                                 noisetbl += psg->noise.base;                                  noisetbl += psg->noise.base;
                                 noisetbl >>= 1;                                  noisetbl >>= 1;
Line 68  void SOUNDCALL psggen_getpcm(PSGGEN psg, Line 97  void SOUNDCALL psggen_getpcm(PSGGEN psg,
                                         case 0:                                                 // no mix                                          case 0:                                                 // no mix
                                                 if (tone->puchi) {                                                  if (tone->puchi) {
                                                         tone->puchi--;                                                          tone->puchi--;
                                                         samp += vol;                                                          samp += vol << PSGADDEDBIT;
                                                 }                                                  }
                                                 break;                                                  break;
   
Line 107  void SOUNDCALL psggen_getpcm(PSGGEN psg, Line 136  void SOUNDCALL psggen_getpcm(PSGGEN psg,
                 pcm[0] += samp;                  pcm[0] += samp;
                 pcm[1] += samp;                  pcm[1] += samp;
                 pcm += 2;                  pcm += 2;
         }          } while(--count);
 }  }
   

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


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