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


C++ CDAudio_Play函数代码示例

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


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

示例1: CLQ1_ParseCDTrack

static void CLQ1_ParseCDTrack( QMsg& message ) {
	byte cdtrack = message.ReadByte();
	message.ReadByte();	//	looptrack

	if ( ( clc.demoplaying || clc.demorecording ) && ( cls.qh_forcetrack != -1 ) ) {
		CDAudio_Play( ( byte )cls.qh_forcetrack, true );
	} else {
		CDAudio_Play( cdtrack, true );
	}
}
开发者ID:janisl,项目名称:jlquake,代码行数:10,代码来源:parse.cpp

示例2: CDAudio_SysUpdate

int CDAudio_SysUpdate (void)
{
	struct cdrom_subchnl subchnl;
	static time_t lastchk = 0;

	if (cdPlaying && lastchk < time(NULL) && cdfile != -1)
	{
		lastchk = time(NULL) + 2; //two seconds between chks
		subchnl.cdsc_format = CDROM_MSF;
		if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1)
		{
			Con_Print("ioctl CDROMSUBCHNL failed\n");
			cdPlaying = false;
			return -1;
		}
		if (subchnl.cdsc_audiostatus != CDROM_AUDIO_PLAY &&
			subchnl.cdsc_audiostatus != CDROM_AUDIO_PAUSED)
		{
			cdPlaying = false;
			if (cdPlayLooping)
				CDAudio_Play(cdPlayTrack, true);
		}
		else
			cdPlayTrack = subchnl.cdsc_trk;
	}

	return 0;
}
开发者ID:CyberSys,项目名称:darkplaces,代码行数:28,代码来源:cd_linux.c

示例3: CDAudio_MessageHandler

/*
============
CDAudio_MessageHandler
============
*/
LONG CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if (lParam != wDeviceID)
		return 1;

	switch (wParam)
	{
		case MCI_NOTIFY_SUCCESSFUL:
			if (playing)
			{
				playing = false;
				if (playLooping)
					CDAudio_Play (SRC_COMMAND, playTrack, true);
			}
			break;

		case MCI_NOTIFY_ABORTED:
		case MCI_NOTIFY_SUPERSEDED:
			break;

		case MCI_NOTIFY_FAILURE:
			Con_DPrintf ("MCI_NOTIFY_FAILURE\n");
			CDAudio_Stop (SRC_COMMAND);
			cdValid = false;
			break;

		default:
			Con_DPrintf ("Unexpected MM_MCINOTIFY type (%i)\n", wParam);
			return 1;
	}

	return 0;
}
开发者ID:SpiritQuaddicted,项目名称:reQuiem,代码行数:38,代码来源:cd_win.c

示例4: 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

示例5: BGM_PlayCDtrack

void BGM_PlayCDtrack (byte track, qboolean looping)
{
/* instead of searching by the order of music_handlers, do so by
 * the order of searchpath priority: the file from the searchpath
 * with the highest path_id is most likely from our own gamedir
 * itself. This way, if a mod has track02 as a *.mp3 file, which
 * is below *.ogg in the music_handler order, the mp3 will still
 * have priority over track02.ogg from, say, data1.
 */
	char tmp[MAX_QPATH];
	const char *ext;
	unsigned int path_id, prev_id, type;
	music_handler_t *handler;

	BGM_Stop();
	if (CDAudio_Play(track, looping) == 0)
		return;			/* success */

	if (music_handlers == NULL)
		return;

	if (no_extmusic || !bgm_extmusic.value)
		return;

	prev_id = 0;
	type = 0;
	ext  = NULL;
	handler = music_handlers;
	while (handler)
	{
		if (! handler->is_available)
			goto _next;
		if (! CDRIPTYPE(handler->type))
			goto _next;
		q_snprintf(tmp, sizeof(tmp), "%s/track%02d.%s",
				MUSIC_DIRNAME, (int)track, handler->ext);
		if (! FS_FileExists(tmp, &path_id))
			goto _next;
		if (path_id > prev_id)
		{
			prev_id = path_id;
			type = handler->type;
			ext = handler->ext;
		}
	_next:
		handler = handler->next;
	}
	if (ext == NULL)
		Con_Printf("Couldn't find a cdrip for track %d\n", (int)track);
	else
	{
		q_snprintf(tmp, sizeof(tmp), "%s/track%02d.%s",
				MUSIC_DIRNAME, (int)track, ext);
		bgmstream = S_CodecOpenStreamType(tmp, type);
		if (! bgmstream)
			Con_Printf("Couldn't handle music file %s\n", tmp);
	}
}
开发者ID:JohnnyonFlame,项目名称:gcw0-hexen2,代码行数:58,代码来源:bgmusic.c

