mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-15 08:31:03 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (track == 0)
|
||||||
|
track = 1;
|
||||||
|
|
||||||
track = remap[track];
|
track = remap[track];
|
||||||
|
|
||||||
if (track < 1 || track > cd_handle->numtracks)
|
if (track < 1 || track > cd_handle->numtracks)
|
||||||
|
@ -160,6 +163,45 @@ void CDAudio_Stop(void)
|
||||||
endOfTrack = -1.0;
|
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)
|
void CDAudio_Pause(void)
|
||||||
{
|
{
|
||||||
if (!cd_handle || !enabled)
|
if (!cd_handle || !enabled)
|
||||||
|
@ -290,6 +332,18 @@ static void CD_f (void)
|
||||||
return;
|
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 (Q_strcasecmp(command, "eject") == 0)
|
||||||
{
|
{
|
||||||
if (playing)
|
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.
|
// note: two leading newlines because the command buffer swallows one of them.
|
||||||
Cbuf_AddText ("\n\nvid_unlock\n");
|
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-");
|
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
|
||||||
host_hunklevel = Hunk_LowMark ();
|
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
|
IN_Shutdown (); // input is only initialized in Host_Init if we're not dedicated -- kristian
|
||||||
VID_Shutdown();
|
VID_Shutdown();
|
||||||
}
|
}
|
||||||
|
else if (COM_CheckParm ("-cd"))
|
||||||
|
{
|
||||||
|
CDAudio_Shutdown ();
|
||||||
|
S_Shutdown ();
|
||||||
|
}
|
||||||
|
|
||||||
LOG_Close ();
|
LOG_Close ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue