/*
=================
S_StartBackgroundTrack
=================
*/
void S_StartBackgroundTrack (const char *introTrack, const char *loopTrack)
{
	if (!ogg_started) // was sound_started
		return;

	// Stop any playing tracks
	S_StopBackgroundTrack();

	// Start it up
//	Q_strncpyz(s_bgTrack.introName, introTrack, sizeof(s_bgTrack.introName));
//	Q_strncpyz(s_bgTrack.loopName, loopTrack, sizeof(s_bgTrack.loopName));
//	Q_strncpyz(s_bgTrack.ambientName, va("music/%s.ogg", ogg_ambient_track->string), sizeof(s_bgTrack.ambientName));
	Com_strcpy(s_bgTrack.introName, sizeof(s_bgTrack.introName), introTrack);
	Com_strcpy(s_bgTrack.loopName, sizeof(s_bgTrack.loopName), loopTrack);
	Com_strcpy(s_bgTrack.ambientName, sizeof(s_bgTrack.ambientName), va("music/%s.ogg", ogg_ambient_track->string));

	// set a loop counter so that this track will change to the ambient track later
	ogg_loopcounter = 0;
//	Cvar_ForceSet ("ogg_loopcount", va("%i", Cvar_VariableValue("cd_loopcount")-1));

	S_StartStreaming();

	// Open the intro track
	if (!S_OpenBackgroundTrack(s_bgTrack.introName, &s_bgTrack))
	{
		S_StopBackgroundTrack();
		return;
	}

	ogg_status = PLAY;

	S_StreamBackgroundTrack();
}
Example #2
0
/*
=================
S_StartBackgroundTrack
=================
*/
void S_StartBackgroundTrack (const char *introTrack, const char *loopTrack)
{
	extern void	Q_strncpyz (char *dst, const char *src, int dstSize);

	if (!ogg_started)
		return;

	// stop any playing tracks
	S_StopBackgroundTrack();

	// start it up
	Q_strncpyz(s_bgTrack.introName, introTrack, sizeof(s_bgTrack.introName));
	Q_strncpyz(s_bgTrack.loopName, loopTrack, sizeof(s_bgTrack.loopName));
	Q_strncpyz(s_bgTrack.ambientName, va("music/%s.ogg", ogg_ambient_track->string), sizeof(s_bgTrack.ambientName));

	// set a loop counter so that this track will change to the ambient track later
	ogg_loopcounter = 0;

	S_StartStreaming();

	// open the intro track
	if (!S_OpenBackgroundTrack(s_bgTrack.introName, &s_bgTrack))
	{
		S_StopBackgroundTrack();
		return;
	}

	ogg_status = PLAY;

	S_StreamBackgroundTrack();
}
/*
============
S_UpdateBackgroundTrack

Streams background track
============
*/
void S_UpdateBackgroundTrack (void)
{
	// stop music if paused
	if (ogg_status == PLAY)// && !cl_paused->value)
		S_StreamBackgroundTrack ();
}