示例6: CL_ParseConfigString

/*
================
CL_ParseConfigString
================
*/
void CL_ParseConfigString(void)
{
    int i;
    char * s;

    i = MSG_ReadShort(&net_message);
    if (i < 0 || i >= MAX_CONFIGSTRINGS)
    {
        Com_Error(ERR_DROP, "configstring > MAX_CONFIGSTRINGS");
    }

    s = MSG_ReadString(&net_message);
    strcpy(cl.configstrings[i], s);

    // do something apropriate

    if (i >= CS_LIGHTS && i < CS_LIGHTS + MAX_LIGHTSTYLES)
    {
        CL_SetLightstyle(i - CS_LIGHTS);
    }
    else if (i == CS_CDTRACK)
    {
        if (cl.refresh_prepped)
        {
            CDAudio_Play(atoi(cl.configstrings[CS_CDTRACK]), true);
        }
    }
    else if (i >= CS_MODELS && i < CS_MODELS + MAX_MODELS)
    {
        if (cl.refresh_prepped)
        {
            cl.model_draw[i - CS_MODELS] = re.RegisterModel(cl.configstrings[i]);
            if (cl.configstrings[i][0] == '*')
                cl.model_clip[i - CS_MODELS] = CM_InlineModel(cl.configstrings[i]);
            else
                cl.model_clip[i - CS_MODELS] = NULL;
        }
    }
    else if (i >= CS_SOUNDS && i < CS_SOUNDS + MAX_MODELS)
    {
        if (cl.refresh_prepped)
            cl.sound_precache[i - CS_SOUNDS] = S_RegisterSound(cl.configstrings[i]);
    }
    else if (i >= CS_IMAGES && i < CS_IMAGES + MAX_MODELS)
    {
        if (cl.refresh_prepped)
            cl.image_precache[i - CS_IMAGES] = re.RegisterPic(cl.configstrings[i]);
    }
    else if (i >= CS_PLAYERSKINS && i < CS_PLAYERSKINS + MAX_CLIENTS)
    {
        if (cl.refresh_prepped)
            CL_ParseClientinfo(i - CS_PLAYERSKINS);
    }
}
开发者ID:glampert,项目名称:quake2-for-ps2,代码行数:59,代码来源:cl_parse.c

示例7: CL_PlayBackgroundTrack

void CL_PlayBackgroundTrack (void)
{
	char	name[MAX_QPATH];
	int		track;
	//fileHandle_t	f;

	//BC investigate whether these lines are needed!!
	//if (!cl.refresh_prepped)
	//	return;

	// using a named audio track intead of numbered
	if (strlen(cl.configstrings[CS_CDTRACK]) > 2)
	{
		sprintf(name, va("music/%s.ogg", cl.configstrings[CS_CDTRACK]) );
		if (FS_LoadFile(name, NULL) != -1)
		{
			//BC add looping track.
			//check if the intro name exists. If not, then just use the looping track.
			char	introname[MAX_QPATH];
			sprintf(introname, va("music/%s_intro.ogg", cl.configstrings[CS_CDTRACK]) );
			if (FS_LoadFile(introname, NULL) <= -1)
				strcpy (introname, name);

			CDAudio_Stop();
			S_StartBackgroundTrack(introname, name);
			return;
		}
	}

	track = atoi(cl.configstrings[CS_CDTRACK]);

	if (track == 0)
	{	// Stop any playing track
		CDAudio_Stop();
		S_StopBackgroundTrack();
		return;
	}

	// If an OGG file exists play it, otherwise fall back to CD audio
	sprintf(name, va("music/track%02i.ogg", CL_MissionPackCDTrack(track)) );
	if ( (FS_LoadFile(name, NULL) != -1) && cl_ogg_music->value )
	{
		S_StartBackgroundTrack(name, name);
	}
	else
	{
		CDAudio_Play(track, true);
	}
}
开发者ID:AimHere,项目名称:thirty-flights-of-linux,代码行数:49,代码来源:cl_parse.c

