Esempio n. 1
0
bool CDROM_Interface_SDL::SetDevice (char* path, int forceCD) 
{ 
	char buffer[512];
	strcpy(buffer,path);
	upcase(buffer);

	int num = SDL_CDNumDrives();
	if ((forceCD>=0) && (forceCD<num)) {
		driveID = forceCD;
	        cd = SDL_CDOpen(driveID);
	        SDL_CDStatus(cd);
	   	return true;
	};	
	
	const char* cdname = 0;
	for (int i=0; i<num; i++) {
		cdname = SDL_CDName(i);
		if (strcmp(buffer,cdname)==0) {
			cd = SDL_CDOpen(i);
			SDL_CDStatus(cd);
			driveID = i;
			return true;
		};
	};
	return false; 
};
Esempio n. 2
0
int CDROM_GetMountType(char* path, int forceCD)
// 0 - physical CDROM
// 1 - Iso file
// 2 - subdirectory
{
	// 1. Smells like a real cdrom 
	// if ((strlen(path)<=3) && (path[2]=='\\') && (strchr(path,'\\')==strrchr(path,'\\')) && 	(GetDriveType(path)==DRIVE_CDROM)) return 0;

	const char* cdName;
	char buffer[512];
	strcpy(buffer,path);
#if defined (WIN32) || defined(OS2)
	upcase(buffer);
#endif

	int num = SDL_CDNumDrives();
	// If cd drive is forced then check if its in range and return 0
	if ((forceCD>=0) && (forceCD<num)) {
		LOG(LOG_ALL,LOG_ERROR)("CDROM: Using drive %d",forceCD);
		return 0;
	}

	// compare names
	for (int i=0; i<num; i++) {
		cdName = SDL_CDName(i);
		if (strcmp(buffer,cdName)==0) return 0;
	};
	
	// Detect ISO
	struct stat file_stat;
	if ((stat(path, &file_stat) == 0) && S_ISREG(file_stat.st_mode)) return 1; 
	return 2;
};
Esempio n. 3
0
//------------------------------------------------------------------------------
void InstallRedBookDevices()
{
#if !defined(__FreeBSD__)
   Con::printf("CD Audio Init:");
   if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1)
   {
      Con::printf("   Unable to initialize CD Audio: %s", SDL_GetError());
      return;
   }

   S32 numDrives = SDL_CDNumDrives();
   if (numDrives == 0)
   {
      Con::printf("   No drives found.");
      return;
   }

   for (int i = 0; i < numDrives; ++i)
   {
      const char * deviceName = SDL_CDName(i);
      Con::printf("   Installing CD Audio device: %s", deviceName);

      UnixRedBookDevice * device = new UnixRedBookDevice;
      device->setDeviceInfo(i, deviceName);
      RedBook::installDevice(device);
   }

   Con::printf(" ");
#endif	// !defined(__FreeBSD__)
}
Esempio n. 4
0
void SDL::printSystemInfo()
{

    // Getting Video Driver information
    char namebuf[255];
    SDL_VideoDriverName(namebuf, 254);
    Log::log("Video Driver: " + std::string(namebuf));

    // Getting Joystick information
    int num = SDL_NumJoysticks();

    Log::log("There are " + SDL::intToString(num) +
             " Joystick(s) currently available.");

    for (int i = 0; i < num; i++)
        Log::log("Joystick no " + SDL::intToString(i + 1) +
                 ": " + std::string(SDL_JoystickName(i)));

    // Getting CD-ROM information
    num = SDL_CDNumDrives();

    Log::log("There are " + SDL::intToString(num) +
                    " CD-ROM Drive(s) currently available.");

    for (int i = 0; i < num; i++)
        Log::log("CD-ROM Drive no " + SDL::intToString(i + 1) +
                 ": " + std::string(SDL_CDName(i)));
}
Esempio n. 5
0
static PyObject*
cd_get_name (PyObject* self)
{
    int cd_id = PyCD_AsID (self);
    CDROM_INIT_CHECK ();
    return Text_FromUTF8 (SDL_CDName (cd_id));
}
Esempio n. 6
0
static int modcd_name( INSTANCE * my, int * params )
{
    int result;

    if ( params[0] < 0 || params[0] >= SDL_CDNumDrives() ) return 0;

    result = string_new( SDL_CDName( params[0] ) );
    string_use( result );
    return result;
}
Esempio n. 7
0
/**************************************************************************
 *
 * function: InitCD
 *
 * description:
 * Initialize the first CD drive SDL detects and add console command 'cd'
 *
 **************************************************************************/
