int I_SetVolumeCD(int volume) { if (volume != cdvolume) { if (volume > 0 && volume < 16) { cd_volume.Set(31); cdvolume = 31; I_ResumeCD(); } else if (volume > 15 && volume < 31) { cd_volume.Set(0); cdvolume = 0; I_PauseCD(); } } return 0; }
boolean I_SetVolumeCD (INT32 volume) { #ifdef NOSDLCD (void)volume; #else if (volume != cdvolume) { if (volume > 0 && volume < 16) { CV_SetValue(&cd_volume, 31); cdvolume = 31; I_ResumeCD(); } else if (volume > 15 && volume < 31) { CV_SetValue(&cd_volume, 0); cdvolume = 0; I_PauseCD(); } } #endif return false; }
static void Command_Cd_f() { const char *command; int ret, n; if (!initialized) return; if (COM.Argc() < 2) { CONS_Printf("cd [on] [off] [remap] [reset] [open]\n" " [info] [play <track>] [resume]\n" " [stop] [pause] [loop <track>]\n"); return; } command = COM.Argv(1); if (!strncmp(command, "on", 2)) { enabled = true; return; } if (!strncmp(command, "off", 3)) { I_StopCD(); enabled = false; return; } if (!strncmp(command, "remap", 5)) { ret = COM.Argc() - 2; if (ret <= 0) { for (n = 1; n < MAX_CD_TRACKS; n++) if (cdRemap[n] != n) CONS_Printf(" %u -> %u\n", n, cdRemap[n]); return; } for (n = 1; n <= ret; n++) cdRemap[n] = atoi(COM.Argv(n+1)); return; } if (!strncmp(command, "reset", 5)) { enabled = true; I_StopCD(); for (n = 0; n < MAX_CD_TRACKS; n++) cdRemap[n] = n; CDAudio_GetAudioDiskInfo(); return; } if (!cdValid) { CDAudio_GetAudioDiskInfo(); if (!cdValid) return; } if (!strncmp(command, "open", 4)) { I_EjectCD(); cdValid = false; return; } if (!strncmp(command, "info", 4)) { CONS_Printf("%u tracks\n", maxTrack); if (playing) CONS_Printf("Currently %s track %u\n", playLooping ? "looping" : "playing", playTrack); else if (wasPlaying) CONS_Printf("Paused %s track %u\n", playLooping ? "looping" : "playing", playTrack); CONS_Printf("Volume is %d\n", cdvolume); return; } if (!strncmp(command, "play", 4)) { I_PlayCD((byte)atoi(COM.Argv(2)), false); return; } if (!strncmp(command, "loop", 4)) { I_PlayCD((byte)atoi(COM.Argv(2)), true); return; } if (!strncmp(command, "stop", 4)) { I_StopCD(); return; } if (!strncmp(command, "pause", 5)) { I_PauseCD(); return; } if (!strncmp(command, "resume", 6)) { I_ResumeCD(); return; } CONS_Printf("Invalid command \"cd %s\"\n", COM.Argv(1)); }
static void Command_Cd_f (void) { LPCSTR s; int i,j; if (!cdaudio_started) return; if (COM_Argc()<2) { CONS_Printf ("cd [on] [off] [remap] [reset] [open]\n" " [info] [play <track>] [loop <track>]\n" " [stop] [resume]\n"); return; } s = COM_Argv(1); // activate cd music if (!strncmp(s,"on",2)) { cdEnabled = true; return; } // stop/deactivate cd music if (!strncmp(s,"off",3)) { if (cdPlaying) I_StopCD (); cdEnabled = false; return; } // remap tracks if (!strncmp(s,"remap",5)) { i = (int)COM_Argc() - 2; if (i <= 0) { CONS_Printf ("CD tracks remapped in that order :\n"); for (j = 1; j < MAX_CD_TRACKS; j++) if (cdRemap[j] != j) CONS_Printf (" %2d -> %2d\n", j, cdRemap[j]); return; } for (j = 1; j <= i; j++) cdRemap[j] = (UINT8)atoi (COM_Argv (j+1)); return; } // reset the CD driver, useful on some odd cd's if (!strncmp(s,"reset",5)) { cdEnabled = true; if (cdPlaying) I_StopCD (); for (i = 0; i < MAX_CD_TRACKS; i++) cdRemap[i] = (UINT8)i; CD_Reset(); cdValid = CD_ReadTrackInfo(); return; } // any other command is not allowed until we could retrieve cd information if (!cdValid) { CONS_Printf ("CD is not ready.\n"); return; } /* faB: not with MCI, didn't find it, useless anyway if (!strncmp(s,"open",4)) { if (cdPlaying) I_StopCD (); bcd_open_door(); cdValid = false; return; }*/ if (!strncmp(s,"info",4)) { if (!CD_ReadTrackInfo()) { cdValid = false; return; } cdValid = true; if (m_nTracksCount <= 0) CONS_Printf ("No audio tracks\n"); else { // display list of tracks // highlight current playing track for (i = 0; i < m_nTracksCount; i++) { CONS_Printf("%s%2d. %s %s\n", cdPlaying && (cdPlayTrack == i) ? "\2 " : " ", i+1, m_nTracks[i].IsAudio ? "audio" : "data ", hms(m_nTracks[i].Length)); } CONS_Printf ("\2Total time : %s\n", hms(CD_TotalTime())); } if (cdPlaying) { CONS_Printf ("%s track : %d\n", cdLooping ? "looping" : "playing", cdPlayTrack); } return; } if (!strncmp(s,"play",4)) { I_PlayCD ((UINT8)atoi(COM_Argv (2)), false); return; } if (!strncmp(s,"stop",4)) { I_StopCD (); return; } if (!strncmp(s,"loop",4)) { I_PlayCD ((UINT8)atoi(COM_Argv (2)), true); return; } if (!strncmp(s,"resume",4)) { I_ResumeCD (); return; } CONS_Printf ("cd command '%s' unknown\n", s); }
/************************************************************************** * * function: Command_Cd_f * * description: * handles all CD commands from the console * **************************************************************************/ static void Command_Cd_f (void) { const char *command; size_t ret, n; if (!cdaudio_started) return; if (COM_Argc() < 2) { CONS_Printf ("%s", M_GetText("cd [on] [off] [remap] [reset] [select]\n" " [open] [info] [play <track>] [resume]\n" " [stop] [pause] [loop <track>]\n")); return; } command = COM_Argv (1); if (!strncmp(command, "on", 2)) { cdEnabled = SDL_TRUE; return; } if (!strncmp(command, "off", 3)) { I_StopCD(); cdEnabled = SDL_FALSE; return; } if (!strncmp(command, "select", 6)) { INT32 newcddrive; newcddrive = atoi(COM_Argv(2)); command = SDL_CDName(newcddrive); I_StopCD(); cdEnabled = SDL_FALSE; SDL_CDClose(cdrom); cdrom = SDL_CDOpen(newcddrive); if (cdrom) { cdEnabled = SDL_TRUE; CONS_Printf(M_GetText("Opened CD-ROM drive %s\n"), command ? command : COM_Argv(2)); } else CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), command ? command : COM_Argv(2), SDL_GetError()); return; } if (!strncmp(command, "remap", 5)) { ret = COM_Argc() - 2; if (ret <= 0) { for (n = 1; n < MAX_CD_TRACKS; n++) { if (cdRemap[n] != n) CONS_Printf(" %s -> %u\n", sizeu1(n), cdRemap[n]); } return; } for (n = 1; n <= ret; n++) cdRemap[n] = (Uint8)atoi(COM_Argv (n+1)); return; } if (!strncmp(command, "reset", 5)) { if (!cdrom) return; cdEnabled = SDL_TRUE; I_StopCD(); for (n = 0; n < MAX_CD_TRACKS; n++) cdRemap[n] = (Uint8)n; CDAudio_GetAudioDiskInfo(); return; } if (!cdValid) { if (CDAudio_GetAudioDiskInfo()==-1 && !cdValid) { CONS_Printf("%s", M_GetText("No CD in drive\n")); return; } } if (!strncmp(command, "open", 4)) { I_EjectCD(); cdValid = SDL_FALSE; return; } if (!strncmp(command, "info", 4)) { CONS_Printf(M_GetText("%u tracks\n"), maxTrack); if (cdPlaying) CONS_Printf(M_GetText("Currently %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack); else if (wasPlaying) CONS_Printf(M_GetText("Paused %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack); CONS_Printf(M_GetText("Volume is %d\n"), cdvolume); return; } if (!strncmp(command, "play", 4)) { I_PlayCD((UINT8)atoi(COM_Argv (2)), SDL_FALSE); return; } if (!strncmp(command, "loop", 4)) { I_PlayCD((UINT8)atoi(COM_Argv (2)), true); return; } if (!strncmp(command, "stop", 4)) { I_StopCD(); return; } if (!strncmp(command, "pause", 5)) { I_PauseCD(); return; } if (!strncmp(command, "resume", 6)) { I_ResumeCD(); return; } CONS_Printf(M_GetText("Invalid CD command \"CD %s\"\n"), COM_Argv(1)); }