示例8: CL_PlayBackgroundTrack

void CL_PlayBackgroundTrack(void)
{
	char	name[MAX_QPATH];
	int		track;

	Com_DPrintf("CL_PlayBackgroundTrack\n");	// debug

	if (!cl.refresh_prepped)
		return;

	// using a named audio track intead of numbered
	if (strlen(cl.configstrings[CS_CDTRACK]) > 2)
	{
		Com_sprintf(name, sizeof(name), "music/%s.ogg", cl.configstrings[CS_CDTRACK]);
		if (FS_LoadFile(name, NULL) != -1)
		{
#ifdef CD_AUDIO
			CDAudio_Stop();
#endif
			S_StartBackgroundTrack(name, name);
			return;
		}
	}

	track = atoi(cl.configstrings[CS_CDTRACK]);

	if (track == 0)
	{	// Stop any playing track
		Com_DPrintf("CL_PlayBackgroundTrack: stopping\n");	// debug
#ifdef CD_AUDIO
		CDAudio_Stop();
#endif
		S_StopBackgroundTrack();
		return;
	}

	// If an OGG file exists play it, otherwise fall back to CD audio
	Com_sprintf(name, sizeof(name), "music/track%02i.ogg", CL_MissionPackCDTrack(track));
	if ((FS_LoadFile(name, NULL) != -1) && cl_ogg_music->value) {
		Com_DPrintf("CL_PlayBackgroundTrack: playing track %s\n", name);	// debug
		S_StartBackgroundTrack(name, name);
	}
#ifdef CD_AUDIO
	else
		CDAudio_Play(track, true);
#endif
}
开发者ID:qbism,项目名称:qbq2,代码行数:47,代码来源:cl_parse.c

示例9: CDAudio_Update

void
CDAudio_Update(void)
{
    static time_t lastchk;

    if (!enabled)
	return;

    if (playing && lastchk < time(NULL)) {
	lastchk = time(NULL) + 2;	//two seconds between chks
	if (!CDDrv_IsPlaying(playTrack)) {
	    playing = false;
	    if (playLooping)
		CDAudio_Play(playTrack, true);
	}
    }
}
开发者ID:AidHamza,项目名称:eviltoys,代码行数:17,代码来源:cd_common.c

示例10: CDAudio_Update

