From 0a0387bf91227ac51d5e5b38be6afd84cf6950c7 Mon Sep 17 00:00:00 2001 From: fastelbja Date: Fri, 18 Jul 2008 19:33:56 +0000 Subject: [PATCH] fix ea bug for multi channels git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@334 51a99a44-fe44-0410-b1ba-c3e57ba2b86b --- src/coding/eaxa_decoder.c | 12 ++++++------ src/meta/ea_header.c | 8 +++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/coding/eaxa_decoder.c b/src/coding/eaxa_decoder.c index 66e513c9..af4f7fb2 100644 --- a/src/coding/eaxa_decoder.c +++ b/src/coding/eaxa_decoder.c @@ -16,22 +16,22 @@ long EA_TABLE[20]= { 0x00000000, 0x000000F0, 0x000001CC, 0x00000188, void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel) { uint8_t frame_info; - int32_t sample_count; + int32_t sample_count,sample_pcm_count=0; long coef1,coef2; int i,shift; off_t channel_offset=stream->channel_start_offset; - + first_sample = first_sample%28; frame_info = (uint8_t)read_8bit(stream->offset+channel_offset,stream->streamfile); if(frame_info==0xEE) { channel_offset++; - stream->adpcm_history1_32 = read_16bitBE(stream->offset+channel_offset+(2*channel),stream->streamfile); - stream->adpcm_history2_32 = read_16bitBE(stream->offset+channel_offset+2+(2*channel),stream->streamfile); - - channel_offset+=(2*channelspacing); + stream->adpcm_history1_32 = read_16bitBE(stream->offset+channel_offset,stream->streamfile); + stream->adpcm_history2_32 = read_16bitBE(stream->offset+channel_offset+2,stream->streamfile); + channel_offset+=4; + for (i=first_sample,sample_count=0; ioffset+channel_offset,stream->streamfile); channel_offset+=2; diff --git a/src/meta/ea_header.c b/src/meta/ea_header.c index 0e99d288..44c7618b 100644 --- a/src/meta/ea_header.c +++ b/src/meta/ea_header.c @@ -181,13 +181,19 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) { break; case EA_X360: vgmstream->sample_rate=44100; - vgmstream->ea_compression_version=0x03; break; default: vgmstream->sample_rate=22050; } } + // Set default compression scheme if not define in the header + switch(vgmstream->ea_platform) { + case EA_X360: + vgmstream->ea_compression_version=0x03; + break; + } + vgmstream->num_samples=ea.num_samples; switch(vgmstream->ea_compression_type) {