mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 15:54:05 +01:00
Fix some loop install issues with layers
This commit is contained in:
parent
77173e4ac8
commit
627fbe2f4e
@ -95,6 +95,10 @@ void loop_layout_layered(VGMSTREAM* vgmstream, int32_t loop_sample) {
|
||||
data->layers[layer]->current_sample = data->layers[layer]->loop_end_sample; /* forces do loop */
|
||||
vgmstream_do_loop(data->layers[layer]); /* guaranteed to work should loop_layout be called */
|
||||
}
|
||||
else {
|
||||
/* needed when mixing non-looping layers and installing loop externally */
|
||||
seek_vgmstream(data->layers[layer], loop_sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -796,6 +796,12 @@ void close_vgmstream(VGMSTREAM* vgmstream) {
|
||||
void vgmstream_force_loop(VGMSTREAM* vgmstream, int loop_flag, int loop_start_sample, int loop_end_sample) {
|
||||
if (!vgmstream) return;
|
||||
|
||||
/* ignore bad values (may happen with layers + TXTP loop install) */
|
||||
if (loop_flag && (loop_start_sample < 0 ||
|
||||
loop_start_sample > loop_end_sample ||
|
||||
loop_end_sample > vgmstream->num_samples))
|
||||
return;
|
||||
|
||||
/* this requires a bit more messing with the VGMSTREAM than I'm comfortable with... */
|
||||
if (loop_flag && !vgmstream->loop_flag && !vgmstream->loop_ch) {
|
||||
vgmstream->loop_ch = calloc(vgmstream->channels, sizeof(VGMSTREAMCHANNEL));
|
||||
|
Loading…
x
Reference in New Issue
Block a user