diff --git a/src/coding/psx_decoder.c b/src/coding/psx_decoder.c index 4f956d24..00393e3a 100644 --- a/src/coding/psx_decoder.c +++ b/src/coding/psx_decoder.c @@ -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; ioffset+(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; diff --git a/src/meta/ps2_ads.c b/src/meta/ps2_ads.c index 07657843..fc0b1cfd 100644 --- a/src/meta/ps2_ads.c +++ b/src/meta/ps2_ads.c @@ -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; }