本文整理汇总了C++中CDAudio_GetAudioDiskInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ CDAudio_GetAudioDiskInfo函数的具体用法?C++ CDAudio_GetAudioDiskInfo怎么用?C++ CDAudio_GetAudioDiskInfo使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CDAudio_GetAudioDiskInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CDAudio_Play_real
qboolean CDAudio_Play_real (int track, qboolean looping, qboolean complain)
{
if(track < 1)
{
if(complain)
Con_Print("Could not load BGM track.\n");
return false;
}
if (!cdValid)
{
CDAudio_GetAudioDiskInfo();
if (!cdValid)
{
if(complain)
Con_DPrint ("No CD in player.\n");
return false;
}
}
if (track > maxTrack)
{
if(complain)
Con_DPrintf("CDAudio: Bad track number %u.\n", track);
return false;
}
if (CDAudio_SysPlay(track) == -1)
return false;
if(cdaudio.integer != 3)
Con_DPrintf ("CD track %u playing...\n", track);
return true;
}
示例2: CDAudio_Init
int CDAudio_Init (void)
{
int i;
if (!COM_CheckParm("-cdaudio"))
return -1;
if ((i = COM_CheckParm("-cddev")) != 0 && i < com_argc - 1)
strlcpy (cd_dev, com_argv[i + 1], sizeof(cd_dev));
if ((cdfile = open(cd_dev, O_RDONLY)) == -1) {
Com_Printf ("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, errno);
cdfile = -1;
return -1;
}
for (i = 0; i < 100; i++)
remap[i] = i;
initialized = true;
enabled = true;
if (CDAudio_GetAudioDiskInfo())
{
Com_Printf ("CDAudio_Init: No CD in player.\n");
cdValid = false;
}
Cmd_AddCommand ("cd", CD_f);
Com_Printf ("CD Audio Initialized\n");
return 0;
}
示例3: CDAudio_Startup
int CDAudio_Startup (void)
{
if (COM_CheckParm("-nocdaudio"))
return -1;
CDAudio_SysStartup ();
if (CDAudio_GetAudioDiskInfo())
{
Con_Print("CDAudio_Init: No CD in player.\n");
cdValid = false;
}
saved_vol = CDAudio_SysGetVolume ();
if (saved_vol < 0.0f)
{
Con_Print ("Can't get initial CD volume\n");
saved_vol = 1.0f;
}
else
Con_Printf ("Initial CD volume: %g\n", saved_vol);
initialized = true;
Con_Print("CD Audio Initialized\n");
return 0;
}
示例4: CDAudio_Init
int
CDAudio_Init(void)
{
int i, err;
#ifdef NQ_HACK
// FIXME - not a valid client state in QW?
if (cls.state == ca_dedicated)
return -1;
#endif
if (COM_CheckParm("-nocdaudio"))
return -1;
Cmd_AddCommand("cd", CD_f);
err = CDDrv_InitDevice();
if (err)
return err;
for (i = 0; i < 100; i++)
remap[i] = i;
initialized = true;
enabled = true;
Con_Printf("CD Audio Initialized\n");
if (CDAudio_GetAudioDiskInfo()) {
Con_Printf("CDAudio_Init: No CD in player.\n");
cdValid = false;
}
Cvar_RegisterVariable(&bgmvolume);
return 0;
}
示例5: I_UpdateCD
/**************************************************************************
*
* function: UpdateCD
*
* description:
* sets CD volume (may have changed) and initiates play evey 2 seconds
* in case the song has elapsed
*
**************************************************************************/
void I_UpdateCD (void)
{
#ifndef NOSDLCD
static Uint32 lastchk = 0;
if (!cdEnabled || !cdrom)
return;
I_SetVolumeCD(cd_volume.value);
if (cdPlaying && lastchk < SDL_GetTicks())
{
lastchk = SDL_GetTicks() + 2000; //two seconds between chks
if (CDAudio_GetAudioDiskInfo()==-1)
{
cdPlaying = SDL_FALSE;
return;
}
if (cdStatus != CD_PLAYING && cdStatus != CD_PAUSED)
{
cdPlaying = SDL_FALSE;
if (playLooping)
I_PlayCD(playTrack, true);
}
}
#endif
}
示例6: I_UpdateCD
void I_UpdateCD()
{
if (!enabled)
return;
I_SetVolumeCD(cd_volume.value);
if (playing && lastchk < SDL_GetTicks())
{
lastchk = SDL_GetTicks() + 2000; //two seconds between chks
if (CDAudio_GetAudioDiskInfo())
{
playing = false;
return;
}
if (cdStatus != CD_PLAYING &&
cdStatus != CD_PAUSED)
{
playing = false;
if (playLooping)
I_PlayCD(playTrack, true);
}
}
return;
}
示例7: CDAudio_Init
int CDAudio_Init(void)
{
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
MCI_SET_PARMS mciSetParms;
int n;
if (cls.state == ca_dedicated)
return -1;
if (COM_CheckParm("-nocdaudio"))
return -1;
Cmd_AddCommand ("cd", CD_f);
Cvar_RegisterVariable(&bgmvolume, NULL);
Cvar_RegisterVariable(&bgmtype, NULL);
mciOpenParms.lpstrDeviceType = "cdaudio";
dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (DWORD_PTR) (LPVOID) &mciOpenParms);
if (dwReturn)
{
Con_DPrintf("CDAudio_Init: MCI_OPEN failed (%u)\n", (unsigned int)dwReturn);
return -1;
}
wDeviceID = mciOpenParms.wDeviceID;
// Set the time format to track/minute/second/frame (TMSF).
mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF;
dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR) (LPVOID) &mciSetParms);
if (dwReturn)
{
Con_DPrintf("CDAudio_Init: MCI_SET_TIME_FORMAT failed (%u)\n", (unsigned int)dwReturn);
mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD_PTR)NULL);
return -1;
}
for (n = 0; n < 100; n++)
remap[n] = n;
initialized = true;
enabled = true;
old_cdvolume = bgmvolume.value;
if (CDAudio_GetAudioDiskInfo())
{
Con_Printf("No CD in drive\n");
cdValid = false;
}
#ifdef USE_AUX_API
CD_FindCDAux();
#endif /* USE_AUX_API */
Con_Printf("CD Audio initialized\n");
return 0;
}
示例8: CDAudio_Play
void CDAudio_Play(byte track, qboolean looping)
{
HANDLE playingThread;
char filename[MAX_PATH];
struct ThreadArgList_t *tal;
if (!enabled)
return;
if (!cdValid)
{
CDAudio_GetAudioDiskInfo();
if (!cdValid)
return;
}
track = remap[track];
if (track < 1 || track > maxTrack)
{
Con_DPrintf("CDAudio: Bad track number %u.\n", track);
return;
}
if (playing)
{
if (playTrack == track)
return;
CDAudio_Stop();
}
tal = malloc(sizeof(struct ThreadArgList_t));
tal->playLooping = looping;
tal->playTrack = track;
sprintf(filename, "%s\\Track%03d.ogg", com_gamedir, track);
if (!OpenOGG(filename, tal))
{
sprintf(filename, "%s\\sound\\cdtracks\\Track%03d.ogg", com_gamedir, track);
if (!OpenOGG(filename, tal))
{
Con_DPrintf("CDAudio: Cannot open Vorbis file \"%s\"", filename);
return;
}
}
playLooping = looping;
playTrack = track;
playing = true;
// force volume update
cdvolume = -1;
playingThread = (HANDLE)_beginthreadex(NULL, 0, PlayingThreadProc, tal, CREATE_SUSPENDED, NULL);
SetThreadPriority(playingThread, THREAD_PRIORITY_TIME_CRITICAL);
ResumeThread(playingThread);
}
示例9: I_InitCD
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 ;
}
示例10: I_InitCD
/**************************************************************************
*
* 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
}
示例11: CDAudio_Init
int CDAudio_Init(void)
{
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
MCI_SET_PARMS mciSetParms;
int n;
if (cls.state == ca_dedicated)
{
return -1;
}
if (COM_CheckParm("-nocdaudio"))
{
return -1;
}
mciOpenParms.lpstrDeviceType = "cdaudio";
if (dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (DWORD)(LPVOID) &mciOpenParms))
{
Con_Printf("CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn);
return -1;
}
wDeviceID = mciOpenParms.wDeviceID;
// Set the time format to track/minute/second/frame (TMSF).
mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF;
if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD)(LPVOID) &mciSetParms))
{
Con_Printf("MCI_SET_TIME_FORMAT failed (%i)\n", dwReturn);
mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD)NULL);
return -1;
}
for (n = 0; n < 100; n++)
{
remap[n] = n;
}
initialized = true;
enabled = true;
if (CDAudio_GetAudioDiskInfo())
{
Con_Printf("CDAudio_Init: No CD in player.\n");
cdValid = false;
}
Cmd_AddCommand("cd", CD_f);
Con_Printf("CD Audio Initialized\n");
return 0;
}
示例12: I_PlayCD
void I_PlayCD (UINT8 track, UINT8 looping)
{
#ifdef NOSDLCD
(void)track;
(void)looping;
#else
if (!cdrom || !cdEnabled)
return;
if (!cdValid)
{
CDAudio_GetAudioDiskInfo();
if (!cdValid)
return;
}
track = cdRemap[track];
if (track < 1 || track > maxTrack)
{
CONS_Printf("I_PlayCD: Bad track number %u.\n", track);
return;
}
// don't try to play a non-audio track
if (cdrom->track[track].type == SDL_DATA_TRACK)
{
CONS_Printf("I_PlayCD: track %u is not audio\n", track);
return;
}
if (cdPlaying)
{
if (playTrack == track)
return;
I_StopCD();
}
if (SDL_CDPlayTracks(cdrom, track, 0, 1, 0))
{
CONS_Printf("Error playing track %d: %s\n",
track, SDL_GetError());
return;
}
playLooping = looping;
playTrack = (Uint8)track;
cdPlaying = true;
if (cd_volume.value == 0)
I_PauseCD();
#endif
}
示例13: CDAudio_Init
int
CDAudio_Init (void)
{
int i;
#if 0
if (cls.state == ca_dedicated)
return -1;
#endif
if (COM_CheckParm ("-nocdaudio"))
return -1;
if ((i = COM_CheckParm ("-cddev")) != 0 && i < com_argc - 1) {
strncpy (cd_dev, com_argv[i + 1], sizeof (cd_dev));
cd_dev[sizeof (cd_dev) - 1] = 0;
}
if ((cdfile = open (cd_dev, O_RDONLY | O_NONBLOCK)) == -1) {
Con_Printf ("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev,
errno);
cdfile = -1;
return -1;
}
for (i = 0; i < 100; i++)
remap[i] = i;
initialized = true;
enabled = true;
if (CDAudio_GetAudioDiskInfo ()) {
Con_Printf ("CDAudio_Init: No CD in player.\n");
cdValid = false;
}
Cmd_AddCommand ("cd", CD_f, "Control the CD player.\n"
"Commands:\n"
"eject - Eject the CD.\n"
"info - Reports information on the CD.\n"
"loop (track number) - Loops the specified track.\n"
"remap (track1) (track2) ... - Remap the current track order.\n"
"reset - Causes the CD audio to re-initialize.\n"
"resume - Will resume playback after pause.\n"
"off - Shuts down the CD audio system..\n"
"on - Re-enables the CD audio system after a cd off command.\n"
"pause - Pause the CD playback.\n"
"play (track number) - Plays the specified track one time.\n"
"stop - Stops the currently playing track.");
Con_Printf ("CD Audio Initialized\n");
return 0;
}
示例14: CDAudio_Init
int CDAudio_Init(void)
{
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
MCI_SET_PARMS mciSetParms;
int n;
if (initialized)
return 0;
cd_nocd = Cvar_Get ("cd_nocd", "0", CVAR_ARCHIVE );
cd_loopcount = Cvar_Get ("cd_loopcount", "4", 0);
cd_looptrack = Cvar_Get ("cd_looptrack", "11", 0);
cd_shuffle = Cvar_Get ("cd_shuffle", "0", CVAR_ARCHIVE ); // NeVo
if ( cd_nocd->value)
return -1;
mciOpenParms.lpstrDeviceType = "cdaudio";
if (dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (DWORD) (LPVOID) &mciOpenParms))
{
Com_Printf("CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn);
return -1;
}
wDeviceID = mciOpenParms.wDeviceID;
// Set the time format to track/minute/second/frame (TMSF).
mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF;
if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD)(LPVOID) &mciSetParms))
{
Com_Printf("MCI_SET_TIME_FORMAT failed (%i)\n", dwReturn);
mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD)NULL);
return -1;
}
for (n = 0; n < 100; n++)
remap[n] = n;
initialized = 1;
enabled = 1;
if (CDAudio_GetAudioDiskInfo())
{
// Com_Printf("CDAudio_Init: No CD in player.\n");
cdValid = 0;
enabled = 0;
}
Cmd_AddCommand ("cd", CD_f);
Com_Printf("CD Audio Initialized\n");
return 0;
}
示例15: I_PlayCD
void I_PlayCD(int track, bool looping)
{
if (cdrom == NULL || !enabled)
return;
if (!cdValid)
{
CDAudio_GetAudioDiskInfo();
if (!cdValid)
return;
}
track = cdRemap[track];
if (track < 1 || track > maxTrack)
{
CONS_Printf("I_PlayCD: Bad track number %u.\n", track);
return;
}
// don't try to play a non-audio track
if (cdrom->track[track].type == SDL_DATA_TRACK)
{
CONS_Printf("I_PlayCD: track %i is not audio\n", track);
return;
}
if (playing)
{
if (playTrack == track)
return;
I_StopCD();
}
if (SDL_CDPlayTracks(cdrom, track, 0, 1, 0))
{
CONS_Printf("Error playing track %d: %s\n",
track, SDL_GetError());
return;
}
playLooping = looping;
playTrack = track;
playing = true;
if (cd_volume.value == 0)
{
I_PauseCD();
}
}