fixed acm decoding

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@349 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
halleyscometsw 2008-07-20 06:04:48 +00:00
parent a14cd4082d
commit 01d7dbd326

View File

@ -756,11 +756,24 @@ int acm_read(ACMStream *acm, char *dst, int numbytes,
void decode_acm(mus_acm_codec_data * data, sample * outbuf,
int32_t samples_to_do, int channelspacing) {
int32_t samples_read = 0;
if (data->file_count == 1 && data->current_file == 0)
{
acm_read(data->files[0],(char*)outbuf,samples_to_do*sizeof(sample)*
channelspacing,
0,2,1);
while (samples_read < samples_to_do) {
int32_t bytes_read_just_now;
bytes_read_just_now =
acm_read(data->files[0],(char*)(
outbuf+samples_read*channelspacing),
(samples_to_do-samples_read)*sizeof(sample)*
channelspacing,0,2,1);
if (bytes_read_just_now > 0) {
samples_read +=
bytes_read_just_now/sizeof(sample)/channelspacing;
} else {
return;
}
}
}
}