當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。