mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
byte to int + xmms playlist support from _Muz_
This commit is contained in:
parent
0952af5529
commit
e97e06fe44
9 changed files with 57 additions and 23 deletions
|
@ -32,7 +32,7 @@
|
||||||
#include "QF/qtypes.h"
|
#include "QF/qtypes.h"
|
||||||
|
|
||||||
int CDAudio_Init(void);
|
int CDAudio_Init(void);
|
||||||
void CDAudio_Play(byte track, qboolean looping);
|
void CDAudio_Play(int track, qboolean looping);
|
||||||
void CDAudio_Stop(void);
|
void CDAudio_Stop(void);
|
||||||
void CDAudio_Pause(void);
|
void CDAudio_Pause(void);
|
||||||
void CDAudio_Resume(void);
|
void CDAudio_Resume(void);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
*/
|
*/
|
||||||
typedef void (QFPLUGIN *P_CDAudio_CD_f) (void); //
|
typedef void (QFPLUGIN *P_CDAudio_CD_f) (void); //
|
||||||
typedef void (QFPLUGIN *P_CDAudio_Pause) (void);
|
typedef void (QFPLUGIN *P_CDAudio_Pause) (void);
|
||||||
typedef void (QFPLUGIN *P_CDAudio_Play) (byte, qboolean);
|
typedef void (QFPLUGIN *P_CDAudio_Play) (int, qboolean);
|
||||||
typedef void (QFPLUGIN *P_CDAudio_Resume) (void);
|
typedef void (QFPLUGIN *P_CDAudio_Resume) (void);
|
||||||
typedef void (QFPLUGIN *P_CDAudio_Shutdown) (void);
|
typedef void (QFPLUGIN *P_CDAudio_Shutdown) (void);
|
||||||
typedef void (QFPLUGIN *P_CDAudio_Update) (void);
|
typedef void (QFPLUGIN *P_CDAudio_Update) (void);
|
||||||
|
|
|
@ -56,7 +56,7 @@ CDAudio_Pause (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CDAudio_Play (byte track, qboolean looping)
|
CDAudio_Play (int track, qboolean looping)
|
||||||
{
|
{
|
||||||
if (cdmodule)
|
if (cdmodule)
|
||||||
cdmodule->functions->cd->pCDAudio_Play (track, looping);
|
cdmodule->functions->cd->pCDAudio_Play (track, looping);
|
||||||
|
|
|
@ -157,7 +157,7 @@ I_CDAudio_Stop (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
I_CDAudio_Play (byte track, qboolean looping)
|
I_CDAudio_Play (int track, qboolean looping)
|
||||||
{
|
{
|
||||||
struct cdrom_tocentry entry0;
|
struct cdrom_tocentry entry0;
|
||||||
struct cdrom_tocentry entry1;
|
struct cdrom_tocentry entry1;
|
||||||
|
@ -325,12 +325,12 @@ I_CD_f (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strequal (command, "play")) {
|
if (strequal (command, "play")) {
|
||||||
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), false);
|
CDAudio_Play ((int) atoi (Cmd_Argv (2)), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strequal (command, "loop")) {
|
if (strequal (command, "loop")) {
|
||||||
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), true);
|
CDAudio_Play ((int) atoi (Cmd_Argv (2)), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ I_CDAudio_Pause (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
I_CDAudio_Play (byte track, qboolean looping)
|
I_CDAudio_Play (int track, qboolean looping)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ I_CDAudio_Stop (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
I_CDAudio_Play (byte track, qboolean looping)
|
I_CDAudio_Play (int track, qboolean looping)
|
||||||
{
|
{
|
||||||
/* Initialize cd_stat to avoid warning */
|
/* Initialize cd_stat to avoid warning */
|
||||||
/* XXX - Does this default value make sense? */
|
/* XXX - Does this default value make sense? */
|
||||||
|
|
|
@ -107,7 +107,7 @@ pCDAudio_Pause (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pCDAudio_Play (byte track, qboolean looping)
|
pCDAudio_Play (int track, qboolean looping)
|
||||||
{
|
{
|
||||||
int maxtrack = CDAudio_MaxTrack ();
|
int maxtrack = CDAudio_MaxTrack ();
|
||||||
|
|
||||||
|
@ -268,12 +268,12 @@ pCD_f (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strequal (command, "play")) {
|
if (strequal (command, "play")) {
|
||||||
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), false);
|
CDAudio_Play ((int) atoi (Cmd_Argv (2)), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strequal (command, "loop")) {
|
if (strequal (command, "loop")) {
|
||||||
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), true);
|
CDAudio_Play ((int) atoi (Cmd_Argv (2)), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ static byte maxTrack;
|
||||||
|
|
||||||
static UINT wDeviceID;
|
static UINT wDeviceID;
|
||||||
|
|
||||||
static void I_CDAudio_Play (byte track, qboolean looping);
|
static void I_CDAudio_Play (int track, qboolean looping);
|
||||||
static void I_CDAudio_Stop (void);
|
static void I_CDAudio_Stop (void);
|
||||||
|
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ I_CDAudio_Pause (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
I_CDAudio_Play (byte track, qboolean looping)
|
I_CDAudio_Play (int track, qboolean looping)
|
||||||
{
|
{
|
||||||
DWORD dwReturn;
|
DWORD dwReturn;
|
||||||
MCI_PLAY_PARMS mciPlayParms;
|
MCI_PLAY_PARMS mciPlayParms;
|
||||||
|
@ -405,12 +405,12 @@ I_CD_f (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strequal (command, "play")) {
|
if (strequal (command, "play")) {
|
||||||
I_CDAudio_Play ((byte) atoi (Cmd_Argv (2)), false);
|
I_CDAudio_Play ((int) atoi (Cmd_Argv (2)), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strequal (command, "loop")) {
|
if (strequal (command, "loop")) {
|
||||||
I_CDAudio_Play ((byte) atoi (Cmd_Argv (2)), true);
|
I_CDAudio_Play ((int) atoi (Cmd_Argv (2)), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,8 +91,25 @@ static qboolean playing = false;
|
||||||
static qboolean wasPlaying = false;
|
static qboolean wasPlaying = false;
|
||||||
static qboolean musEnabled = true;
|
static qboolean musEnabled = true;
|
||||||
|
|
||||||
static void I_XMMS_f (void);
|
|
||||||
|
|
||||||
|
static void I_XMMS_Running(void);
|
||||||
|
static void I_XMMS_Stop(void);
|
||||||
|
static void I_XMMS_Play(int, qboolean);
|
||||||
|
static void I_XMMS_Pause(void);
|
||||||
|
static void I_XMMS_Resume(void);
|
||||||
|
static void I_XMMS_Next(void);
|
||||||
|
static void I_XMMS_Prev(void);
|
||||||
|
static void I_XMMS_Update(void);
|
||||||
|
static void I_XMMS_Init(void);
|
||||||
|
static void I_XMMS_Shutdown(void);
|
||||||
|
static void I_XMMS_Kill(void);
|
||||||
|
static void I_XMMS_On(void);
|
||||||
|
static void I_XMMS_Off(void);
|
||||||
|
static void I_XMMS_Shuffle(void);
|
||||||
|
static void I_XMMS_Repeat(void);
|
||||||
|
static void I_XMMS_Pos(int);
|
||||||
|
static void I_XMMS_f(void);
|
||||||
|
QFPLUGIN plugin_t *cd_xmms_PluginInfo (void);
|
||||||
|
|
||||||
/* static float cdvolume; */
|
/* static float cdvolume; */
|
||||||
/* static byte remap[100]; */
|
/* static byte remap[100]; */
|
||||||
|
@ -177,9 +194,9 @@ I_XMMS_Stop (void) // stop playing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play, don't use track and looping atm, :/
|
// Play
|
||||||
static void
|
static void
|
||||||
I_XMMS_Play (byte track, qboolean looping)
|
I_XMMS_Play (int track, qboolean looping) // looping for compatability
|
||||||
{
|
{
|
||||||
// don't try if "xmms off" has been called
|
// don't try if "xmms off" has been called
|
||||||
if (!musEnabled)
|
if (!musEnabled)
|
||||||
|
@ -190,8 +207,10 @@ I_XMMS_Play (byte track, qboolean looping)
|
||||||
xmms_remote_pause (0);
|
xmms_remote_pause (0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (xmms_remote_is_playing (0))
|
|
||||||
return;
|
if(track >= 0) xmms_remote_set_playlist_pos(0, track); // set position
|
||||||
|
|
||||||
|
if (xmms_remote_is_playing (0)) return;
|
||||||
|
|
||||||
xmms_remote_play (0);
|
xmms_remote_play (0);
|
||||||
|
|
||||||
|
@ -286,12 +305,13 @@ I_XMMS_Init (void)
|
||||||
"off - Stops control and playback of XMMS.\n"
|
"off - Stops control and playback of XMMS.\n"
|
||||||
"on - Starts XMMS if not running, or enables playback.\n"
|
"on - Starts XMMS if not running, or enables playback.\n"
|
||||||
"pause - Pause the XMMS playback.\n"
|
"pause - Pause the XMMS playback.\n"
|
||||||
"play - Begins playing tracks according to the playlist.\n"
|
"play (position) - Begins playing tracks (from position) according to the playlist.\n"
|
||||||
"stop - Stops the currently playing track.\n"
|
"stop - Stops the currently playing track.\n"
|
||||||
"next - Plays the next track in the playlist.\n"
|
"next - Plays the next track in the playlist.\n"
|
||||||
"prev - Plays the previous track in the playlist.\n"
|
"prev - Plays the previous track in the playlist.\n"
|
||||||
"shuffle - Toggle shuffling the playlist.\n"
|
"shuffle - Toggle shuffling the playlist.\n"
|
||||||
"repeat - Toggle repeating of the playlist.");
|
"repeat - Toggle repeating of the playlist.\n"
|
||||||
|
"pos - Set playlist position.");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -379,6 +399,15 @@ I_XMMS_Repeat (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
I_XMMS_Pos (int track)
|
||||||
|
{
|
||||||
|
if(!musEnabled) return;
|
||||||
|
if(track < 0) return;
|
||||||
|
xmms_remote_set_playlist_pos(0, track);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
I_XMMS_f (void)
|
I_XMMS_f (void)
|
||||||
{
|
{
|
||||||
|
@ -393,7 +422,7 @@ I_XMMS_f (void)
|
||||||
command = Cmd_Argv (1);
|
command = Cmd_Argv (1);
|
||||||
|
|
||||||
if (strequal (command, "play")) {
|
if (strequal (command, "play")) {
|
||||||
I_XMMS_Play ((byte) atoi (Cmd_Argv (2)), false);
|
I_XMMS_Play (((int) atoi (Cmd_Argv (2)) -1), 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,6 +471,11 @@ I_XMMS_f (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strequal (command, "pos")) {
|
||||||
|
I_XMMS_Pos (((int) atoi (Cmd_Argv (2)) -1 ));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (strequal (command, "help")) {
|
if (strequal (command, "help")) {
|
||||||
Sys_Printf ("Try \"help xmms\".\n");
|
Sys_Printf ("Try \"help xmms\".\n");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue