Fix .wem DSP full loops

This commit is contained in:
bnnm 2019-08-11 20:22:45 +02:00
parent 7f240f4c45
commit 83e4f8cb28

View File

@ -221,6 +221,7 @@ VGMSTREAM * init_vgmstream_wwise(STREAMFILE *streamFile) {
goto fail; goto fail;
} }
start_offset = ww.data_offset; start_offset = ww.data_offset;
/* build the VGMSTREAM */ /* build the VGMSTREAM */
@ -444,6 +445,15 @@ VGMSTREAM * init_vgmstream_wwise(STREAMFILE *streamFile) {
goto fail; goto fail;
} }
/* for some reason all(?) DSP .wem do full loops (even mono/jingles/etc) but
* several tracks do loop like this, so disable it for short-ish tracks */
if (ww.loop_flag && vgmstream->loop_start_sample == 0 &&
vgmstream->loop_end_sample < 20*ww.sample_rate) { /* in seconds */
vgmstream->loop_flag = 0;
}
/* get coefs and default history */ /* get coefs and default history */
dsp_read_coefs(vgmstream,streamFile,wiih_offset, 0x2e, ww.big_endian); dsp_read_coefs(vgmstream,streamFile,wiih_offset, 0x2e, ww.big_endian);
for (i=0; i < ww.channels; i++) { for (i=0; i < ww.channels; i++) {