1999-12-31 02:10:33 +00:00
|
|
|
/*
|
2000-03-24 09:08:39 +00:00
|
|
|
cd_wrapper.c
|
1999-12-31 02:10:33 +00:00
|
|
|
|
2000-03-24 09:08:39 +00:00
|
|
|
(description)
|
1999-12-31 02:10:33 +00:00
|
|
|
|
2000-03-24 09:08:39 +00:00
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
|
|
|
Please see the file "AUTHORS" for a list of contributors
|
1999-12-31 02:10:33 +00:00
|
|
|
|
2000-03-24 09:08:39 +00:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
1999-12-31 02:10:33 +00:00
|
|
|
|
2000-03-24 09:08:39 +00:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
1999-12-31 02:10:33 +00:00
|
|
|
|
2000-03-24 09:08:39 +00:00
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
1999-12-31 02:10:33 +00:00
|
|
|
*/
|
2000-01-06 02:43:04 +00:00
|
|
|
|
2000-03-24 09:08:39 +00:00
|
|
|
#include <quakedef.h>
|
2000-01-29 18:46:26 +00:00
|
|
|
#include <lib_replace.h>
|
2000-01-06 02:43:04 +00:00
|
|
|
|
|
|
|
#if defined(USE_LINUX_CD) || defined(USE_BSD_CD)
|
2000-02-03 08:46:52 +00:00
|
|
|
static void CD_f(void);
|
2000-03-24 09:08:39 +00:00
|
|
|
# include <cd_linux.c>
|
2000-01-04 22:11:17 +00:00
|
|
|
#elif defined(_WIN32)
|
2000-03-24 09:08:39 +00:00
|
|
|
# include <cd_win.c>
|
2000-01-04 22:11:17 +00:00
|
|
|
#else
|
2000-03-24 09:08:39 +00:00
|
|
|
# include <cd_null.c>
|
1999-12-31 02:10:33 +00:00
|
|
|
#endif
|
2000-01-06 02:43:04 +00:00
|
|
|
|
|
|
|
#ifndef CD_f_DEFINED
|
2000-08-20 13:33:48 +00:00
|
|
|
static void
|
|
|
|
CD_f ( void )
|
2000-01-06 02:43:04 +00:00
|
|
|
{
|
|
|
|
char *command;
|
|
|
|
int ret, n;
|
|
|
|
|
|
|
|
if (Cmd_Argc() < 2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
command = Cmd_Argv (1);
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "on") == 0)
|
|
|
|
{
|
|
|
|
enabled = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "off") == 0)
|
|
|
|
{
|
|
|
|
if (playing)
|
|
|
|
CDAudio_Stop();
|
|
|
|
enabled = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "reset") == 0)
|
|
|
|
{
|
|
|
|
enabled = true;
|
|
|
|
if (playing)
|
|
|
|
CDAudio_Stop();
|
|
|
|
for (n = 0; n < 100; n++)
|
|
|
|
remap[n] = n;
|
|
|
|
CDAudio_GetAudioDiskInfo();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "remap") == 0)
|
|
|
|
{
|
|
|
|
ret = Cmd_Argc() - 2;
|
|
|
|
if (ret <= 0)
|
|
|
|
{
|
|
|
|
for (n = 1; n < 100; n++)
|
|
|
|
if (remap[n] != n)
|
|
|
|
Con_Printf(" %u -> %u\n", n, remap[n]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (n = 1; n <= ret; n++)
|
|
|
|
remap[n] = Q_atoi(Cmd_Argv (n+1));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "close") == 0)
|
|
|
|
{
|
|
|
|
CDAudio_CloseDoor();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!cdValid)
|
|
|
|
{
|
|
|
|
CDAudio_GetAudioDiskInfo();
|
|
|
|
if (!cdValid)
|
|
|
|
{
|
|
|
|
Con_Printf("No CD in player.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "play") == 0)
|
|
|
|
{
|
|
|
|
CDAudio_Play((byte)Q_atoi(Cmd_Argv (2)), false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "loop") == 0)
|
|
|
|
{
|
|
|
|
CDAudio_Play((byte)Q_atoi(Cmd_Argv (2)), true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "stop") == 0)
|
|
|
|
{
|
|
|
|
CDAudio_Stop();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "pause") == 0)
|
|
|
|
{
|
|
|
|
CDAudio_Pause();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "resume") == 0)
|
|
|
|
{
|
|
|
|
CDAudio_Resume();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "eject") == 0)
|
|
|
|
{
|
|
|
|
if (playing)
|
|
|
|
CDAudio_Stop();
|
|
|
|
CDAudio_Eject();
|
|
|
|
cdValid = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Q_strcasecmp(command, "info") == 0)
|
|
|
|
{
|
|
|
|
Con_Printf("%u tracks\n", maxTrack);
|
|
|
|
if (playing)
|
|
|
|
Con_Printf("Currently %s track %u\n", playLooping ? "looping" : "playing", playTrack);
|
|
|
|
else if (wasPlaying)
|
|
|
|
Con_Printf("Paused %s track %u\n", playLooping ? "looping" : "playing", playTrack);
|
|
|
|
Con_Printf("Volume is %f\n", cdvolume);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* CD_f_DEFINED */
|