void I_InitCD (void)
{
#ifndef NOSDLCD
	INT32 i;

	// Has been checked in d_main.c, but doesn't hurt here
	if (M_CheckParm ("-nocd"))
		return;

	CONS_Printf("I_InitCD: Init CD audio\n");

	// Initialize SDL first
	if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0)
	{
		CONS_Printf("Couldn't initialize SDL CDROM: %s\n",SDL_GetError());
		return;
	}

	// Open drive
	cdrom = SDL_CDOpen(0);

	if (!cdrom)
	{
		const char *cdName = SDL_CDName(0);
		if (!cdName)
		{

			CONS_Printf("Couldn't open default CD-ROM drive: %s\n",
				SDL_GetError());
		}
		else
		{
			CONS_Printf("Couldn't open default CD-ROM drive %s: %s\n",
				cdName, SDL_GetError());
		}
		//return;
	}

	for (i = 0; i < MAX_CD_TRACKS; i++)
		cdRemap[i] = (Uint8)i;

	cdaudio_started = true;
	if (cdrom) cdEnabled = true;

	if (CDAudio_GetAudioDiskInfo()==-1)
	{
		CONS_Printf("I_InitCD: No CD in player.\n");
		cdValid = SDL_FALSE;
	}

	COM_AddCommand ("cd", Command_Cd_f);

	CONS_Printf("CD audio Initialized\n");
