fixing click & pops on psx decoder, code cleaning for ads/ss2

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@93 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2008-05-09 17:59:05 +00:00
parent b5ac31a088
commit ec3612aafc
2 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@ void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
int16_t hist1=stream->adpcm_history1_16;
int16_t hist2=stream->adpcm_history2_16;
int scale;
short scale;
int i;
int32_t sample_count;
@ -25,9 +25,9 @@ void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
first_sample=first_sample % 28;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
int sample_byte = (short)read_8bit(stream->offset+(framesin*16)+2+i/2,stream->streamfile);
short sample_byte = (short)read_8bit(stream->offset+(framesin*16)+2+i/2,stream->streamfile);
scale = (short)((i&1 ?
scale = ((i&1 ?
sample_byte >> 4 :
sample_byte & 0x0f)<<12);
@ -35,7 +35,7 @@ void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
outbuf[sample_count] = clamp16(sample);
hist2=hist1;
hist1=sample;
hist1=clamp16(sample);
}
stream->adpcm_history1_16=hist1;
stream->adpcm_history2_16=hist2;

View File

@ -48,8 +48,8 @@ VGMSTREAM * init_vgmstream_ps2_ads(const char * const filename) {
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x24,infile)/16*28/vgmstream->channels;
/* SS2 container with RAW Interleaved PCM */
if (read_32bitLE(0x08,infile)==0x01) {
/* SS2 container with RAW Interleaved PCM */
if (read_32bitLE(0x08,infile)!=0x10) {
vgmstream->coding_type=coding_PCM16LE;
vgmstream->num_samples = read_32bitLE(0x24,infile)/2/vgmstream->channels;
}