mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Fix msadpcm_bytes_to_samples not counting small last block samples
This commit is contained in:
parent
830f904afb
commit
5e00485948
@ -21,10 +21,6 @@ static const int ADPCMCoeffs[7][2] =
|
||||
{ 392, -232 }
|
||||
};
|
||||
|
||||
long msadpcm_bytes_to_samples(long bytes, int block_size, int channels) {
|
||||
return bytes/block_size*((block_size-(7-1)*channels)*2/channels);
|
||||
}
|
||||
|
||||
void decode_msadpcm_stereo(VGMSTREAM * vgmstream, sample * outbuf, int32_t first_sample, int32_t samples_to_do) {
|
||||
VGMSTREAMCHANNEL *ch1,*ch2;
|
||||
int i;
|
||||
@ -161,3 +157,8 @@ void decode_msadpcm_mono(VGMSTREAM * vgmstream, sample * outbuf, int32_t first_s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long msadpcm_bytes_to_samples(long bytes, int block_size, int channels) {
|
||||
return (bytes / block_size) * (block_size - (7-1)*channels) * 2 / channels
|
||||
+ ((bytes % block_size) ? ((bytes % block_size) - (7-1)*channels) * 2 / channels : 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user