#endif
}
Esempio n. 8
0
void I_InitCD()
{
  int i;
  const char *cdName;
    
  // Don't start music on a dedicated server
  if (M_CheckParm("-dedicated"))
    return ;
    
  // Has been checked in d_main.c, but doesn't hurt here
  if (M_CheckParm("-nocd"))
    return ;
    
  CONS_Printf(" Initializing CD audio...\n");

  // Initialize SDL first
  if (SDL_Init(SDL_INIT_CDROM) < 0) {
    CONS_Printf(" Couldn't initialize SDL CD: %s\n", SDL_GetError());
    return;
  }

  // Open drive
  cdrom = SDL_CDOpen(0);
  cdName = SDL_CDName(0);
    
  if (cdrom == NULL) {
    if (cdName == NULL)
      {
	    
	CONS_Printf(" Couldn't open default CD-ROM drive: %s\n",
		    SDL_GetError());
      }
    else
      {
	CONS_Printf(" Couldn't open default CD-ROM drive %s: %s\n",
		    cdName, SDL_GetError());
      }
	
    return;
  }
    
  for (i = 0; i < MAX_CD_TRACKS; i++)
    cdRemap[i] = i;
    
  initialized = true;
  enabled = true;

  CDAudio_GetAudioDiskInfo();

  COM.AddCommand("cd", Command_Cd_f);
    
  CONS_Printf(" CD audio initialized.\n");
    
  return ;
}
Esempio n. 9
0
int main (int argc, char * argv[])
{
//#define CHECK_CDROM 1
#ifdef CHECK_CDROM
SDL_Init(SDL_INIT_CDROM);
std::cout << SDL_CDNumDrives() << " CD- / DVD-ROM drives available."  << std::endl;
    for (int i = 0; i < SDL_CDNumDrives(); i++ )
    {
    std::cout << i << ". " << SDL_CDName(i) << std::endl;
    }
#else
SDL_Init(0);
#endif

    while (!app_exit)
    {
    SDL_InitSubSystem(SDL_INIT_VIDEO);
    SDL_Surface * screen;
    screen = NULL;
    set_context(screen,
                context_config[0], // w
                context_config[1], // h
                context_config[2], // fullscreen
                context_config[3], // framebuffer size
                context_config[4], // multisamples
                context_config[5], // multisample buffer
                context_config[6], // bpp
                context_config[7]  // depthbuffer size
                );
    Application app;
    app.initialize(context_config);

        if (argc > 1)
        {
        app.load_scene(scene_config, argv[1]);
        }
        else
        {
        app.load_scene(scene_config, "testFile.bullet");
        }

    app.run(&app_exit);

    app.close_scene();
    app.close();

    SDL_FreeSurface(screen);
    screen = NULL;
    SDL_QuitSubSystem(SDL_INIT_VIDEO);
    }

SDL_Quit();
std::cout << "main() quit" << std::endl;
return 0;
}
Esempio n. 10
0
bool CDROM_Interface_Ioctl::SetDevice(char* path, int forceCD)
{
	bool success = CDROM_Interface_SDL::SetDevice(path, forceCD);
	
	if (success) {
		const char* tmp = SDL_CDName(forceCD);
		if (tmp) safe_strncpy(device_name, tmp, 512);
		else success = false;
	}
	
	return success;
}
Esempio n. 11
0
int I_CDMusInit(void)
{
    int drive_num = 0;

    // The initialize function is re-invoked when the CD track play cheat
    // is used, so use the opportunity to call SDL_CDStatus() to update
    // the status of the drive.

    if (cd_handle == NULL)
    {
        if (SDL_Init(SDL_INIT_CDROM) < 0)
        {
            startup_error = "Failed to init CD subsystem.";
            cd_Error = 1;
            return -1;
        }

        // TODO: config variable to control CDROM to use.

        cd_handle = SDL_CDOpen(drive_num);

        if (cd_handle == NULL)
        {
            startup_error = "Failed to open CD-ROM drive.";
            cd_Error = 1;
            return -1;
        }

        cd_name = SDL_CDName(drive_num);
    }

    if (SDL_CDStatus(cd_handle) == CD_ERROR)
    {
        startup_error = "Failed to read CD status.";
        cd_Error = 1;
        return -1;
    }

    if (!CD_INDRIVE(cd_handle->status))
    {
        startup_error = "No CD in drive.";
        cd_Error = 1;
        return -1;
    }

    cd_Error = 0;

    return 0;
}
Esempio n. 12
0
void SoundManager::InitRedbook()
{
#if defined(USE_SDL)
    if (!m_cdrom) {
        int errcode = SDL_Init(SDL_INIT_CDROM | m_SDLInitFlags);

        Assert(0 == errcode);
        if (errcode < 0) {
            return;
        }

        int numDrives = SDL_CDNumDrives();
        Assert(numDrives >= 0);

        int drive = -1;
        int i = 0;
        // Hack: We don't have the num of the SDL drive stored,
        //       so we search for the drive with the drive letter stored
        MBCHAR driveLetter = toupper(c3files_GetCtpCdId());
        while ((i < numDrives) && (-1 == drive)) {
            const char *cd_name = SDL_CDName(i);
            if (cd_name) {
                if (toupper(cd_name[0]) == driveLetter) {
                    drive = i;
                }
            }
            i++;
        }

        // No drive match?!
        if (drive < 0) {
            return;
        }
        m_cdrom = SDL_CDOpen(drive);
        Assert(m_cdrom != 0);
        // No control structur?
        if (m_cdrom) 
        {
            CDstatus status = SDL_CDStatus(m_cdrom);
        }
    }
#else // !USE_SDL
	if (!m_redbook) 
	{
		m_redbook = AIL_redbook_open_drive(c3files_GetCtpCdId());
	}
#endif // USE_SDL
}
Esempio n. 13
0
int main (int argc, char *argv[])
{
	int i;
[+IF (=(get "HaveSDL_net") "1")+]
	IPaddress local = {0x0100007F, 0x50};
[+ENDIF+]
	
	printf ("Initializing SDL.\n");
	
	/* Initializes Audio and the CDROM, add SDL_INIT_VIDEO for Video */
	if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_CDROM)< 0)
	{
    	printf("Could not initialize SDL:%s\n", SDL_GetError());
		SDL_Quit();
		
		return 1;
	}
	printf("Audio & CDROM initialized correctly\n");
	
    /* Trying to read number of CD devices on system */
	printf("Drives available: %d\n", SDL_CDNumDrives());
    	for (i=0; i < SDL_CDNumDrives(); ++i)
	{
		printf("Drive %d\"%s\"\n", i, SDL_CDName(i));
    	}
	
[+IF (=(get "HaveSDL_net") "1")+]
	if (SDLNet_Init() < 0)
	{
		printf("Could not initialize SDL_net:%s\n", SDLNet_GetError());
		SDL_Quit();

		return 1;
	}
	printf("\n\nNetwork initialized correctly\n");
	
	/* Get host name */
	printf("Hostname: %s\n", SDLNet_ResolveIP(&local));

	SDLNet_Quit();
