mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 01:01:07 +00:00
Add "cd next" and "cd prev" commands. Add a new "-cd" option , which in combination with "-dedicated", allows QS to be a stand-alone cd player... Useful\!
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@283 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
38b8119eb7
commit
fb745fe815
2 changed files with 67 additions and 0 deletions
|
@ -92,6 +92,9 @@ void CDAudio_Play(byte track, qboolean looping)
|
|||
return;
|
||||
}
|
||||
|
||||
if (track == 0)
|
||||
track = 1;
|
||||
|
||||
track = remap[track];
|
||||
|
||||
if (track < 1 || track > cd_handle->numtracks)
|
||||
|
@ -160,6 +163,45 @@ void CDAudio_Stop(void)
|
|||
endOfTrack = -1.0;
|
||||
}
|
||||
|
||||
void CDAudio_Next(void)
|
||||
{
|
||||
byte track;
|
||||
|
||||
if (!cd_handle || !enabled)
|
||||
return;
|
||||
|
||||
if (!playing)
|
||||
return;
|
||||
|
||||
// track = cd_handle->cur_track;
|
||||
// Seems not implemented
|
||||
track = playTrack;
|
||||
track++;
|
||||
if (track > cd_handle->numtracks)
|
||||
track = 1;
|
||||
|
||||
CDAudio_Play (track, playLooping );
|
||||
}
|
||||
|
||||
void CDAudio_Prev(void)
|
||||
{
|
||||
byte track;
|
||||
|
||||
if (!cd_handle || !enabled)
|
||||
return;
|
||||
|
||||
if (!playing)
|
||||
return;
|
||||
|
||||
track = playTrack;
|
||||
track--;
|
||||
|
||||
if (track == 0)
|
||||
track = cd_handle->numtracks;
|
||||
|
||||
CDAudio_Play (track,playLooping);
|
||||
}
|
||||
|
||||
void CDAudio_Pause(void)
|
||||
{
|
||||
if (!cd_handle || !enabled)
|
||||
|
@ -290,6 +332,18 @@ static void CD_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (Q_strcasecmp(command, "next") == 0)
|
||||
{
|
||||
CDAudio_Next();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Q_strcasecmp(command, "prev") == 0)
|
||||
{
|
||||
CDAudio_Prev();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Q_strcasecmp(command, "eject") == 0)
|
||||
{
|
||||
if (playing)
|
||||
|
|
13
Quake/host.c
13
Quake/host.c
|
@ -861,6 +861,13 @@ void Host_Init (quakeparms_t *parms)
|
|||
// note: two leading newlines because the command buffer swallows one of them.
|
||||
Cbuf_AddText ("\n\nvid_unlock\n");
|
||||
}
|
||||
else if (COM_CheckParm ("-cd"))
|
||||
{
|
||||
// Allow "qs -dedicated -cd" to work as a standalone cd player ;>
|
||||
// Useful, because of ubiquitous nature of SDL
|
||||
S_Init ();
|
||||
CDAudio_Init ();
|
||||
}
|
||||
|
||||
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
|
||||
host_hunklevel = Hunk_LowMark ();
|
||||
|
@ -915,6 +922,12 @@ void Host_Shutdown(void)
|
|||
IN_Shutdown (); // input is only initialized in Host_Init if we're not dedicated -- kristian
|
||||
VID_Shutdown();
|
||||
}
|
||||
else if (COM_CheckParm ("-cd"))
|
||||
{
|
||||
CDAudio_Shutdown ();
|
||||
S_Shutdown ();
|
||||
}
|
||||
|
||||
LOG_Close ();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue