mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-22 13:20:16 +01:00
Fix disabling loops also erasing loop points
This commit is contained in:
parent
84f25abdf1
commit
97e46436d7
@ -137,12 +137,15 @@ void setup_vgmstream(VGMSTREAM* vgmstream) {
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
//TODO: this removes loop info after disabling loops externally (this must be called), though this is not very useful
|
||||
/* clean as loops are readable metadata but loop fields may contain garbage
|
||||
* (done *after* dual stereo as it needs loop fields to match) */
|
||||
if (!vgmstream->loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* save start things so we can restart when seeking */
|
||||
memcpy(vgmstream->start_ch, vgmstream->ch, sizeof(VGMSTREAMCHANNEL)*vgmstream->channels);
|
||||
@ -220,7 +223,12 @@ VGMSTREAM* allocate_vgmstream(int channels, int loop_flag) {
|
||||
vgmstream->loop_flag = loop_flag;
|
||||
|
||||
vgmstream->mixer = mixer_init(vgmstream->channels); /* pre-init */
|
||||
//if (!vgmstream->mixer) goto fail;
|
||||
if (!vgmstream->mixer) goto fail;
|
||||
|
||||
#if VGM_TEST_DECODER
|
||||
vgmstream->decode_state = decode_init();
|
||||
if (!vgmstream->decode_state) goto fail;
|
||||
#endif
|
||||
|
||||
//TODO: improve/init later to minimize memory
|
||||
/* garbage buffer for seeking/discarding (local bufs may cause stack overflows with segments/layers)
|
||||
@ -412,6 +420,9 @@ static bool merge_vgmstream(VGMSTREAM* opened_vgmstream, VGMSTREAM* new_vgmstrea
|
||||
opened_vgmstream->layout_type = layout_none; /* fixes some odd cases */
|
||||
|
||||
/* discard the second VGMSTREAM */
|
||||
#if VGM_TEST_DECODER
|
||||
decode_free(new_vgmstream);
|
||||
#endif
|
||||
mixer_free(new_vgmstream->mixer);
|
||||
free(new_vgmstream->tmpbuf);
|
||||
free(new_vgmstream->start_vgmstream);
|
||||
|
Loading…
x
Reference in New Issue
Block a user