2001-06-01 22:55:33 +00:00
|
|
|
/*
|
|
|
|
cd_plugin.c
|
|
|
|
|
|
|
|
cd plugin wrapper
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
*/
|
2001-10-05 19:36:35 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2003-01-15 15:31:36 +00:00
|
|
|
# include "config.h"
|
2001-10-05 19:36:35 +00:00
|
|
|
#endif
|
|
|
|
|
2005-08-04 15:27:09 +00:00
|
|
|
static __attribute__ ((used)) const char rcsid[] =
|
2003-01-15 15:31:36 +00:00
|
|
|
"$Id$";
|
|
|
|
|
2001-06-01 22:55:33 +00:00
|
|
|
#include "QF/cdaudio.h"
|
2001-06-02 04:36:42 +00:00
|
|
|
#include "QF/cmd.h"
|
2001-06-01 22:55:33 +00:00
|
|
|
#include "QF/cvar.h"
|
|
|
|
#include "QF/plugin.h"
|
|
|
|
#include "QF/qtypes.h"
|
2001-09-21 04:22:46 +00:00
|
|
|
#include "QF/sys.h"
|
2001-06-01 22:55:33 +00:00
|
|
|
|
2001-10-10 05:52:14 +00:00
|
|
|
cvar_t *cd_plugin;
|
|
|
|
plugin_t *cdmodule = NULL;
|
2001-06-01 22:55:33 +00:00
|
|
|
|
2001-10-10 05:52:14 +00:00
|
|
|
CD_PLUGIN_PROTOS
|
|
|
|
plugin_list_t cd_plugin_list[] = {
|
|
|
|
CD_PLUGIN_LIST
|
|
|
|
};
|
2001-06-01 22:55:33 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
CDAudio_Pause (void)
|
|
|
|
{
|
|
|
|
if (cdmodule)
|
|
|
|
cdmodule->functions->cd->pCDAudio_Pause ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-10-12 19:26:56 +00:00
|
|
|
CDAudio_Play (int track, qboolean looping)
|
2001-06-01 22:55:33 +00:00
|
|
|
{
|
|
|
|
if (cdmodule)
|
|
|
|
cdmodule->functions->cd->pCDAudio_Play (track, looping);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDAudio_Resume (void)
|
|
|
|
{
|
|
|
|
if (cdmodule)
|
|
|
|
cdmodule->functions->cd->pCDAudio_Resume ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDAudio_Shutdown (void)
|
|
|
|
{
|
|
|
|
if (cdmodule)
|
|
|
|
cdmodule->functions->general->p_Shutdown ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CDAudio_Update (void)
|
|
|
|
{
|
|
|
|
if (cdmodule)
|
|
|
|
cdmodule->functions->cd->pCDAudio_Update ();
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-06-01 22:55:33 +00:00
|
|
|
CD_f (void)
|
|
|
|
{
|
|
|
|
if (cdmodule)
|
|
|
|
cdmodule->functions->cd->pCD_f ();
|
|
|
|
}
|
2001-06-02 04:36:42 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
CDAudio_Init (void)
|
|
|
|
{
|
2001-10-10 16:22:41 +00:00
|
|
|
PI_RegisterPlugins (cd_plugin_list);
|
2004-01-21 21:06:13 +00:00
|
|
|
cd_plugin = Cvar_Get ("cd_plugin", "file", CVAR_ROM, NULL,
|
2001-06-02 04:36:42 +00:00
|
|
|
"CD Plugin to use");
|
2003-01-31 23:16:28 +00:00
|
|
|
if (!*cd_plugin->string) {
|
|
|
|
Sys_Printf ("Not loading CD due to no driver\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2001-06-02 04:36:42 +00:00
|
|
|
cdmodule = PI_LoadPlugin ("cd", cd_plugin->string);
|
|
|
|
if (!cdmodule) {
|
2001-09-21 04:22:46 +00:00
|
|
|
Sys_Printf ("Loading of cd module: %s failed!\n", cd_plugin->string);
|
2001-06-02 04:36:42 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2001-10-02 18:12:27 +00:00
|
|
|
cdmodule->functions->general->p_Init ();
|
2001-08-27 01:00:03 +00:00
|
|
|
Cmd_AddCommand (
|
|
|
|
"cd", CD_f, "Control the CD player.\n"
|
2001-06-02 04:36:42 +00:00
|
|
|
"Commands:\n"
|
|
|
|
"eject - Eject the CD.\n"
|
|
|
|
"info - Reports information on the CD.\n"
|
|
|
|
"loop (track number) - Loops the specified track.\n"
|
|
|
|
"remap (track1) (track2) ... - Remap the current track order.\n"
|
|
|
|
"reset - Causes the CD audio to re-initialize.\n"
|
|
|
|
"resume - Will resume playback after pause.\n"
|
|
|
|
"off - Shuts down the CD audio system..\n"
|
|
|
|
"on - Re-enables the CD audio system after a cd off command.\n"
|
|
|
|
"pause - Pause the CD playback.\n"
|
|
|
|
"play (track number) - Plays the specified track one time.\n"
|
|
|
|
"stop - Stops the currently playing track.");
|
2001-09-21 04:22:46 +00:00
|
|
|
Sys_Printf ("CD Audio Initialized\n");
|
2004-11-06 02:21:00 +00:00
|
|
|
return 0;
|
2001-06-02 04:36:42 +00:00
|
|
|
}
|