Browse Source

fix #72; change index of player no matter whether the file exist, since the invalide index was used explicitly as flag for stopping playback

Pal Lockheart 6 years ago
parent
commit
8925ac1548
2 changed files with 4 additions and 5 deletions
  1. 2 1
      mp3play.c
  2. 2 4
      oggplay.c

+ 2 - 1
mp3play.c

@@ -111,13 +111,14 @@ MP3_Play(
 
 	MP3_Close(player);
 
+	player->iMusic = iNum;
+
 	if (iNum > 0)
 	{
 		player->pMP3 = mad_openFile(UTIL_GetFullPathName(PAL_BUFFER_SIZE_ARGS(0), gConfig.pszGamePath, PAL_va(1, "mp3/%.2d.mp3", iNum)), AUDIO_GetDeviceSpec(), gConfig.iResampleQuality);
 
 		if (player->pMP3)
 		{
-			player->iMusic = iNum;
 			mad_start(player->pMP3);
 			return TRUE;
 		}

+ 2 - 4
oggplay.c

@@ -435,15 +435,13 @@ OGG_Play(
 		return TRUE;
 	}
 
+	player->iMusic = iNum;
+
 	player->fp = UTIL_OpenFile(PAL_va(0, "ogg/%.2d.ogg", iNum));
 	if (player->fp == NULL)
 	{
 		return FALSE;
 	}
-	else
-	{
-		player->iMusic = iNum;
-	}
 
 	if (!OGG_Rewind(player))
 	{