fix ea bug for multi channels

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@334 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2008-07-18 19:33:56 +00:00
parent 78a975e081
commit 0a0387bf91
2 changed files with 13 additions and 7 deletions

View File

@ -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; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
outbuf[sample_count]=read_16bitBE(stream->offset+channel_offset,stream->streamfile);
channel_offset+=2;

View File

@ -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) {