Diff for /np2/sound/getsnd/getwave.c between versions 1.2 and 1.3

version 1.2, 2004/01/08 17:37:31 version 1.3, 2004/01/08 17:52:47
Line 85  static UINT pcm_dec(GETSND snd, void *ds Line 85  static UINT pcm_dec(GETSND snd, void *ds
         return(size);          return(size);
 }  }
 #elif defined(BYTESEX_BIG)  #elif defined(BYTESEX_BIG)
 static UINT pcm_dec(SMIXTRACK *trk, short *dst) {  static UINT pcm_dec(GETSND snd, BYTE *dst) {
   
 #error pcm_dec: unsupported          UINT    size;
         return(0);          UINT    cnt;
           BYTE    *src;
   
           size = min(snd->blocksize, snd->datsize);
           if (size) {
                   if (snd->bit == 16) {
                           cnt = size >> 1;
                           src = snd->datptr;
                           while(cnt) {
                                   cnt--;
                                   dst[0] = src[1];
                                   dst[1] = src[0];
                                   src += 2;
                                   dst += 2;
                           }
                   }
                   else {
                           CopyMemory(dst, snd->datptr, size);
                   }
                   snd->datptr += size;
                   snd->datsize -= size;
                   size >>= (int)(long)snd->snd;
           }
           return(size);
 }  }
 #endif  #endif
   
Line 108  static BOOL pcm_open(GETSND snd) { Line 131  static BOOL pcm_open(GETSND snd) {
         snd->blocksamples = 0x800;                                      // 適当に。          snd->blocksamples = 0x800;                                      // 適当に。
         snd->blocksize *= snd->blocksamples;          snd->blocksize *= snd->blocksamples;
         snd->snd = (void *)(long)abits[align - 1];          snd->snd = (void *)(long)abits[align - 1];
         snd->dec = pcm_dec;          snd->dec = (GSDEC)pcm_dec;
         return(SUCCESS);          return(SUCCESS);
   
 pcmopn_err:  pcmopn_err:
Line 119  pcmopn_err: Line 142  pcmopn_err:
 // ---- MS-ADPCM  // ---- MS-ADPCM
   
 typedef struct {  typedef struct {
         short Coef1;          SINT16  Coef1;
         short Coef2;          SINT16  Coef2;
 } __COEFPAIR;  } __COEFPAIR;
   
 static const int MSADPCMTable[16] = {  static const int MSADPCMTable[16] = {
Line 128  static const int MSADPCMTable[16] = { Line 151  static const int MSADPCMTable[16] = {
         768, 614, 512, 409, 307, 230, 230, 230           768, 614, 512, 409, 307, 230, 230, 230 
 };  };
   
 static UINT msa_dec(GETSND snd, short *dst) {  static UINT msa_dec(GETSND snd, SINT16 *dst) {
   
         BYTE            *buf;          BYTE            *buf;
         UINT            size;          UINT            size;
Line 138  static UINT msa_dec(GETSND snd, short *d Line 161  static UINT msa_dec(GETSND snd, short *d
         BYTE            indata;          BYTE            indata;
         __COEFPAIR      *coef;          __COEFPAIR      *coef;
         UINT            ch;          UINT            ch;
         long            outdata;          SINT32          outdata;
   
         buf = snd->datptr;                                              // ワーク使ってません。          buf = snd->datptr;                                              // ワーク使ってません。
         size = min(snd->datsize, snd->blocksize);          size = min(snd->datsize, snd->blocksize);
Line 152  static UINT msa_dec(GETSND snd, short *d Line 175  static UINT msa_dec(GETSND snd, short *d
                         pred[1]  = 0;                          pred[1]  = 0;
                         delta[0] = LOADINTELWORD(buf+1);                          delta[0] = LOADINTELWORD(buf+1);
                         delta[1] = 0;                          delta[1] = 0;
                         *dst++   = (short)LOADINTELWORD(buf+5);                          *dst++   = (SINT16)LOADINTELWORD(buf+5);
                         *dst++   = (short)LOADINTELWORD(buf+3);                          *dst++   = (SINT16)LOADINTELWORD(buf+3);
                         buf += 7;                          buf += 7;
                         outsamples = 2 + ((size - 7) * 2);                          outsamples = 2 + ((size - 7) * 2);
                 }                  }
Line 164  static UINT msa_dec(GETSND snd, short *d Line 187  static UINT msa_dec(GETSND snd, short *d
                         pred[1]  = buf[1];                          pred[1]  = buf[1];
                         delta[0] = LOADINTELWORD(buf+2);                          delta[0] = LOADINTELWORD(buf+2);
                         delta[1] = LOADINTELWORD(buf+4);                          delta[1] = LOADINTELWORD(buf+4);
                         *dst++   = (short)LOADINTELWORD(buf+10);                          *dst++   = (SINT16)LOADINTELWORD(buf+10);
                         *dst++   = (short)LOADINTELWORD(buf+12);                          *dst++   = (SINT16)LOADINTELWORD(buf+12);
                         *dst++   = (short)LOADINTELWORD(buf+6);                          *dst++   = (SINT16)LOADINTELWORD(buf+6);
                         *dst++   = (short)LOADINTELWORD(buf+8);                          *dst++   = (SINT16)LOADINTELWORD(buf+8);
                         buf += 14;                          buf += 14;
                         outsamples = 2 + (size - 14);                          outsamples = 2 + (size - 14);
                 }                  }
Line 200  static UINT msa_dec(GETSND snd, short *d Line 223  static UINT msa_dec(GETSND snd, short *d
                         else if (outdata < -32768) {                          else if (outdata < -32768) {
                                 outdata = -32768;                                  outdata = -32768;
                         }                          }
                         *dst++ = (short)outdata;                          *dst++ = (SINT16)outdata;
                 }                  }
         }          }
         return(outsamples);          return(outsamples);
Line 315  static void ima_inittable(void) { Line 338  static void ima_inittable(void) {
         }          }
 }  }
   
 static UINT ima_dec(GETSND snd, short *dst) {  static UINT ima_dec(GETSND snd, SINT16 *dst) {
   
         UINT    c;          UINT    c;
         int             val[2], state[2];          SINT32  val[2];
           itn             state[2];
         BYTE    *src;          BYTE    *src;
         UINT    blk;          UINT    blk;
   
Line 331  static UINT ima_dec(GETSND snd, short *d Line 355  static UINT ima_dec(GETSND snd, short *d
   
         blk = snd->blocksamples;          blk = snd->blocksamples;
         for (c=0; c<snd->channels; c++) {          for (c=0; c<snd->channels; c++) {
                 short tmp;                  SINT16 tmp;
                 tmp = LOADINTELWORD(src);                  tmp = LOADINTELWORD(src);
                 val[c] = tmp;                  val[c] = tmp;
                 *dst++ = (short)val[c];                  *dst++ = (SINT16)val[c];
                 state[c] = src[2];                  state[c] = src[2];
                 if (state[c] >= IMA_MAXSTEP) {                  if (state[c] >= IMA_MAXSTEP) {
                         state[c] = 0;                          state[c] = 0;
Line 372  static UINT ima_dec(GETSND snd, short *d Line 396  static UINT ima_dec(GETSND snd, short *d
                                                 val[c] = -32768;                                                  val[c] = -32768;
                                         }                                          }
                                 }                                  }
                                 *dst = (short)val[c];                                  *dst = (SINT16)val[c];
                                 dst += snd->channels;                                  dst += snd->channels;
                         } while(--r);                          } while(--r);
                         dst -= (8 * snd->channels);                          dst -= (8 * snd->channels);

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


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