byte to int + xmms playlist support from _Muz_

This commit is contained in:
Bill Currie 2001-10-12 19:26:56 +00:00
parent 0952af5529
commit e97e06fe44
9 changed files with 57 additions and 23 deletions

View file

@ -32,7 +32,7 @@
#include "QF/qtypes.h"
int CDAudio_Init(void);
void CDAudio_Play(byte track, qboolean looping);
void CDAudio_Play(int track, qboolean looping);
void CDAudio_Stop(void);
void CDAudio_Pause(void);
void CDAudio_Resume(void);

View file

@ -36,7 +36,7 @@
*/
typedef void (QFPLUGIN *P_CDAudio_CD_f) (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_Shutdown) (void);
typedef void (QFPLUGIN *P_CDAudio_Update) (void);

View file

@ -56,7 +56,7 @@ CDAudio_Pause (void)
}
void
CDAudio_Play (byte track, qboolean looping)
CDAudio_Play (int track, qboolean looping)
{
if (cdmodule)
cdmodule->functions->cd->pCDAudio_Play (track, looping);

View file

@ -157,7 +157,7 @@ I_CDAudio_Stop (void)
}
static void
I_CDAudio_Play (byte track, qboolean looping)
I_CDAudio_Play (int track, qboolean looping)
{
struct cdrom_tocentry entry0;
struct cdrom_tocentry entry1;
@ -325,12 +325,12 @@ I_CD_f (void)
}
if (strequal (command, "play")) {
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), false);
CDAudio_Play ((int) atoi (Cmd_Argv (2)), false);
return;
}
if (strequal (command, "loop")) {
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), true);
CDAudio_Play ((int) atoi (Cmd_Argv (2)), true);
return;
}

View file

@ -49,7 +49,7 @@ I_CDAudio_Pause (void)
}
static void
I_CDAudio_Play (byte track, qboolean looping)
I_CDAudio_Play (int track, qboolean looping)
{
}

View file

@ -107,7 +107,7 @@ I_CDAudio_Stop (void)
}
static void
I_CDAudio_Play (byte track, qboolean looping)
I_CDAudio_Play (int track, qboolean looping)
{
/* Initialize cd_stat to avoid warning */
/* XXX - Does this default value make sense? */

View file

@ -107,7 +107,7 @@ pCDAudio_Pause (void)
}
void
pCDAudio_Play (byte track, qboolean looping)
pCDAudio_Play (int track, qboolean looping)
{
int maxtrack = CDAudio_MaxTrack ();
@ -268,12 +268,12 @@ pCD_f (void)
}
if (strequal (command, "play")) {
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), false);
CDAudio_Play ((int) atoi (Cmd_Argv (2)), false);
return;
}
if (strequal (command, "loop")) {
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), true);
CDAudio_Play ((int) atoi (Cmd_Argv (2)), true);
return;
}

View file

@ -66,7 +66,7 @@ static byte maxTrack;
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);
@ -194,7 +194,7 @@ I_CDAudio_Pause (void)
}
static void
I_CDAudio_Play (byte track, qboolean looping)
I_CDAudio_Play (int track, qboolean looping)
{
DWORD dwReturn;
MCI_PLAY_PARMS mciPlayParms;
@ -405,12 +405,12 @@ I_CD_f (void)
}
if (strequal (command, "play")) {
I_CDAudio_Play ((byte) atoi (Cmd_Argv (2)), false);
I_CDAudio_Play ((int) atoi (Cmd_Argv (2)), false);
return;
}
if (strequal (command, "loop")) {
I_CDAudio_Play ((byte) atoi (Cmd_Argv (2)), true);
I_CDAudio_Play ((int) atoi (Cmd_Argv (2)), true);
return;
}

View file

@ -91,8 +91,25 @@ static qboolean playing = false;
static qboolean wasPlaying = false;
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 byte remap[100]; */
@ -177,9 +194,9 @@ I_XMMS_Stop (void) // stop playing
return;
}
// Play, don't use track and looping atm, :/
// Play
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
if (!musEnabled)
@ -190,8 +207,10 @@ I_XMMS_Play (byte track, qboolean looping)
xmms_remote_pause (0);
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);
@ -286,12 +305,13 @@ I_XMMS_Init (void)
"off - Stops control and playback of XMMS.\n"
"on - Starts XMMS if not running, or enables 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"
"next - Plays the next track in the playlist.\n"
"prev - Plays the previous track in 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;
}
@ -379,6 +399,15 @@ I_XMMS_Repeat (void)
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
I_XMMS_f (void)
{
@ -393,7 +422,7 @@ I_XMMS_f (void)
command = Cmd_Argv (1);
if (strequal (command, "play")) {
I_XMMS_Play ((byte) atoi (Cmd_Argv (2)), false);
I_XMMS_Play (((int) atoi (Cmd_Argv (2)) -1), 0);
return;
}
@ -442,6 +471,11 @@ I_XMMS_f (void)
return;
}
if (strequal (command, "pos")) {
I_XMMS_Pos (((int) atoi (Cmd_Argv (2)) -1 ));
return;
}
if (strequal (command, "help")) {
Sys_Printf ("Try \"help xmms\".\n");
return;