cd_sdl.c: cleaned up the latest mess a little. restricted track progressing

to the cd player facility only.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@293 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2010-08-24 09:04:16 +00:00
parent 6beef00279
commit 7957d214ba

View file

@ -43,6 +43,7 @@ static qboolean playing = false;
static qboolean wasPlaying = false; static qboolean wasPlaying = false;
static qboolean enabled = true; static qboolean enabled = true;
static qboolean playLooping = false; static qboolean playLooping = false;
static qboolean cdplayer= false; // QuakeSpasm / S.A - cd player facility
static byte remap[100]; static byte remap[100];
static byte playTrack; static byte playTrack;
static double endOfTrack = -1.0, pausetime = -1.0; static double endOfTrack = -1.0, pausetime = -1.0;
@ -228,7 +229,7 @@ void CDAudio_Resume(void)
static void CD_f (void) static void CD_f (void)
{ {
const char *command,*arg2; const char *command;
int ret, n; int ret, n;
if (Cmd_Argc() < 2) if (Cmd_Argc() < 2)
@ -294,20 +295,20 @@ static void CD_f (void)
if (Q_strcasecmp(command, "play") == 0) if (Q_strcasecmp(command, "play") == 0)
{ {
arg2 = Cmd_Argv (2); command = Cmd_Argv (2);
if (*arg2) if (*command)
CDAudio_Play((byte)atoi(Cmd_Argv (2)), false); CDAudio_Play((byte)atoi(command), false);
else else
CDAudio_Play((byte)1, false); CDAudio_Play((byte)1, false);
return; return;
} }
if (Q_strcasecmp(command, "loop") == 0) if (Q_strcasecmp(command, "loop") == 0)
{ {
arg2 = Cmd_Argv (2); command = Cmd_Argv (2);
if (*arg2) if (*command)
CDAudio_Play((byte)atoi(Cmd_Argv (2)), true); CDAudio_Play((byte)atoi(command), true);
else else
CDAudio_Play((byte)1, true); CDAudio_Play((byte)1, true);
return; return;
} }
@ -436,13 +437,19 @@ void CDAudio_Update(void)
curstat = SDL_CDStatus(cd_handle); curstat = SDL_CDStatus(cd_handle);
if (curstat != CD_PLAYING && curstat != CD_PAUSED) if (curstat != CD_PLAYING && curstat != CD_PAUSED)
{ {
if (!cdplayer) {
playing = false;
endOfTrack = -1.0;
if (playLooping)
CDAudio_Play(playTrack, true);
} else { // QuakeSpasm / S.A
endOfTrack = -1.0; endOfTrack = -1.0;
if (playLooping) { if (playLooping) {
playing = false; playing = false;
CDAudio_Play(playTrack, true); CDAudio_Play(playTrack, true);
} }
else else CDAudio_Next();
CDAudio_Next(); }
} }
} }
} }
@ -579,6 +586,9 @@ int CDAudio_Init(void)
Cmd_AddCommand ("cd", CD_f); Cmd_AddCommand ("cd", CD_f);
if (COM_CheckParm("-cd")) // QuakeSpasm / S.A - cd player facility
cdplayer = true;
// cd hardware volume: no SDL support at present. // cd hardware volume: no SDL support at present.
hw_vol_works = CD_GetVolume (NULL); hw_vol_works = CD_GetVolume (NULL);
if (hw_vol_works) if (hw_vol_works)