Adjust XVAG looping so it's always inside frame boundaries

This commit is contained in:
bnnm 2017-12-28 23:42:04 +01:00
parent 5be6d14b4c
commit f525b891ee

View File

@ -80,16 +80,9 @@ VGMSTREAM * init_vgmstream_xvag(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_PSX;
if (loop_flag) {
if (loop_start!=0) {
vgmstream->loop_start_sample = ((((loop_start/vgmstream->interleave_block_size)-1)*vgmstream->interleave_block_size)/16*28)/channel_count;
if(loop_start%vgmstream->interleave_block_size)
vgmstream->loop_start_sample += (((loop_start%vgmstream->interleave_block_size)-1)/16*14*channel_count);
vgmstream->loop_start_sample = ps_bytes_to_samples(loop_start, vgmstream->channels);
vgmstream->loop_end_sample = ps_bytes_to_samples(loop_end, vgmstream->channels);
}
vgmstream->loop_end_sample = ((((loop_end/vgmstream->interleave_block_size)-1)*vgmstream->interleave_block_size)/16*28)/channel_count;
if (loop_end%vgmstream->interleave_block_size)
vgmstream->loop_end_sample += (((loop_end%vgmstream->interleave_block_size)-1)/16*14*channel_count);
}
break;
}