mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-22 13:20:16 +01:00
Fix some MUSX loops
This commit is contained in:
parent
b00518669e
commit
2e3205ad41
@ -1317,9 +1317,11 @@ size_t xbox_ima_bytes_to_samples(size_t bytes, int channels) {
|
|||||||
size_t dat4_ima_bytes_to_samples(size_t bytes, int channels) {
|
size_t dat4_ima_bytes_to_samples(size_t bytes, int channels) {
|
||||||
int block_align = 0x20 * channels;
|
int block_align = 0x20 * channels;
|
||||||
if (channels <= 0) return 0;
|
if (channels <= 0) return 0;
|
||||||
|
|
||||||
|
int mod = bytes % block_align;
|
||||||
/* DAT4 IMA blocks have a 4 byte header per channel; 2 samples per byte (2 nibbles) */
|
/* DAT4 IMA blocks have a 4 byte header per channel; 2 samples per byte (2 nibbles) */
|
||||||
return (bytes / block_align) * (block_align - 4 * channels) * 2 / channels
|
return (bytes / block_align) * (block_align - 4 * channels) * 2 / channels
|
||||||
+ ((bytes % block_align) ? ((bytes % block_align) - 4 * channels) * 2 / channels : 0); /* unlikely (encoder aligns) */
|
+ ((mod > 0 && mod > 0x04*channels) ? (mod - 0x04*channels) * 2 / channels : 0); /* unlikely (encoder aligns) */
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t apple_ima4_bytes_to_samples(size_t bytes, int channels) {
|
size_t apple_ima4_bytes_to_samples(size_t bytes, int channels) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user