|
|
| version 1.3, 2004/01/08 17:52:47 | version 1.5, 2005/02/07 14:46:13 |
|---|---|
| Line 5 | Line 5 |
| #if defined(__GNUC__) | #if defined(__GNUC__) |
| typedef struct { | typedef struct { |
| char head[4]; | char head[4]; |
| BYTE size[4]; | UINT8 size[4]; |
| char fmt[4]; | char fmt[4]; |
| } __attribute__ ((packed)) RIFF_HEADER; | } __attribute__ ((packed)) RIFF_HEADER; |
| typedef struct { | typedef struct { |
| char head[4]; | char head[4]; |
| BYTE size[4]; | UINT8 size[4]; |
| } __attribute__ ((packed)) WAVE_HEADER; | } __attribute__ ((packed)) WAVE_HEADER; |
| typedef struct { | typedef struct { |
| BYTE format[2]; | UINT8 format[2]; |
| BYTE channel[2]; | UINT8 channel[2]; |
| BYTE rate[4]; | UINT8 rate[4]; |
| BYTE rps[4]; | UINT8 rps[4]; |
| BYTE block[2]; | UINT8 block[2]; |
| BYTE bit[2]; | UINT8 bit[2]; |
| } __attribute__ ((packed)) WAVE_INFOS; | } __attribute__ ((packed)) WAVE_INFOS; |
| typedef struct { | typedef struct { |
| BYTE exsize[2]; | UINT8 exsize[2]; |
| BYTE spb[2]; | UINT8 spb[2]; |
| BYTE numcoef[2]; | UINT8 numcoef[2]; |
| } __attribute__ ((packed)) WAVE_MSA_INFO; | } __attribute__ ((packed)) WAVE_MSA_INFO; |
| #else /* __GNUC__ */ | #else /* __GNUC__ */ |
| Line 34 typedef struct { | Line 34 typedef struct { |
| #pragma pack(push, 1) | #pragma pack(push, 1) |
| typedef struct { | typedef struct { |
| char head[4]; | char head[4]; |
| BYTE size[4]; | UINT8 size[4]; |
| char fmt[4]; | char fmt[4]; |
| } RIFF_HEADER; | } RIFF_HEADER; |
| typedef struct { | typedef struct { |
| char head[4]; | char head[4]; |
| BYTE size[4]; | UINT8 size[4]; |
| } WAVE_HEADER; | } WAVE_HEADER; |
| typedef struct { | typedef struct { |
| BYTE format[2]; | UINT8 format[2]; |
| BYTE channel[2]; | UINT8 channel[2]; |
| BYTE rate[4]; | UINT8 rate[4]; |
| BYTE rps[4]; | UINT8 rps[4]; |
| BYTE block[2]; | UINT8 block[2]; |
| BYTE bit[2]; | UINT8 bit[2]; |
| } WAVE_INFOS; | } WAVE_INFOS; |
| typedef struct { | typedef struct { |
| BYTE exsize[2]; | UINT8 exsize[2]; |
| BYTE spb[2]; | UINT8 spb[2]; |
| BYTE numcoef[2]; | UINT8 numcoef[2]; |
| } WAVE_MSA_INFO; | } WAVE_MSA_INFO; |
| #pragma pack(pop) | #pragma pack(pop) |
| 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(GETSND snd, BYTE *dst) { | static UINT pcm_dec(GETSND snd, UINT8 *dst) { |
| UINT size; | UINT size; |
| UINT cnt; | UINT cnt; |
| BYTE *src; | UINT8 *src; |
| size = min(snd->blocksize, snd->datsize); | size = min(snd->blocksize, snd->datsize); |
| if (size) { | if (size) { |
| Line 115 static UINT pcm_dec(GETSND snd, BYTE *ds | Line 115 static UINT pcm_dec(GETSND snd, BYTE *ds |
| } | } |
| #endif | #endif |
| static const BYTE abits[4] = {0, 1, 0, 2}; | static const UINT8 abits[4] = {0, 1, 0, 2}; |
| static BOOL pcm_open(GETSND snd) { | static BOOL pcm_open(GETSND snd) { |
| Line 153 static const int MSADPCMTable[16] = { | Line 153 static const int MSADPCMTable[16] = { |
| static UINT msa_dec(GETSND snd, SINT16 *dst) { | static UINT msa_dec(GETSND snd, SINT16 *dst) { |
| BYTE *buf; | UINT8 *buf; |
| UINT size; | UINT size; |
| UINT outsamples; | UINT outsamples; |
| int pred[2], delta[2], nibble; | int pred[2], delta[2], nibble; |
| UINT i; | UINT i; |
| BYTE indata; | UINT8 indata; |
| __COEFPAIR *coef; | __COEFPAIR *coef; |
| UINT ch; | UINT ch; |
| SINT32 outdata; | SINT32 outdata; |
| Line 242 static BOOL msa_open(GETSND snd, WAVE_IN | Line 242 static BOOL msa_open(GETSND snd, WAVE_IN |
| UINT spb; | UINT spb; |
| UINT blk; | UINT blk; |
| __COEFPAIR *coef; | __COEFPAIR *coef; |
| BYTE *p; | UINT8 *p; |
| if (snd->bit != 4) { | if ((snd->bit != 4) || |
| (headsize < (sizeof(WAVE_INFOS) + sizeof(WAVE_MSA_INFO)))) { | |
| goto msaopn_err; | goto msaopn_err; |
| } | } |
| info = (WAVE_MSA_INFO *)(wavehead + 1); | info = (WAVE_MSA_INFO *)(wavehead + 1); |
| headsize -= sizeof(WAVE_INFOS); | headsize -= sizeof(WAVE_INFOS); |
| headsize -= sizeof(WAVE_MSA_INFO); | headsize -= sizeof(WAVE_MSA_INFO); |
| if ((signed long)headsize < 0) { | |
| goto msaopn_err; | |
| } | |
| exsize = LOADINTELWORD(info->exsize); | exsize = LOADINTELWORD(info->exsize); |
| spb = LOADINTELWORD(info->spb); | spb = LOADINTELWORD(info->spb); |
| numcoef = LOADINTELWORD(info->numcoef); | numcoef = LOADINTELWORD(info->numcoef); |
| Line 287 static BOOL msa_open(GETSND snd, WAVE_IN | Line 285 static BOOL msa_open(GETSND snd, WAVE_IN |
| snd->decend = msa_decend; | snd->decend = msa_decend; |
| snd->snd = (void *)coef; | snd->snd = (void *)coef; |
| p = (BYTE *)(info + 1); | p = (UINT8 *)(info + 1); |
| do { | do { |
| coef->Coef1 = LOADINTELWORD(p + 0); | coef->Coef1 = LOADINTELWORD(p + 0); |
| coef->Coef2 = LOADINTELWORD(p + 2); | coef->Coef2 = LOADINTELWORD(p + 2); |
| Line 306 msaopn_err: | Line 304 msaopn_err: |
| #define IMA_MAXSTEP 89 | #define IMA_MAXSTEP 89 |
| static BOOL ima_init = FALSE; | static BOOL ima_init = FALSE; |
| static BYTE ima_statetbl[IMA_MAXSTEP][8]; | static UINT8 ima_statetbl[IMA_MAXSTEP][8]; |
| static const int ima_stateadj[8] = {-1, -1, -1, -1, 2, 4, 6, 8}; | static const int ima_stateadj[8] = {-1, -1, -1, -1, 2, 4, 6, 8}; |
| Line 333 static void ima_inittable(void) { | Line 331 static void ima_inittable(void) { |
| else if (k >= IMA_MAXSTEP) { | else if (k >= IMA_MAXSTEP) { |
| k = IMA_MAXSTEP - 1; | k = IMA_MAXSTEP - 1; |
| } | } |
| ima_statetbl[i][j] = (BYTE)k; | ima_statetbl[i][j] = (UINT8)k; |
| } | } |
| } | } |
| } | } |
| Line 342 static UINT ima_dec(GETSND snd, SINT16 * | Line 340 static UINT ima_dec(GETSND snd, SINT16 * |
| UINT c; | UINT c; |
| SINT32 val[2]; | SINT32 val[2]; |
| itn state[2]; | int state[2]; |
| BYTE *src; | UINT8 *src; |
| UINT blk; | UINT blk; |
| if (snd->blocksize > snd->datsize) { | if (snd->blocksize > snd->datsize) { |
| Line 442 imaopn_err: | Line 440 imaopn_err: |
| // ---- MP3 | // ---- MP3 |
| #if defined(SUPPORT_MP3) | #if defined(SUPPORT_MP3) |
| extern BOOL __mp3_open(GETSND snd, BYTE *ptr, UINT size); | extern BOOL __mp3_open(GETSND snd, UINT8 *ptr, UINT size); |
| #endif | #endif |
| // ---- | // ---- |
| BOOL getwave_open(GETSND snd, BYTE *ptr, UINT size) { | BOOL getwave_open(GETSND snd, UINT8 *ptr, UINT size) { |
| RIFF_HEADER *riff; | RIFF_HEADER *riff; |
| WAVE_HEADER *head; | WAVE_HEADER *head; |