当前位置: 首页>>代码示例>>C++>>正文


C++ SDL_CDStatus函数代码示例

本文整理汇总了C++中SDL_CDStatus函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_CDStatus函数的具体用法?C++ SDL_CDStatus怎么用?C++ SDL_CDStatus使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SDL_CDStatus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: strcpy

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; 
};
开发者ID:BackupTheBerlios,项目名称:smarterdata-svn,代码行数:26,代码来源:cdrom.cpp

示例2: FRAMES_TO_MSF

bool CDROM_Interface_SDL::GetAudioTrackInfo(int track, TMSF& start, unsigned char& attr) {
    if (CD_INDRIVE(SDL_CDStatus(cd))) {
        FRAMES_TO_MSF(cd->track[track-1].offset,&start.min,&start.sec,&start.fr);
        attr	= cd->track[track-1].type<<4;//sdl uses 0 for audio and 4 for data. instead of 0x00 and 0x40
    }
    return CD_INDRIVE(SDL_CDStatus(cd));
}
开发者ID:nrich,项目名称:dosbox-vnc,代码行数:7,代码来源:cdrom.cpp

示例3: CDAudio_Update

void CDAudio_Update()
{
	if(!cd_id || !enabled) return;
	if(cd_volume && cd_volume->value != cdvolume)
	{
		if(cdvolume)
		{
			Cvar_SetValue("cd_volume",0.0);
			CDAudio_Pause();
		}
		else
		{
			Cvar_SetValue("cd_volume",1.0);
			CDAudio_Resume();
		}
		cdvolume = cd_volume->value;
		return;
	}
	
	if(cd_nocd->value)
	{
		CDAudio_Stop();
		return;
	}
	
	if(playLooping && 
	   (SDL_CDStatus(cd_id) != CD_PLAYING) && 
	   (SDL_CDStatus(cd_id) != CD_PAUSED))
	{
		CDAudio_Play(lastTrack,true);
	}
}
开发者ID:AJenbo,项目名称:Quake-2,代码行数:32,代码来源:cd_sdl.c

示例4: CD_INDRIVE

bool CDROM_Interface_SDL::GetAudioStatus(bool& playing, bool& pause) {
    if (CD_INDRIVE(SDL_CDStatus(cd))) {
        playing = (cd->status==CD_PLAYING);
        pause	= (cd->status==CD_PAUSED);
    }
    return CD_INDRIVE(SDL_CDStatus(cd));
}
开发者ID:nrich,项目名称:dosbox-vnc,代码行数:7,代码来源:cdrom.cpp

示例5: FRAMES_TO_MSF

bool CDROM_Interface_SDL::GetAudioTrackInfo (int track, TMSF& start, unsigned char& attr)
{
	if (CD_INDRIVE(SDL_CDStatus(cd))) {
		FRAMES_TO_MSF(cd->track[track-1].offset+150,&start.min,&start.sec,&start.fr);
		attr	= cd->track[track-1].type;
	}
	return CD_INDRIVE(SDL_CDStatus(cd));	
};
开发者ID:BackupTheBerlios,项目名称:smarterdata-svn,代码行数:8,代码来源:cdrom.cpp

示例6: SDL_CDStatus

bool CDROM_Interface_SDL::GetMediaTrayStatus(bool& mediaPresent, bool& mediaChanged, bool& trayOpen) {
    SDL_CDStatus(cd);
    mediaPresent = (cd->status!=CD_TRAYEMPTY) && (cd->status!=CD_ERROR);
    mediaChanged = (oldLeadOut!=cd->track[cd->numtracks].offset);
    trayOpen	 = !mediaPresent;
    oldLeadOut	 = cd->track[cd->numtracks].offset;
    if (mediaChanged) SDL_CDStatus(cd);
    return true;
}
开发者ID:nrich,项目名称:dosbox-vnc,代码行数:9,代码来源:cdrom.cpp

示例7: RBAPeekPlayStatus

