30#define MAX_PLAYLISTS 10
37 {
CF_CLIENT,
"music_playlist_list0",
"",
"list of tracks to play"},
38 {
CF_CLIENT,
"music_playlist_list1",
"",
"list of tracks to play"},
39 {
CF_CLIENT,
"music_playlist_list2",
"",
"list of tracks to play"},
40 {
CF_CLIENT,
"music_playlist_list3",
"",
"list of tracks to play"},
41 {
CF_CLIENT,
"music_playlist_list4",
"",
"list of tracks to play"},
42 {
CF_CLIENT,
"music_playlist_list5",
"",
"list of tracks to play"},
43 {
CF_CLIENT,
"music_playlist_list6",
"",
"list of tracks to play"},
44 {
CF_CLIENT,
"music_playlist_list7",
"",
"list of tracks to play"},
45 {
CF_CLIENT,
"music_playlist_list8",
"",
"list of tracks to play"},
46 {
CF_CLIENT,
"music_playlist_list9",
"",
"list of tracks to play"}
50 {
CF_CLIENT,
"music_playlist_current0",
"0",
"current track index to play in list"},
51 {
CF_CLIENT,
"music_playlist_current1",
"0",
"current track index to play in list"},
52 {
CF_CLIENT,
"music_playlist_current2",
"0",
"current track index to play in list"},
53 {
CF_CLIENT,
"music_playlist_current3",
"0",
"current track index to play in list"},
54 {
CF_CLIENT,
"music_playlist_current4",
"0",
"current track index to play in list"},
55 {
CF_CLIENT,
"music_playlist_current5",
"0",
"current track index to play in list"},
56 {
CF_CLIENT,
"music_playlist_current6",
"0",
"current track index to play in list"},
57 {
CF_CLIENT,
"music_playlist_current7",
"0",
"current track index to play in list"},
58 {
CF_CLIENT,
"music_playlist_current8",
"0",
"current track index to play in list"},
59 {
CF_CLIENT,
"music_playlist_current9",
"0",
"current track index to play in list"},
63 {
CF_CLIENT,
"music_playlist_random0",
"0",
"enables random play order if 1, 0 is sequential play"},
64 {
CF_CLIENT,
"music_playlist_random1",
"0",
"enables random play order if 1, 0 is sequential play"},
65 {
CF_CLIENT,
"music_playlist_random2",
"0",
"enables random play order if 1, 0 is sequential play"},
66 {
CF_CLIENT,
"music_playlist_random3",
"0",
"enables random play order if 1, 0 is sequential play"},
67 {
CF_CLIENT,
"music_playlist_random4",
"0",
"enables random play order if 1, 0 is sequential play"},
68 {
CF_CLIENT,
"music_playlist_random5",
"0",
"enables random play order if 1, 0 is sequential play"},
69 {
CF_CLIENT,
"music_playlist_random6",
"0",
"enables random play order if 1, 0 is sequential play"},
70 {
CF_CLIENT,
"music_playlist_random7",
"0",
"enables random play order if 1, 0 is sequential play"},
71 {
CF_CLIENT,
"music_playlist_random8",
"0",
"enables random play order if 1, 0 is sequential play"},
72 {
CF_CLIENT,
"music_playlist_random9",
"0",
"enables random play order if 1, 0 is sequential play"},
76 {
CF_CLIENT,
"music_playlist_sampleposition0",
"-1",
"resume position for track, -1 restarts every time"},
77 {
CF_CLIENT,
"music_playlist_sampleposition1",
"-1",
"resume position for track, -1 restarts every time"},
78 {
CF_CLIENT,
"music_playlist_sampleposition2",
"-1",
"resume position for track, -1 restarts every time"},
79 {
CF_CLIENT,
"music_playlist_sampleposition3",
"-1",
"resume position for track, -1 restarts every time"},
80 {
CF_CLIENT,
"music_playlist_sampleposition4",
"-1",
"resume position for track, -1 restarts every time"},
81 {
CF_CLIENT,
"music_playlist_sampleposition5",
"-1",
"resume position for track, -1 restarts every time"},
82 {
CF_CLIENT,
"music_playlist_sampleposition6",
"-1",
"resume position for track, -1 restarts every time"},
83 {
CF_CLIENT,
"music_playlist_sampleposition7",
"-1",
"resume position for track, -1 restarts every time"},
84 {
CF_CLIENT,
"music_playlist_sampleposition8",
"-1",
"resume position for track, -1 restarts every time"},
85 {
CF_CLIENT,
"music_playlist_sampleposition9",
"-1",
"resume position for track, -1 restarts every time"},
130 if(tryreal && strspn(trackname,
"0123456789") ==
strlen(trackname))
132 track = (
unsigned int) atoi(trackname);
135 trackname =
remap[track];
139 if(tryreal && strspn(trackname,
"0123456789") ==
strlen(trackname))
141 track = (
unsigned int) atoi(trackname);
144 Con_DPrintf(
"CDAudio: Bad track number %u.\n", track);
159 dpsnprintf(filename,
sizeof(filename),
"sound/cdtracks/track%03u.wav", track);
170 dpsnprintf(filename,
sizeof(filename),
"%s", trackname);
190 Con_DPrintf (
"BGM track %s playing...\n", trackname);
197 Con_DPrintf (
"Could not load BGM track %u.\n", track);
199 Con_DPrintf (
"Could not load BGM track %s.\n", trackname);
277 if (strcasecmp(command,
"remap") != 0)
280 if (strcasecmp(command,
"on") == 0)
286 if (strcasecmp(command,
"off") == 0)
293 if (strcasecmp(command,
"reset") == 0)
305 if (strcasecmp(command,
"rescan") == 0)
312 if (strcasecmp(command,
"remap") == 0)
323 for (
n = 1;
n <=
ret;
n++)
329 if (strcasecmp(command,
"close") == 0)
335 if (strcasecmp(command,
"play") == 0)
343 if (strcasecmp(command,
"loop") == 0)
351 if (strcasecmp(command,
"stop") == 0)
359 if (strcasecmp(command,
"pause") == 0)
367 if (strcasecmp(command,
"resume") == 0)
375 if (strcasecmp(command,
"eject") == 0)
383 if (strcasecmp(command,
"info") == 0)
398 Con_Printf(
"cd on - enables CD audio system\n");
399 Con_Printf(
"cd off - stops and disables CD audio system\n");
400 Con_Printf(
"cd reset - resets CD audio system (clears track remapping and re-reads disc information)\n");
401 Con_Printf(
"cd rescan - rescans disks in drives (to use another disc)\n");
402 Con_Printf(
"cd remap <remap1> [remap2] [remap3] [...] - chooses emulated CD tracks to play when a map asks for a particular track, this has many uses\n");
404 Con_Printf(
"cd eject - stops playing music and opens CD tray to allow you to change disc\n");
405 Con_Printf(
"cd play <tracknumber> <startposition> - plays selected track in remapping table\n");
406 Con_Printf(
"cd loop <tracknumber> <startposition> - plays and repeats selected track in remapping table\n");
407 Con_Printf(
"cd stop - stops playing current CD track\n");
408 Con_Printf(
"cd pause - pauses CD playback\n");
409 Con_Printf(
"cd resume - unpauses CD playback\n");
410 Con_Printf(
"cd info - prints basic disc information (number of tracks, currently playing track, volume level)\n");
470 for (t = list;;
count++)
493 if (current >=
count)
498 if (current >= 0 && current <
count)
500 for (listindex = 0, t = list;;listindex++)
504 if (listindex == current)
524 static int lastplaylist = -1;
static void CD_f(cmd_state_t *cmd)
static void CDAudio_StartPlaylist(qbool resume)
char filename_t[MAX_QPATH]
cvar_t music_playlist_random[MAX_PLAYLISTS]
int music_playlist_active
void CDAudio_Resume(void)
cvar_t music_playlist_index
static void CDAudio_Play_byName(const char *trackname, qbool looping, qbool tryreal, float startposition)
static void CDAudio_SetVolume(float newvol)
static unsigned char cdPlayTrack
int CDAudio_Startup(void)
cvar_t music_playlist_sampleposition[MAX_PLAYLISTS]
static void CDAudio_CloseDoor(void)
cvar_t music_playlist_list[MAX_PLAYLISTS]
void CDAudio_Play(int track, qbool looping)
cvar_t cdaudioinitialized
static void CDAudio_StopPlaylistTrack(void)
static qbool cdPlayLooping
int music_playlist_playing
void CDAudio_Update(void)
void CDAudio_Shutdown(void)
float CDAudio_GetPosition(void)
static filename_t remap[MAXTRACKS]
cvar_t music_playlist_current[MAX_PLAYLISTS]
static void CDAudio_Eject(void)
static int CDAudio_GetAudioDiskInfo(void)
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
#define CF_READONLY
cvar cannot be changed from the console or the command buffer, and is considered CF_PERSISTENT
static int Cmd_Argc(cmd_state_t *cmd)
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
#define CF_CLIENT
cvar/command that only the client can change/execute
#define CF_CLIENT_FROM_SERVER
command that the server is allowed to execute on the client
char com_token[MAX_INPUTLINE]
qbool COM_ParseToken_Console(const char **datapointer)
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
#define dp_strlcpy(dst, src, dsize)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
void Cvar_SetValueQuick(cvar_t *var, float value)
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
static int(ZEXPORT *qz_inflate)(z_stream *strm
const char * FS_FileExists(const char *filename)
Look for a file in the packages and in the filesystem Returns its canonical name (same case as used i...
GLsizei const GLfloat * value
GLenum GLenum GLsizei count
GLenum GLuint GLenum GLsizei const GLchar * buf
#define lhrandom(MIN, MAX)
LadyHavoc: this function never returns exactly MIN or exactly MAX, because of a QuakeC bug in id1 whe...
#define MAX_QPATH
max length of a quake game pathname
#define MAXTRACKS
max CD track index
void S_SetChannelVolume(unsigned int ch_ind, float fvol)
float S_GetChannelPosition(unsigned int ch_ind)
void S_StopChannel(unsigned int channel_ind, qbool lockmutex, qbool freesfx)
qbool S_SetChannelFlag(unsigned int ch_ind, unsigned int flag, qbool value)
int S_StartSound_StartPosition_Flags(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float startposition, int flags, float fspeed)
sfx_t * S_PrecacheSound(const char *name, qbool complain, qbool levelsound)
#define CHANNELFLAG_LOCALSOUND
#define CHANNELFLAG_FORCELOOP
#define CHANNELFLAG_FULLVOLUME
#define CHANNELFLAG_PAUSED
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
int Sys_CheckParm(const char *parm)