Made CDAudio_Play() to return success (0) or failure (-1) instead of void.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@368 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2011-01-02 18:33:21 +00:00
parent 3281636a96
commit 0e3e259be3
3 changed files with 13 additions and 9 deletions

View file

@ -25,8 +25,9 @@
#include "quakedef.h"
void CDAudio_Play(byte track, qboolean looping)
int CDAudio_Play(byte track, qboolean looping)
{
return -1;
}
void CDAudio_Stop(void)

View file

@ -76,18 +76,18 @@ static int CDAudio_GetAudioDiskInfo(void)
return 0;
}
void CDAudio_Play(byte track, qboolean looping)
int CDAudio_Play(byte track, qboolean looping)
{
int len_m, len_s, len_f;
if (!cd_handle || !enabled)
return;
return -1;
if (!cdValid)
{
CDAudio_GetAudioDiskInfo();
if (!cdValid)
return;
return -1;
}
track = remap[track];
@ -95,19 +95,19 @@ void CDAudio_Play(byte track, qboolean looping)
if (track < 1 || track > cd_handle->numtracks)
{
Con_Printf ("CDAudio_Play: Bad track number %d.\n", track);
return;
return -1;
}
if (cd_handle->track[track-1].type == SDL_DATA_TRACK)
{
Con_Printf ("CDAudio_Play: track %d is not audio\n", track);
return;
return -1;
}
if (playing)
{
if (playTrack == track)
return;
return 0;
CDAudio_Stop();
}
@ -116,7 +116,7 @@ void CDAudio_Play(byte track, qboolean looping)
int cd_status = SDL_CDStatus(cd_handle);
if (cd_status > 0)
Con_Printf ("CDAudio_Play: Unable to play %d: %s\n", track, SDL_GetError ());
return;
return -1;
}
playLooping = looping;
@ -137,6 +137,8 @@ void CDAudio_Play(byte track, qboolean looping)
if (bgmvolume.value == 0) /* don't bother advancing */
CDAudio_Pause ();
return 0;
}
void CDAudio_Stop(void)

View file

@ -23,7 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __CDAUDIO_H
int CDAudio_Init (void);
void CDAudio_Play (byte track, qboolean looping);
int CDAudio_Play (byte track, qboolean looping);
/* returns 0 for success, -1 for failure. */
void CDAudio_Stop (void);
void CDAudio_Pause (void);
void CDAudio_Resume (void);