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


C++ CDAudio_Stop函数代码示例

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


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

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

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

示例3: CDAudio_Play

void CDAudio_Play(byte track, bool looping)
{
	CDAudio_Stop();
	char fname[256];
	sprintf (fname, "%s/%s/cdtracks/track", host_parms.basedir, (mod_path == NULL) ? GAMENAME_DIR : mod_path);
	if (track < 100){
		sprintf(fname, "%s0", fname);
		if (track < 10){
			sprintf(fname, "%s0", fname);
		}
	}
	sprintf(fname,"%s%d",fname,track);
	char tmp[256];
	sprintf(tmp,"%s.ogg",fname);
		
	FILE* fd = fopen(tmp,"rb");
	if (fd == NULL){
		sprintf(tmp,"%s.mp3",fname);
		FILE* fd = fopen(tmp,"rb");
	}
	if (fd == NULL) return;
	DecodedMusic* memblock = (DecodedMusic*)malloc(sizeof(DecodedMusic));
	memblock->handle = fd;
	memblock->pauseTrigger = false;
	memblock->closeTrigger = false;
	memblock->isPlaying = true;
	memblock->loop = looping;
	BGM = memblock;
	sceKernelSignalSema(Audio_Mutex, 1);
}
开发者ID:Rinnegatamante,项目名称:vitaQuake,代码行数:30,代码来源:cd_psp2.cpp

示例4: CDA_Stop

void CDA_Stop (void)
{
#ifdef UQE_FMOD_CDAUDIO

	if(SND_InitialisedCD == false || SND_MusicChannel.inuse == false)
		return;

	if(SND_MusicChannel.channel)
	{
		result = FMOD_Channel_Stop(SND_MusicChannel.channel);
		FMOD_ERROR(result, true, false);
	}

	if(fmod_musicCD_subsound)
	{
		result = FMOD_Sound_Release(fmod_musicCD_subsound);
		FMOD_ERROR(result, true, false);
	}

	if(fmod_musicCD)
	{
		result = FMOD_Sound_Release(fmod_musicCD);
		FMOD_ERROR(result, true, false);
	}

	SND_MusicChannel.inuse = false;

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

示例5: CDAudio_Play

void CDAudio_Play(byte track, qboolean looping)
{
	CDstatus cd_stat;
	if(!cd_id || !enabled) return;
	
	if(!cdValid)
	{
		if(!CD_INDRIVE(cd_stat=SDL_CDStatus(cd_id)) ||(!cd_id->numtracks)) return;
		cdValid = true;
	}

	if((track < 1) || (track >= cd_id->numtracks))
	{
		Con_DPrintf("CDAudio: Bad track number: %d\n",track);
		return;
	}
	track--; /* Convert track from person to SDL value */
	if(cd_stat == CD_PLAYING)
	{
		if(cd_id->cur_track == track) return;
		CDAudio_Stop();
	}

	if(SDL_CDPlay(cd_id,cd_id->track[track].offset,
			  cd_id->track[track].length))
	{
		Con_DPrintf("CDAudio_Play: Unable to play track: %d\n",track+1);
		return;
	}
	playLooping = looping;
}
开发者ID:davemichael,项目名称:NaCl-Quake,代码行数:31,代码来源:cd_sdl.c

示例6: CDAudio_Shutdown

void CDAudio_Shutdown()
{
	if(!cd_id) return;
	CDAudio_Stop();
	SDL_CDClose(cd_id);
	cd_id = NULL;
}
开发者ID:davemichael,项目名称:NaCl-Quake,代码行数:7,代码来源:cd_sdl.c

示例7: CDAudio_Shutdown

void CDAudio_Shutdown(void)
{
	if (!initialized)
		return;
	free(trackData);
	CDAudio_Stop();
}
开发者ID:Izhido,项目名称:qrevpak,代码行数:7,代码来源:cd_revol.c

示例8: CDAudio_Shutdown

void CDAudio_Shutdown(void)
{
	if (!initialized)
		return;
	CDAudio_Stop();
	CDAudio_WaitForFinish();
	
	if (pDSBufCDNotify)
	{
		pDSBufCDNotify->lpVtbl->Release(pDSBufCDNotify);
		pDSBufCDNotify = NULL;
	}
	if (pDSBufCD)
	{
		pDSBufCD->lpVtbl->Stop(pDSBufCD);
		pDSBufCD->lpVtbl->Release(pDSBufCD);
		pDSBufCD = NULL;
	}
	if (cdPlayingFinishedEvent)
	{
		CloseHandle(cdPlayingFinishedEvent);
		cdPlayingFinishedEvent = NULL;
	}
	if (cdStopEvent)
	{
		CloseHandle(cdStopEvent);
		cdStopEvent = NULL;
	}
}
开发者ID:Azarien,项目名称:SoftQuake,代码行数:29,代码来源:cd_win.c

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

示例10: SCR_BeginLoadingPlaque

/*
===============
SCR_BeginLoadingPlaque

================
*/
void SCR_BeginLoadingPlaque (void)
{
	S_StopAllSounds (true);

	CDAudio_Stop (); // Stop the CD music

	if (cls.state != ca_connected)
		return;
	if (cls.signon != SIGNONS)
		return;
	
// redraw with no console and the loading plaque
	Con_ClearNotify ();
	// remove all center prints
	con_lastcenterstring[0] = 0;
	scr_centerstring[0] = 0;
	scr_centertime_off = 0;
	scr_con_current = 0;

	scr_drawloading = true;
	Sbar_Changed ();
	SCR_UpdateScreen ();
	scr_drawloading = false;

	scr_disabled_for_loading = true;
	scr_disabled_time = realtime;
	SCR_SetTimeout (SCR_DEFTIMEOUT);
}
开发者ID:twinaphex,项目名称:fxquake,代码行数:34,代码来源:gl_screen.c

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

示例12: CDAudio_Shutdown

void CDAudio_Shutdown(void)
{
	if (!initialized)
		return;
	CDAudio_Stop();
	if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL))
		Com_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
}
开发者ID:Izhido,项目名称:qrevpak,代码行数:8,代码来源:cd_win.c

示例13: CDAudio_Shutdown

void CDAudio_Shutdown(void)
{
	if (!initialized)
		return;
	CDAudio_Stop();
	close(cdfile);
	cdfile = -1;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:8,代码来源:cd_linux.c

示例14: CDAudio_Shutdown

void
CDAudio_Shutdown(void)
{
    if (!initialized)
	return;
    CDAudio_Stop();
    CDDrv_CloseDevice();
    initialized = false;
}
开发者ID:AidHamza,项目名称:eviltoys,代码行数:9,代码来源:cd_common.c

示例15: 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);
}
开发者ID:Azarien,项目名称:SoftQuake,代码行数:57,代码来源:cd_win.c


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