[+ENDIF+]
	
	SDL_Quit();
	
	return(0);
}
Esempio n. 14
0
void RBAInit()
{
	int	d, i, j;
	char	szDrive [FILENAME_LEN], sz [FILENAME_LEN];
	
if (initialised) 
	return;
if (FindArg("-nocdrom")) 
	return; 

if (SDL_Init(SDL_INIT_CDROM) < 0) {
	Warning(TXT_SDL_INIT_LIB,SDL_GetError());
	return;
	}

if ((j = SDL_CDNumDrives()) == 0) {
	Warning(TXT_CDROM_NONE);
	return;
	}

d = 0;
if ((i = FindArg ("-cdrom")) && *Args [++i]) {
#ifdef _WIN32
	sprintf (szDrive, "%c:\\", *Args [i]);
#else
	strncpy (szDrive, Args [i], sizeof (szDrive));
#endif
	strlwr (szDrive);
	for (i = 0; i < j; i++) {
		strcpy (sz, SDL_CDName (i));
		strlwr (sz);
		if (!strcmp (szDrive, sz)) {
			d = i;
			break;
			}
		}
	}

if (!(s_cd = SDL_CDOpen(d))) {
	Warning(TXT_CDROM_OPEN);
	return;
	}
atexit(RBAExit);
initialised = 1;
}
Esempio n. 15
0
bool CDROM_Interface_SDL::SetDevice(char* path, int forceCD) { 
	char buffer[512];
	strcpy(buffer,path);
	upcase(buffer);

	int num = SDL_CDNumDrives();
	if ((forceCD>=0) && (forceCD<num)) {
		driveID = forceCD;
			//--Added 2009-12-31 by Alun Bestor: shut down and restart the CDROM subsystem to reset SDL's
			//cached file information about the CD-ROM volumes
			//This is needed otherwise SDL persists invalid file pointers to the CD-ROM and its tracks,
			//way to go guys
			SDL_QuitSubSystem(SDL_INIT_CDROM);
			SDL_Init(SDL_INIT_CDROM);
			//--End of modifications
		
	        cd = SDL_CDOpen(driveID);
	        SDL_CDStatus(cd);
	   	return true;
	};	
	
	const char* cdname = 0;
	for (int i=0; i<num; i++) {
		cdname = SDL_CDName(i);
		if (strcmp(buffer,cdname)==0) {
			//--Added 2009-12-31 by Alun Bestor: shut down and restart the CDROM subsystem to reset SDL's
			//cached file information about the CD-ROM volumes
			//This is needed otherwise SDL persists invalid file pointers to the CD-ROM and its tracks,
			//way to go guys
			SDL_QuitSubSystem(SDL_INIT_CDROM);
			SDL_Init(SDL_INIT_CDROM);
			//--End of modifications
			
			cd = SDL_CDOpen(i);
			SDL_CDStatus(cd);
			driveID = i;
			return true;
		};
	};
	return false; 
}
Esempio n. 16
0
int main(int argc, char *argv[])
{
	int drive;
	int i;
	SDL_CD *cdrom;

	/* Initialize SDL first */
	if ( SDL_Init(SDL_INIT_CDROM) < 0 ) {
		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
		return(1);
	}

	/* Find out how many CD-ROM drives are connected to the system */
	if ( SDL_CDNumDrives() == 0 ) {
		printf("No CD-ROM devices detected\n");
		quit(0);
	}
	printf("Drives available: %d\n", SDL_CDNumDrives());
	for ( i=0; i<SDL_CDNumDrives(); ++i ) {
		printf("Drive %d:  \"%s\"\n", i, SDL_CDName(i));
	}

	/* Open the CD-ROM */
	drive = 0;
	i=1;
	if ( argv[i] && isdigit(argv[i][0]) ) {
		drive = atoi(argv[i++]);
	}
	cdrom = SDL_CDOpen(drive);
	if ( cdrom == NULL ) {
		fprintf(stderr, "Couldn't open drive %d: %s\n", drive,
							SDL_GetError());
		quit(2);
	}
#ifdef TEST_NULLCD
	cdrom = NULL;
#endif
	
	/* Find out which function to perform */
	for ( ; argv[i]; ++i ) {
		if ( strcmp(argv[i], "-status") == 0 ) {
			/* PrintStatus(drive, cdrom); */
		} else
		if ( strcmp(argv[i], "-list") == 0 ) {
			ListTracks(cdrom);
		} else
		if ( strcmp(argv[i], "-play") == 0 ) {
			int strack, sframe;
			int ntrack, nframe;

			strack = 0;
			if ( argv[i+1] && isdigit(argv[i+1][0]) ) {
				strack = atoi(argv[++i]);
			}
			sframe = 0;
			if ( argv[i+1] && isdigit(argv[i+1][0]) ) {
				sframe = atoi(argv[++i]);
			}
			ntrack = 0;
			if ( argv[i+1] && isdigit(argv[i+1][0]) ) {
				ntrack = atoi(argv[++i]);
			}
			nframe = 0;
			if ( argv[i+1] && isdigit(argv[i+1][0]) ) {
				nframe = atoi(argv[++i]);
			}
			if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
				if ( SDL_CDPlayTracks(cdrom, strack, sframe,
							ntrack, nframe) < 0 ) {
					fprintf(stderr,
			"Couldn't play tracks %d/%d for %d/%d: %s\n",
				strack, sframe, ntrack, nframe, SDL_GetError());
				}
			} else {
				fprintf(stderr, "No CD in drive!\n");
			}
		} else
		if ( strcmp(argv[i], "-pause") == 0 ) {
			if ( SDL_CDPause(cdrom) < 0 ) {
				fprintf(stderr, "Couldn't pause CD: %s\n",
								SDL_GetError());
			}
		} else
		if ( strcmp(argv[i], "-resume") == 0 ) {
			if ( SDL_CDResume(cdrom) < 0 ) {
				fprintf(stderr, "Couldn't resume CD: %s\n",
								SDL_GetError());
			}
		} else
		if ( strcmp(argv[i], "-stop") == 0 ) {
			if ( SDL_CDStop(cdrom) < 0 ) {
				fprintf(stderr, "Couldn't eject CD: %s\n",
								SDL_GetError());
			}
		} else
		if ( strcmp(argv[i], "-eject") == 0 ) {
			if ( SDL_CDEject(cdrom) < 0 ) {
				fprintf(stderr, "Couldn't eject CD: %s\n",
								SDL_GetError());
			}
		} else
		if ( (strcmp(argv[i], "-sleep") == 0) &&
				(argv[i+1] && isdigit(argv[i+1][0])) ) {
			SDL_Delay(atoi(argv[++i]));
			printf("Delayed %d milliseconds\n", atoi(argv[i]));
		} else {
			PrintUsage(argv[0]);
			SDL_CDClose(cdrom);
			quit(1);
		}
	}
	PrintStatus(drive, cdrom);
	SDL_CDClose(cdrom);
	SDL_Quit();

	return(0);
}
Esempio n. 17
0
/* Getters/Setters */
static PyObject*
_cd_getname (PyObject *self, void *closure)
{
    ASSERT_CDROM_INIT(NULL);
    return Text_FromUTF8 (SDL_CDName (((PyCD*)self)->index));
}
Esempio n. 18
0
int CDAudio_Init(void)
{
	int	i, x, sdl_num_drives;

	if (safemode || COM_CheckParm("-nocdaudio"))
		return -1;

	if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0)
	{
		Con_Printf("Couldn't init SDL cdrom: %s\n", SDL_GetError());
		return -1;
	}

	sdl_num_drives = SDL_CDNumDrives ();
	Con_Printf ("SDL detected %d CD-ROM drive%c\n", sdl_num_drives,
					sdl_num_drives == 1 ? ' ' : 's');

	if (sdl_num_drives < 1)
		return -1;

	if ((i = COM_CheckParm("-cddev")) != 0 && i < com_argc - 1)
	{
		for (x = 0; x < sdl_num_drives; x++)
		{
			if (!q_strcasecmp(SDL_CDName(x), com_argv[i+1]))
			{
				cd_dev = x;
				break;
			}
		}
		if (cd_dev == -1)
		{
			Con_Printf("SDL couldn't find cdrom device %s\n", com_argv[i+1]);
			return -1;
		}
	}

	if (cd_dev == -1)
		cd_dev = 0;	// default drive

	cd_handle = SDL_CDOpen(cd_dev);
	if (!cd_handle)
	{
		Con_Printf ("%s: Unable to open CD-ROM drive %s (%s)\n",
				__thisfunc__, SDL_CDName(cd_dev), SDL_GetError());
		return -1;
	}

	for (i = 0; i < 100; i++)
		remap[i] = i;
	enabled = true;
	old_cdvolume = bgmvolume.value;

	Con_Printf("CDAudio initialized (SDL, using %s)\n", SDL_CDName(cd_dev));

	if (CDAudio_GetAudioDiskInfo())
	{
		Con_Printf("%s: No CD in drive\n", __thisfunc__);
		cdValid = false;
	}

	Cmd_AddCommand ("cd", CD_f);

// cd hardware volume: no SDL support at present.
	hw_vol_works = CD_GetVolume (NULL);
	if (hw_vol_works)
		hw_vol_works = CDAudio_SetVolume (&bgmvolume);

	return 0;
}
Esempio n. 19
0
/**************************************************************************
 *
 * 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));
}