void
CDAudio_Update ()
{
	static int cnt = 0;

	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;
	}

	/* this causes too much overhead to be executed every frame */
	if ( ++cnt == 16 )
	{
		cnt = 0;

		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:Nekrofage,项目名称:Quake2RPi,代码行数:46,代码来源:cd.c

示例11: DoDeathSpecial

int DoDeathSpecial(short SpriteNum)
{
    SPRITEp sp = &sprite[SpriteNum];
    USERp u = User[SpriteNum];
    static BOOL alreadydid = FALSE;
    
    DoMatchEverything(NULL, sp->lotag, ON);

    #ifndef SW_SHAREWARE
    if(gs.MusicOn && !alreadydid)
        {
        CDAudio_Stop();
        CDAudio_Play(RedBookSong[Level], TRUE);
        alreadydid = TRUE;
        }
    #endif

    BossSpriteNum[0] = -2;    
    return(0);
}    
开发者ID:dos-games,项目名称:vanilla-shadow_warrior,代码行数:20,代码来源:serp.c

示例12: CDAudio_Update

void CDAudio_Update(void)
{
    struct ioc_read_subchannel subchnl;
    struct cd_sub_channel_info data;
    static time_t lastchk;

    if (cdfile == -1 || !enabled)
        return;

    if (old_cdvolume != bgmvolume.value)
        CDAudio_SetVolume (&bgmvolume);

    if (playing && lastchk < time(NULL))
    {
        lastchk = time(NULL) + 2; //two seconds between chks

        memset (&subchnl, 0, sizeof(subchnl));
        subchnl.data = &data;
        subchnl.data_len = sizeof(data);
        subchnl.address_format = CD_MSF_FORMAT;
        subchnl.data_format = CD_CURRENT_POSITION;
        subchnl.track = playTrack;
        if (ioctl(cdfile, CDIOCREADSUBCHANNEL, &subchnl) == -1 )
        {
            IOCTL_FAILURE(CDIOCREADSUBCHANNEL);
            playing = false;
            return;
        }
        if (data.header.audio_status != CD_AS_PLAY_IN_PROGRESS &&
                data.header.audio_status != CD_AS_PLAY_PAUSED)
        {
            playing = false;
            if (playLooping)
                CDAudio_Play(playTrack, true);
        }
        else
        {
            playTrack = data.what.position.track_number;
        }
    }
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:41,代码来源:cd_bsd.c

示例13: CDAudio_Update

void CDAudio_Update(void)
{
	struct cdrom_subchnl subchnl;
	static time_t lastchk;

	if (!enabled)
		return;

	if (bgmvolume.value != cdvolume)
	{
		if (cdvolume)
		{
			Cvar_SetValue ("bgmvolume", 0.0);
			cdvolume = bgmvolume.value;
			CDAudio_Pause ();
		}
		else
		{
			Cvar_SetValue ("bgmvolume", 1.0);
			cdvolume = bgmvolume.value;
			CDAudio_Resume ();
		}
	}

	if (playing && lastchk < time(NULL)) {
		lastchk = time(NULL) + 2; //two seconds between chks
		subchnl.cdsc_format = CDROM_MSF;
		if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1 ) {
			Con_DPrintf("ioctl cdromsubchnl failed\n");
			playing = false;
			return;
		}
		if (subchnl.cdsc_audiostatus != CDROM_AUDIO_PLAY &&
			subchnl.cdsc_audiostatus != CDROM_AUDIO_PAUSED) {
			playing = false;
			if (playLooping)
				CDAudio_Play(playTrack, true);
		}
	}
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:40,代码来源:cd_linux.c

示例14: CDA_Start

void CDA_Start (int track, qboolean loop, qboolean notify)
{
#ifdef UQE_FMOD_CDAUDIO

	if (SND_InitialisedCD == false)
		return;

	if(SND_MusicChannel.inuse == true)
		FMOD_MusicStop();

	if(loop == true)
	{
		SND_MusicChannel.looping = true;
		result = FMOD_Sound_SetMode(fmod_musicCD, FMOD_LOOP_NORMAL);
		FMOD_ERROR(result, true, false);
	}
	else
	{
		SND_MusicChannel.looping = false;
		result = FMOD_Sound_SetMode(fmod_musicCD, FMOD_LOOP_OFF);
		FMOD_ERROR(result, true, false);
	}

	// fmod track numbers starts at zero
	result = FMOD_Sound_GetSubSound(fmod_musicCD, track-1, &fmod_musicCD_subsound);
	FMOD_ERROR(result, notify, false);

	result = FMOD_System_GetChannel(fmod_system, 0, &SND_MusicChannel.channel);
	FMOD_ERROR(result, true, false);

	result = FMOD_System_PlaySound(fmod_system, FMOD_CHANNEL_REUSE, fmod_musicCD_subsound, FALSE, &SND_MusicChannel.channel);
    FMOD_ERROR(result, notify, false);


	SND_MusicChannel.inuse = true;

#else
	CDAudio_Play((byte)track, loop);
#endif
}
开发者ID:infernuslord,项目名称:uqe-quake,代码行数:40,代码来源:snd_fmod.c

示例15: CDAudio_Update

void CDAudio_Update()
{
	if(!cd_id || !enabled) return;
	if(bgmvolume.value != cdvolume)
	{
		if(cdvolume)
		{
			Cvar_SetValue("bgmvolume",0.0);
			CDAudio_Pause();
		}
		else
		{
			Cvar_SetValue("bgmvolume",1.0);
			CDAudio_Resume();
		}
		cdvolume = bgmvolume.value;
		return;
	}
	if(playLooping && (SDL_CDStatus(cd_id) != CD_PLAYING)
		 && (SDL_CDStatus(cd_id) != CD_PAUSED))
		CDAudio_Play(cd_id->cur_track+1,true);
}
开发者ID:davemichael,项目名称:NaCl-Quake,代码行数:22,代码来源:cd_sdl.c


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