diff --git a/libs/audio/cd/cd_file.c b/libs/audio/cd/cd_file.c index abec08bb9..8b3dc8b9b 100644 --- a/libs/audio/cd/cd_file.c +++ b/libs/audio/cd/cd_file.c @@ -55,19 +55,18 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/cdaudio.h" #include "QF/cmd.h" #include "QF/cvar.h" +#include "QF/dstring.h" #include "QF/plugin.h" #include "QF/qargs.h" -#include "QF/sound.h" -#include "QF/sys.h" +#include "QF/qfplist.h" #include "QF/quakefs.h" #include "QF/quakeio.h" -#include "QF/dstring.h" -#include "QF/qfplist.h" #include "QF/sound.h" +#include "QF/sys.h" #include "QF/va.h" -#include "snd_render.h" #include "compat.h" +#include "snd_render.h" /* Generic plugin structures */ static general_data_t plugin_info_general_data; @@ -77,25 +76,17 @@ static general_funcs_t plugin_info_general_funcs; static qboolean playing = false; static qboolean wasPlaying = false; static qboolean mus_enabled = false; -static qboolean ogglistvalid = false; // true if a valid ogg list has been - // loaded -/* volume cvar */ -static cvar_t *bgmvolume; +static qboolean ogglistvalid = false; /* sound resources */ static channel_t *cd_channel; -static sfx_t *cd_sfx; +static sfx_t *cd_sfx; +static int current_track; // current track, used when pausing +static plitem_t *tracklist = NULL; // parsed tracklist, dictionary format -/* tracklist cvar */ -static cvar_t *mus_ogglist; +static cvar_t *bgmvolume; // volume cvar +static cvar_t *mus_ogglist; // tracklist cvar -/* current track, used when pausing */ -static int current_track; - -/* parsed tracklist, dictionary format */ -static plitem_t *tracklist = NULL; - -/* end of added variables. */ static void set_volume (void) @@ -108,28 +99,20 @@ set_volume (void) } } -/* does nothing */ static void I_OGGMus_CloseDoor (void) { - Sys_DPrintf ("Entering I_OGGMus_CloseDoor\n"); - return; } -/* does nothing. */ static void I_OGGMus_Eject (void) { - Sys_DPrintf ("Entering I_OGGMus_Eject\n"); - return; } /* stop playback of music */ static void I_OGGMus_Stop (void) { - Sys_DPrintf ("Entering I_OGGMus_Stop\n"); - if (!tracklist || !mus_enabled || !playing) return; @@ -146,8 +129,6 @@ I_OGGMus_Stop (void) static void I_OGGMus_Shutdown (void) { - Sys_DPrintf ("Entering I_OGGMus_Shutdown\n"); - if (tracklist) { I_OGGMus_Stop (); PL_Free (tracklist); @@ -163,9 +144,7 @@ Load_Tracklist (void) { QFile *oggfile = NULL; char *buffile = NULL; - int size = -1; - - Sys_DPrintf ("Entering Load_Tracklist\n"); + int size = -1; /* kill off the old tracklist, and make sure we're not playing anything */ I_OGGMus_Shutdown (); @@ -174,8 +153,7 @@ Load_Tracklist (void) mus_enabled = false; if (!mus_ogglist || strequal (mus_ogglist->string, "none")) { - /* bail if we don't have a valid filename */ - return -1; + return -1; // bail if we don't have a valid filename } size = QFS_FOpenFile (mus_ogglist->string, &oggfile); @@ -209,12 +187,10 @@ Load_Tracklist (void) return 0; } -/* pause playback of music? */ +/* pause playback of music */ static void I_OGGMus_Pause (void) { - Sys_DPrintf("I_OGGMus: Pausing on track: %d.\n",current_track); - /* pause the ogg playback. */ /* just kinda cheat and stop it for the time being */ if (!tracklist || !mus_enabled || !playing) return; @@ -238,11 +214,10 @@ I_OGGMus_Play (int track, qboolean looping) wavinfo_t *info = 0; const char *trackstring; - Sys_DPrintf ("Entering I_OGGMus_Play\n"); /* alrighty. grab the list, map track to filename. grab filename from data resources, attach sound to play, loop. */ - if (!cd_channel && mus_enabled) { // Shouldn't happen! + if (!cd_channel && mus_enabled) { // Shouldn't happen! Sys_Printf ("OGGMus: on fire.\n"); mus_enabled = false; } @@ -288,9 +263,7 @@ I_OGGMus_Resume (void) if (!tracklist || !mus_enabled || !wasPlaying) return; - Sys_DPrintf ("I_OGGMus: resuming track: %d.\n", current_track); I_OGGMus_Play (current_track, true); - playing = true; } @@ -301,20 +274,18 @@ I_OGGMus_Info (void) plitem_t *keylist = NULL; plitem_t *currentmap = NULL; plitem_t *currenttrack = NULL; - int iter = 0; - - Sys_DPrintf ("Entering I_OGGMus_Info\n"); + int iter = 0; if (!tracklist) { Sys_Printf ("\n" "No Tracklist\n" "------------\n"); return; } - if (!(keylist = PL_D_AllKeys (tracklist))) { Sys_DPrintf ("OGGMus: Didn't get valid plist_t array, yet have " "valid tracklist?\n"); return; } + Sys_DPrintf ("OGGMus: number of entries %i.\n", ((plarray_t *) (keylist->data))->numvals); Sys_Printf ("\n" "Tracklist loaded from file:\n%s\n" @@ -344,7 +315,6 @@ I_OGG_f (void) { const char *command; - Sys_DPrintf ("Entering I_OGG_f\n"); if (Cmd_Argc () < 2) return; @@ -429,7 +399,6 @@ I_OGG_f (void) } } -/* stub out, since we don't need */ static void I_OGGMus_Update (void) { @@ -447,7 +416,6 @@ Mus_OggChange (cvar_t *ogglist) static void Mus_VolChange (cvar_t *bgmvolume) { - Sys_DPrintf ("Entering Mus_VolChange\n"); set_volume (); } @@ -460,20 +428,16 @@ Mus_gamedir (void) static void I_OGGMus_Init (void) { - Sys_DPrintf ("Entering I_OGGMus_Init\n"); - cd_channel = S_AllocChannel (); if (!cd_channel) // We can't fail to load yet... so just disable everything Sys_Printf ("OGGMus: Failed to allocate sound channel.\n"); /* check list file cvar, open list file, create map, close file. */ - mus_ogglist = Cvar_Get ("mus_ogglist", "tracklist.cfg", CVAR_NONE, Mus_OggChange, "filename of track to music file map"); bgmvolume = Cvar_Get ("bgmvolume", "1", CVAR_ARCHIVE, Mus_VolChange, "Volume of CD music"); - QFS_GamedirCallback (Mus_gamedir); } @@ -514,9 +478,9 @@ static plugin_t plugin_info = { QFPLUGIN_VERSION, "0.1", "OGG Music output\n", - "Copyright (C) 2004 Andrew Pilley\n" - "Copyright (C) 2004 Members of the QuakeForge Project\n" - "See the file \"AUTHORS\" for more information.\n", + "Copyright (C) 2004 Andrew Pilley\n" + "Copyright (C) 2004 Members of the QuakeForge Project\n" + "See the file \"AUTHORS\" for more information.\n", &plugin_info_funcs, &plugin_info_data, }; diff --git a/libs/audio/cd/cd_linux.c b/libs/audio/cd/cd_linux.c index 18711d0a1..b45dd873b 100644 --- a/libs/audio/cd/cd_linux.c +++ b/libs/audio/cd/cd_linux.c @@ -65,7 +65,6 @@ static plugin_data_t plugin_info_data; static plugin_funcs_t plugin_info_funcs; static general_data_t plugin_info_general_data; static general_funcs_t plugin_info_general_funcs; -//static cd_data_t plugin_info_cd_data; static cd_funcs_t plugin_info_cd_funcs; static qboolean cdValid = false; @@ -77,8 +76,8 @@ static float cdvolume; static byte remap[100]; static byte playTrack; static byte maxTrack; - static int cdfile = -1; + static cvar_t *mus_cddevice; static cvar_t *bgmvolume; @@ -231,8 +230,6 @@ I_CDAudio_Play (int track, qboolean looping) strerror (errno)); return; } -// if ( ioctl(cdfile, CDROMRESUME) == -1 ) -// Sys_DPrintf("CDAudio: ioctl cdromresume failed\n"); playLooping = looping; playTrack = track; @@ -262,8 +259,7 @@ I_CDAudio_Resume (void) static void I_CDAudio_Shutdown (void) { - if (cdfile != -1) - { + if (cdfile != -1) { I_CDAudio_Stop (); close (cdfile); cdfile = -1; @@ -275,8 +271,7 @@ static void I_CD_f (void) { const char *command; - int ret; - int n; + int ret, n; if (Cmd_Argc () < 2) return; @@ -421,21 +416,18 @@ Mus_CDChange (cvar_t *mus_cdaudio) int i; CDAudio_Shutdown (); - if (strequal(mus_cdaudio->string, "none")) - { + if (strequal (mus_cdaudio->string, "none")) { return; } cdfile = open (mus_cdaudio->string, O_RDONLY | O_NONBLOCK); - if (cdfile == -1) - { + if (cdfile == -1) { Sys_DPrintf ("Mus_CDInit: open of device \"%s\" failed (error %i)\n", - mus_cdaudio->string, errno); + mus_cdaudio->string, errno); return; } - if (I_CDAudio_GetAudioDiskInfo ()) - { + if (I_CDAudio_GetAudioDiskInfo ()) { Sys_Printf ("CDAudio_Init: No CD in player.\n"); cdValid = false; } @@ -449,8 +441,8 @@ Mus_CDChange (cvar_t *mus_cdaudio) static void I_CDAudio_Init (void) { - mus_cddevice = Cvar_Get("mus_cddevice", "/dev/cdrom", CVAR_NONE, - Mus_CDChange, "device to use for CD music"); + mus_cddevice = Cvar_Get ("mus_cddevice", "/dev/cdrom", CVAR_NONE, + Mus_CDChange, "device to use for CD music"); bgmvolume = Cvar_Get ("bgmvolume", "1", CVAR_ARCHIVE, NULL, "Volume of CD music"); } @@ -492,8 +484,8 @@ static plugin_t plugin_info = { QFPLUGIN_VERSION, "0.1", "Linux CD Audio output\n", - "Copyright (C) 2001 contributors of the QuakeForge project\n" - "Please see the file \"AUTHORS\" for a list of contributors\n", + "Copyright (C) 2001 contributors of the QuakeForge project\n" + "Please see the file \"AUTHORS\" for a list of contributors\n", &plugin_info_funcs, &plugin_info_data, }; diff --git a/libs/audio/cd/cd_sdl.c b/libs/audio/cd/cd_sdl.c index b67a9235c..36d1822e0 100644 --- a/libs/audio/cd/cd_sdl.c +++ b/libs/audio/cd/cd_sdl.c @@ -55,7 +55,6 @@ static plugin_data_t plugin_info_data; static plugin_funcs_t plugin_info_funcs; static general_data_t plugin_info_general_data; static general_funcs_t plugin_info_general_funcs; -//static cd_data_t plugin_info_cd_data; static cd_funcs_t plugin_info_cd_funcs; static qboolean cdValid = false; @@ -68,6 +67,7 @@ static float cdvolume = 1.0; static cvar_t *bgmvolume; + static void I_CDAudio_Eject (void) { @@ -319,8 +319,8 @@ static plugin_t plugin_info = { QFPLUGIN_VERSION, "0.1", "SDL CD Audio output\n", - "Copyright (C) 2001 contributors of the QuakeForge project\n" - "Please see the file \"AUTHORS\" for a list of contributors\n", + "Copyright (C) 2001 contributors of the QuakeForge project\n" + "Please see the file \"AUTHORS\" for a list of contributors\n", &plugin_info_funcs, &plugin_info_data, }; diff --git a/libs/audio/cd/cd_sgi.c b/libs/audio/cd/cd_sgi.c index c5cd3440d..dba465f29 100644 --- a/libs/audio/cd/cd_sgi.c +++ b/libs/audio/cd/cd_sgi.c @@ -39,12 +39,13 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/cdaudio.h" #include "QF/cmd.h" +#include "QF/cvar.h" #include "QF/qargs.h" #include "QF/sound.h" #include "QF/sys.h" #include "QF/plugin.h" + #include "compat.h" -#include "QF/cvar.h" static plugin_t plugin_info; static plugin_data_t plugin_info_data; @@ -230,17 +231,16 @@ I_SGI_Update (void) } } - if (I_SGI_GetState () != CD_PLAYING && - I_SGI_GetState () != CD_PAUSED && playLooping) - CDAudio_Play (playTrack, true); + if (I_SGI_GetState () != CD_PLAYING + && I_SGI_GetState () != CD_PAUSED && playLooping) + CDAudio_Play (playTrack, true); } static void I_SGI_f (void) { const char *command; - int ret; - int n; + int ret, n; if (Cmd_Argc () < 2) return; @@ -347,8 +347,8 @@ I_SGI_Init (void) cdp = CDopen (cd_dev, "r"); if (cdp == NULL) { - Sys_Printf ("CDAudio_Init: open of \"%s\" failed (%i)\n", - cd_dev, errno); + Sys_Printf ("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, + errno); return ; } @@ -359,8 +359,6 @@ I_SGI_Init (void) enabled = true; Sys_Printf ("CD Audio Initialized\n"); - - return ; } static general_funcs_t plugin_info_general_funcs = { @@ -400,8 +398,8 @@ static plugin_t plugin_info = { QFPLUGIN_VERSION, "0.1", "SGI CD Audio output\n", - "Copyright (C) 2001 contributors of the QuakeForge project\n" - "Please see the file \"AUTHORS\" for a list of contributors\n", + "Copyright (C) 2001 contributors of the QuakeForge project\n" + "Please see the file \"AUTHORS\" for a list of contributors\n", &plugin_info_funcs, &plugin_info_data, }; diff --git a/libs/audio/cd/cd_win.c b/libs/audio/cd/cd_win.c index 3c179451d..56439b8a1 100644 --- a/libs/audio/cd/cd_win.c +++ b/libs/audio/cd/cd_win.c @@ -43,12 +43,11 @@ static __attribute__ ((unused)) const char rcsid[] = #include "compat.h" -static plugin_t plugin_info; +static plugin_t plugin_info; static plugin_data_t plugin_info_data; static plugin_funcs_t plugin_info_funcs; static general_data_t plugin_info_general_data; static general_funcs_t plugin_info_general_funcs; -//static cd_data_t plugin_info_cd_data; static cd_funcs_t plugin_info_cd_funcs; extern HWND mainwindow; //FIXME @@ -71,6 +70,7 @@ static void I_CDAudio_Stop (void); static cvar_t *bgmvolume; + static void I_CDAudio_CloseDoor (void) { @@ -178,7 +178,6 @@ I_CDAudio_Pause (void) if (!enabled) return; - if (!playing) return; @@ -203,7 +202,6 @@ I_CDAudio_Play (int track, qboolean looping) if (!enabled) return; - if (!cdValid) { I_CDAudio_GetAudioDiskInfo (); if (!cdValid) @@ -281,10 +279,8 @@ I_CDAudio_Resume (void) if (!enabled) return; - if (!cdValid) return; - if (!wasPlaying) return; @@ -318,7 +314,6 @@ I_CDAudio_Stop (void) if (!enabled) return; - if (!playing) return; @@ -354,8 +349,7 @@ static void I_CD_f (void) { const char *command; - int n, ret; -// int startAddress; + int ret, n; if (Cmd_Argc () < 2) return; @@ -537,8 +531,8 @@ static plugin_t plugin_info = { QFPLUGIN_VERSION, "0.1", "Windows CD Audio output\n", - "Copyright (C) 2001 contributors of the QuakeForge project\n" - "Please see the file \"AUTHORS\" for a list of contributors\n", + "Copyright (C) 2001 contributors of the QuakeForge project\n" + "Please see the file \"AUTHORS\" for a list of contributors\n", &plugin_info_funcs, &plugin_info_data, }; diff --git a/libs/audio/cd/cd_xmms.c b/libs/audio/cd/cd_xmms.c index 999e6bdf5..a5e927812 100644 --- a/libs/audio/cd/cd_xmms.c +++ b/libs/audio/cd/cd_xmms.c @@ -54,7 +54,6 @@ static __attribute__ ((unused)) const char rcsid[] = #include #include #include - #include #include "QF/cdaudio.h" @@ -73,7 +72,6 @@ static plugin_funcs_t plugin_info_funcs; static general_data_t plugin_info_general_data; static general_funcs_t plugin_info_general_funcs; -//static cd_data_t plugin_info_cd_data; static cd_funcs_t plugin_info_cd_funcs; static const char *xmms_cmd = "xmms"; @@ -87,8 +85,7 @@ static int sessionNo; static qboolean playing = false; -// no idea why I have wasPlaying, prolly cos this code was based on -// cd_linux.c :/ +// no idea why I have wasPlaying, pbly this code was based on cd_linux.c :/ static qboolean wasPlaying = false; static qboolean musEnabled = true; @@ -113,25 +110,22 @@ static void I_XMMS_Info(void); static void I_XMMS_f(void); plugin_t *cd_xmms_PluginInfo (void); -/* static float cdvolume; */ -/* static byte remap[100]; */ -/* static byte playTrack; */ -/* static byte maxTrack; */ +//static float cdvolume; +//static byte remap[100]; +//static byte playTrack; +//static byte maxTrack; // FIXME: All of this code assumes that the xmms_remote_* functions succeed // FIXME: shouldn't I use gint for all the xmms stuff like -// FIXME (cont): /usr/include/xmms/xmmsctrl.h says ? +// FIXME (cont): /usr/include/xmms/xmmsctrl.h says? static void I_XMMS_Running (void) { - - int res; - int i; + int res, i; int fd_size = getdtablesize (); if (!xmms_remote_is_running (sessionNo)) { - // this method is used over a system() call, so that we know child's // pid (not that is particularly important) but so we can close // unneeded descriptors @@ -167,15 +161,12 @@ I_XMMS_Running (void) } return; } - return; } static void I_XMMS_Stop (void) // stop playing { - - // don't try if "xmms off" has been called if (!musEnabled) return; I_XMMS_Running (); @@ -186,7 +177,6 @@ I_XMMS_Stop (void) // stop playing wasPlaying = playing; playing = false; - return; } // Play @@ -194,57 +184,18 @@ I_XMMS_Stop (void) // stop playing static void I_XMMS_Play (int track, qboolean looping) // looping for compatability { - // don't try if "xmms off" has been called if (!musEnabled) return; - I_XMMS_Running (); // Check it's on - /* I think this will fix some wierdness */ + I_XMMS_Running (); + // I think this will fix some wierdness if (xmms_remote_is_paused (sessionNo)) { xmms_remote_pause (sessionNo); return; } - // set position - if(track >= 0) xmms_remote_set_playlist_pos(sessionNo, track); + if (track >= 0) + xmms_remote_set_playlist_pos (sessionNo, track); - if (xmms_remote_is_playing (sessionNo)) return; - - xmms_remote_play (sessionNo); - - wasPlaying = playing; - playing = true; - return; -} - -static void -I_XMMS_Pause (void) -{ - // don't try if "xmms off" has been called - if (!musEnabled) - return; - I_XMMS_Running (); // It runnin ? - if (!xmms_remote_is_playing (sessionNo)) - return; - - xmms_remote_pause (sessionNo); - - wasPlaying = playing; - playing = false; - return; -} - -static void -I_XMMS_Resume (void) -{ - // don't try if "xmms off" has been called - if (!musEnabled) - return; - I_XMMS_Running (); // Is it on ? if not, make it so - /* i think this will fix some wierdness */ - if (xmms_remote_is_paused (sessionNo)) { - xmms_remote_pause (sessionNo); - return; - } if (xmms_remote_is_playing (sessionNo)) return; @@ -256,43 +207,66 @@ I_XMMS_Resume (void) } static void -I_XMMS_Prev (void) +I_XMMS_Pause (void) { - // don't try if "xmms off" has been called if (!musEnabled) return; - I_XMMS_Running (); // Running ? + I_XMMS_Running (); + if (!xmms_remote_is_playing (sessionNo)) + return; + xmms_remote_pause (sessionNo); + + wasPlaying = playing; + playing = false; +} + +static void +I_XMMS_Resume (void) +{ + if (!musEnabled) + return; + I_XMMS_Running (); + // i think this will fix some wierdness + if (xmms_remote_is_paused (sessionNo)) { + xmms_remote_pause (sessionNo); + return; + } + if (xmms_remote_is_playing (sessionNo)) + return; + + xmms_remote_play (sessionNo); + wasPlaying = playing; + playing = true; +} + +static void +I_XMMS_Prev (void) +{ + if (!musEnabled) + return; + I_XMMS_Running (); xmms_remote_playlist_prev (sessionNo); - - return; } static void I_XMMS_Next (void) { - // don't try if "xmms off" has been called if (!musEnabled) return; - I_XMMS_Running (); // Running or not ? - + I_XMMS_Running (); xmms_remote_playlist_next (sessionNo); - - return; } static void I_XMMS_Update (void) { - return; } static void XMMS_SessionChg(cvar_t *xmms_session) { sessionNo = xmms_session->int_val; - - return; } static void @@ -317,25 +291,21 @@ I_XMMS_Init (void) "pos - Set playlist position.\n" "info - Get information about currently playing song."); - tmp = Cvar_Get("xmms_session", "0", CVAR_NONE, XMMS_SessionChg, - "XMMS Session number to use"); + tmp = Cvar_Get ("xmms_session", "0", CVAR_NONE, XMMS_SessionChg, + "XMMS Session number to use"); sessionNo = tmp->int_val; - - return; } static void I_XMMS_Shutdown (void) { - return; } static void I_XMMS_Kill (void) { xmms_remote_quit (sessionNo); - return; } static void @@ -343,7 +313,6 @@ I_XMMS_On (void) { musEnabled = true; I_XMMS_Running (); - return; } static void @@ -351,7 +320,6 @@ I_XMMS_Off (void) { musEnabled = false; I_XMMS_Kill (); - return; } static void // Toggle Shuffling @@ -366,101 +334,88 @@ I_XMMS_Shuffle (void) // SO, we check before, and assuming it works, we know that it will be the // opposite of what it _WAS_, if you get my meaning :/ - // don't try if "xmms off" has been called if (!musEnabled) return; - I_XMMS_Running (); // It even running ? + I_XMMS_Running (); shuf = xmms_remote_is_shuffle (sessionNo); xmms_remote_toggle_shuffle (sessionNo); - if (shuf == 1) + if (shuf == 1) { Sys_Printf ("XMMSAudio: Shuffling Disabled\n"); - else if (shuf == 0) + } else if (shuf == 0) { Sys_Printf ("XMMSAudio: Shuffling Enabled\n"); - else - return; // ACH ! - - return; + } } static void // toggles playlist repeating I_XMMS_Repeat (void) { - // Similar situation as with I_XMMS_Shuffle(); - // same code too :) - + // Similar situation as with I_XMMS_Shuffle() -- same code too :) int rep; - // don't try if "xmms off" has been called if (!musEnabled) return; - I_XMMS_Running (); // It even running ? + I_XMMS_Running (); rep = xmms_remote_is_repeat (sessionNo); xmms_remote_toggle_repeat (sessionNo); - if (rep == 1) + if (rep == 1) { Sys_Printf ("XMMSAudio: Repeat Disabled\n"); - else if (rep == 0) + } else if (rep == 0) { Sys_Printf ("XMMSAudio: Repeat Enabled\n"); - else - return; // ACH ! - - return; + } } static void // sets playlist position I_XMMS_Pos (int track) { - if(!musEnabled) return; // allowed to or not ? - if(track < 0) return; // -ve track numbers are dumb - xmms_remote_set_playlist_pos(sessionNo, track); // and set the pos.... - return; // all done + if (!musEnabled) + return; + if (track < 0) + return; // -ve track numbers are dumb + xmms_remote_set_playlist_pos (sessionNo, track); } static void // returns info about track playing and list progress I_XMMS_Info (void) // this is untested with really long tracks, prolly works { - int pos; - char *title; + int pos; + char *title; unsigned int ctime; // -ve times are dumb, will this help ? unsigned int cmin; // current no of mins - byte csecs; // current no of secs + byte csecs; // current no of secs unsigned int ttime; // total track time unsigned int tmin; // total no of mins - byte tsecs; // total no of secs + byte tsecs; // total no of secs unsigned int len; // playlist length - if(!musEnabled) return; // enabled ? + if (!musEnabled) + return; + I_XMMS_Running (); - I_XMMS_Running(); // is it running ? - - pos = xmms_remote_get_playlist_pos(sessionNo); // get the playlist position - len = xmms_remote_get_playlist_length(sessionNo); // playlist length - title = xmms_remote_get_playlist_title(sessionNo, pos); // get track title - ctime = xmms_remote_get_output_time(sessionNo); // get track elapsed time - ttime = xmms_remote_get_playlist_time(sessionNo, pos); + pos = xmms_remote_get_playlist_pos (sessionNo); // get playlist position + len = xmms_remote_get_playlist_length (sessionNo); // playlist length + title = xmms_remote_get_playlist_title (sessionNo, pos); // get track title + ctime = xmms_remote_get_output_time (sessionNo); // get track elapsed time + ttime = xmms_remote_get_playlist_time (sessionNo, pos); // The time returned by xmms_remote_get_output_time is in milliseconds // elapsed, so, divide by (60*1000) to get mins (its an int, no decimals) // and divide by 1000 mod 60 to get seconds. its a byte, no decimals too. + cmin = ctime / 60000; + csecs = ctime / 1000 % 60; - cmin=ctime/(60000); - csecs=ctime/(1000) % 60; - - tmin=ttime/(60000); - tsecs=ttime/(1000) % 60; + tmin = ttime / 60000; + tsecs = ttime / 1000 % 60; // tell the user. - Sys_Printf("XMMS: %d/%d %s %d:%02d/%d:%02d\n", - pos, len, title, cmin, csecs, tmin, tsecs); + Sys_Printf ("XMMS: %d/%d %s %d:%02d/%d:%02d\n", + pos, len, title, cmin, csecs, tmin, tsecs); free (title); - return; } static void I_XMMS_f (void) { const char *command; -/* int ret; - int n; */ if (Cmd_Argc () < 2) return; @@ -530,7 +485,6 @@ I_XMMS_f (void) Sys_Printf ("Try \"help xmms\".\n"); return; } - return; } static general_funcs_t plugin_info_general_funcs = { @@ -570,8 +524,8 @@ static plugin_t plugin_info = { QFPLUGIN_VERSION, "0.1", "Linux XMMS Audio output\n", - "Copyright (C) 2001 contributors of the QuakeForge project\n" - "Please see the file \"AUTHORS\" for a list of contributors\n", + "Copyright (C) 2001 contributors of the QuakeForge project\n" + "Please see the file \"AUTHORS\" for a list of contributors\n", &plugin_info_funcs, &plugin_info_data, };