int RBAPeekPlayStatus()
{
	if (!s_cd)
		return 0;

	if (SDL_CDStatus(s_cd) == CD_PLAYING)
		return 1;
	else if (SDL_CDStatus(s_cd) == CD_PAUSED)	// hack so it doesn't keep restarting paused music
		return -1;
	
	return 0;
}
开发者ID:Foran,项目名称:dxx-rebirth,代码行数:12,代码来源:rbaudio.cpp

示例8: RBAPauseResume

int RBAPauseResume()
{
	if (!s_cd) return 0;

	if (SDL_CDStatus(s_cd) == CD_PLAYING)
		SDL_CDPause(s_cd);
	else if (SDL_CDStatus(s_cd) == CD_PAUSED)
		SDL_CDResume(s_cd);
	else
		return 0;

	return 1;
}
开发者ID:Foran,项目名称:dxx-rebirth,代码行数:13,代码来源:rbaudio.cpp

示例9: CDAudio_Init

int CDAudio_Init()
{
	if((cls.state == ca_dedicated) || COM_CheckParm("-nocdaudio"))
		return -1;
		
	cd_id = SDL_CDOpen(0);
	if(!cd_id)
	{
		Con_Printf("CDAudio_Init: Unable to open default CD-ROM drive: %s\n",
			SDL_GetError());
		return -1;
	}
	
	initialized = true;
	enabled = true;
	cdValid = true;
	
	if(!CD_INDRIVE(SDL_CDStatus(cd_id)))
	{
		Con_Printf("CDAudio_Init: No CD in drive.\n");
		cdValid = false;
	}
	if(!cd_id->numtracks)
	{
		Con_Printf("CDAudio_Init: CD contains no audio tracks.\n");
		cdValid = false;
	}
	Cmd_AddCommand("cd",CD_f);
	Con_Printf("CD Audio Initialized.\n");
	return 0;
}
开发者ID:davemichael,项目名称:NaCl-Quake,代码行数:31,代码来源:cd_sdl.c

示例10: CDAudio_GetAudioDiskInfo

/**************************************************************************
 *
 * function: CDAudio_GetAudioDiskInfo
 *
 * description:
 * set number of tracks if CD is available
 *
 **************************************************************************/
static INT32 CDAudio_GetAudioDiskInfo(void)
{
	cdValid = SDL_FALSE;
	maxTrack = 0;

	if (!cdrom)
		return 0;//Alam: Lies!

	cdStatus = SDL_CDStatus(cdrom);

	if (!CD_INDRIVE(cdStatus))
	{
		CONS_Printf("%s", M_GetText("No CD in drive\n"));
		return -1;
	}

	if (cdStatus == CD_ERROR)
	{
		CONS_Printf(M_GetText("CD Error: %s\n"), SDL_GetError());
		return -1;
	}

	cdValid = SDL_TRUE;
	maxTrack = (Uint8)cdrom->numtracks;

	return 0;
}
开发者ID:ZilverXZX,项目名称:SRB2,代码行数:35,代码来源:i_cdmus.c

示例11: SDL_CDStatus

