xa.cpp: Fix the crackling noise.

git-svn-id: https://svn.eduke32.com/eduke32@6763 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-03-13 23:29:35 +00:00
parent 5f52049948
commit 6acbb77ac5

View file

@ -285,7 +285,10 @@ void MV_SetXAPosition(VoiceNode *voice, int32_t position)
xa_data * xad = (xa_data *) voice->rawdataptr;
if (position < XA_DATA_START || (size_t)position >= xad->length)
{
position = XA_DATA_START;
xad->t1 = xad->t2 = xad->t1_x = xad->t2_x = 0;
}
xad->pos = position;
}
@ -308,8 +311,6 @@ static playbackstatus MV_GetNextXABlock
voice->Playing = TRUE;
xad->t1 = xad->t2 = xad->t1_x = xad->t2_x = 0;
do
{
size_t bytes = xad->length - xad->pos;
@ -348,7 +349,10 @@ static playbackstatus MV_GetNextXABlock
if (xad->length == xad->pos)
{
if (voice->LoopSize > 0)
{
xad->pos = XA_DATA_START;
xad->t1 = xad->t2 = xad->t1_x = xad->t2_x = 0;
}
else
{
voice->Playing = FALSE;
@ -454,6 +458,7 @@ int32_t MV_PlayXA
xad->ptr = ptr;
xad->pos = XA_DATA_START;
xad->t1 = xad->t2 = xad->t1_x = xad->t2_x = 0;
xad->blocksize = 0;
xad->length = ptrlength;