Fixed problem with looping of particular music tracks

Part of https://forum.zdoom.org/viewtopic.php?t=56333
This commit is contained in:
alexey.lysiuk 2017-05-08 18:06:15 +03:00
parent 26325edddc
commit bdac1c3ad1

View file

@ -339,7 +339,7 @@ bool SndFileSong::Read(SoundStream *stream, void *vbuff, int ilen, void *userdat
if (currentpos + framestoread > song->Loop_End) if (currentpos + framestoread > song->Loop_End)
{ {
size_t endblock = (song->Loop_End - currentpos) * song->Channels * 2; size_t endblock = (song->Loop_End - currentpos) * song->Channels * 2;
size_t endlen = song->Decoder->read(buff, endblock); size_t endlen = song->Decoder->read(buff, 0 == endblock ? len : endblock);
if (endlen != 0) if (endlen != 0)
{ {
buff = buff + endlen; buff = buff + endlen;