bool SdlAudioCDManager::play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate) {
	// Prefer emulation
	if (DefaultAudioCDManager::play(track, numLoops, startFrame, duration, onlyEmulate))
		return true;

	// If we're set to only emulate, or have no CD, return here
	if (onlyEmulate || !_cdrom)
		return false;

	if (!numLoops && !startFrame)
		return false;

	// FIXME: Explain this.
	if (duration > 0)
		duration += 5;

	_cdTrack = track;
	_cdNumLoops = numLoops;
	_cdStartFrame = startFrame;

	SDL_CDStatus(_cdrom);
	if (startFrame == 0 && duration == 0)
		SDL_CDPlayTracks(_cdrom, track, 0, 1, 0);
	else
		SDL_CDPlayTracks(_cdrom, track, startFrame, 0, duration);
	_cdDuration = duration;
	_cdStopTime = 0;
	_cdEndTime = SDL_GetTicks() + _cdrom->track[track].length * 1000 / CD_FPS;

	return true;
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:31,代码来源:sdl-audiocd.cpp

示例12: cd_get_track_length

static PyObject*
cd_get_track_length (PyObject* self, PyObject* args)
{
    int cd_id = PyCD_AsID (self);
    SDL_CD* cdrom = cdrom_drivedata[cd_id];
    int track;

    if (!PyArg_ParseTuple (args, "i", &track)) {
        return NULL;
    }

    CDROM_INIT_CHECK ();
    if (!cdrom) {
        return RAISE (PyExc_SDLError, "CD drive not initialized");
    }
    SDL_CDStatus (cdrom);
    if (track < 0 || track >= cdrom->numtracks) {
        return RAISE (PyExc_IndexError, "Invalid track number");
    }
    if (cdrom->track[track].type != SDL_AUDIO_TRACK) {
        return PyFloat_FromDouble (0.0);
    }

    return PyFloat_FromDouble (cdrom->track[track].length / (double) CD_FPS);
}
开发者ID:IuryAlves,项目名称:pygame,代码行数:25,代码来源:cdrom.c

示例13: RBAInit

void RBAInit()
{
	int num_cds;
	int i,j;
	
	if (initialised) return;

	if (SDL_Init(SDL_INIT_CDROM) < 0)
	{
		Warning("SDL library initialisation failed: %s.",SDL_GetError());
		return;
	}

	num_cds = SDL_CDNumDrives();
	if (num_cds < 1)
	{
		con_printf(CON_NORMAL, "No cdrom drives found!\n");
#if defined(__APPLE__) || defined(macintosh)
		SDL_QuitSubSystem(SDL_INIT_CDROM);	// necessary for rescanning CDROMs
#endif
		return;
	}
	
	for (i = 0; i < num_cds; i++)
	{
		if (s_cd)
			SDL_CDClose(s_cd);
		s_cd = SDL_CDOpen(i);
		
		if (s_cd && CD_INDRIVE(SDL_CDStatus(s_cd)))
		{
			for (j = 0; j < s_cd->numtracks; j++)
			{
				if (s_cd->track[j].type == SDL_AUDIO_TRACK)
					break;
			}
			
			if (j != s_cd->numtracks)
				break;	// we've found an audio CD
		}
		else if (s_cd == NULL)
			Warning("Could not open cdrom %i for redbook audio:%s\n", i, SDL_GetError());
	}
	
	if (i == num_cds)
	{
		con_printf(CON_NORMAL, "No audio CDs found\n");
		if (s_cd)	// if there's no audio CD, say that there's no redbook and hence play MIDI instead
		{
			SDL_CDClose(s_cd);
			s_cd = NULL;
		}
#if defined(__APPLE__) || defined(macintosh)
		SDL_QuitSubSystem(SDL_INIT_CDROM);	// necessary for rescanning CDROMs
#endif
		return;
	}
	
	initialised = 1;
}
开发者ID:Foran,项目名称:dxx-rebirth,代码行数:60,代码来源:rbaudio.cpp

示例14: RBAGetNumberOfTracks

int RBAGetNumberOfTracks()
{
	if (!initialised) 
		return -1;
	SDL_CDStatus(s_cd);
	return s_cd->numtracks;
}
开发者ID:paud,项目名称:d2x-xl,代码行数:7,代码来源:rbaudio.c

示例15: cd_playtoggle

void cd_playtoggle()
{
//added on 01/03/99 by Matt Mueller
  if (nocdaudio) return;
//end addition -MM

#ifdef __DJGPP__
  if(bcd_now_playing())
#elif defined __SDL__
  if(SDL_CDStatus(cdrom)==CD_PLAYING)
#else
  if(0)
#endif
   {
     cd_stop();
     cd_playing=0;
   }
  else if(!cd_used)
   {
     cd_currenttrack = 0;
     cd_playtrack(cd_currenttrack);
   }
  else
   {
     cd_resume();
   }
 cd_used = 1;
}
开发者ID:Ringdingcoder,项目名称:d1x,代码行数:28,代码来源:cdplay.c


注:本文中的SDL_CDStatus函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。