Fixed garbled sounds after seeking in rare cases

This commit is contained in:
bnnm 2017-01-15 20:50:07 +01:00
parent 30ec4d7c41
commit a2aee820af

View File

@ -250,6 +250,11 @@ void input_vgmstream::decode_seek(double p_seconds,abort_callback & p_abort) {
int max_buffer_samples = sizeof(sample_buffer)/sizeof(sample_buffer[0])/vgmstream->channels;
bool loop_okay = loop_forever && vgmstream->loop_flag && !ignore_loop && !force_ignore_loop;
/* odd number of samples are problematic in some decoders */
if (seek_pos_samples % 2) {
seek_pos_samples -= 1;
}
int corrected_pos_samples = seek_pos_samples;
// adjust for correct position within loop