Esempio n. 1
0
void cdAudio_Stop()
{
	stopping = true;
	debug(LOG_SOUND, "called, cdStream=%p", static_cast<void *>(cdStream));

	if (cdStream)
	{
		sound_StopStream(cdStream);
		cdStream = nullptr;
		sound_Update();
	}
}
Esempio n. 2
0
void cdAudio_Stop()
{
	stopping = true;
	debug(LOG_SOUND, "called, cdStream=%p", cdStream);

	if (cdStream)
	{
		sound_StopStream(cdStream);
		cdStream = NULL;
		sound_Update();
	}
}
Esempio n. 3
0
void cdAudio_Stop()
{
#if !defined(WZ_NOSOUND)
	stopping = true;
	debug(LOG_SOUND, "called, cdStream=%p", cdStream);

	if (cdStream)
	{
		sound_StopStream(cdStream);
		cdStream = NULL;
		sound_Update();
	}
#else
	debug(LOG_SOUND, "called");
#endif
}
Esempio n. 4
0
void sound_ShutdownLibrary( void )
{
#if !defined(WZ_NOSOUND)
	AUDIO_STREAM* stream;
#endif
	SAMPLE_LIST * aSample = active_samples, * tmpSample = NULL;

	if ( !openal_initialized )
	{
		return;
	}
	debug(LOG_SOUND, "starting shutdown");

#if !defined(WZ_NOSOUND)
	// Stop all streams, sound_UpdateStreams() will deallocate all stopped streams
	for (stream = active_streams; stream != NULL; stream = stream->next)
	{
		sound_StopStream(stream);
	}
	sound_UpdateStreams();
	
	alcGetError(device);	// clear error codes

	/* On Linux since this caused some versions of OpenAL to hang on exit. - Per */
	debug(LOG_SOUND, "make default context NULL");
	alcMakeContextCurrent(NULL);
	sound_GetContextError(device);

	debug(LOG_SOUND, "destroy previous context");
	alcDestroyContext(context); // this gives a long delay on some impl.
	sound_GetContextError(device);

	debug(LOG_SOUND, "close device");
	if (alcCloseDevice(device) == ALC_FALSE)
	{
		debug(LOG_SOUND, "OpenAl could not close the audio device." ); 
	}
#endif

	while( aSample )
	{
		tmpSample = aSample->next;
		free( aSample );
		aSample = tmpSample;
	}
	active_samples = NULL;
}
Esempio n. 5
0
/*
deal with the actual button press - proxMsg is set to true if a proximity
button has been pressed
*/
void intIntelButtonPressed(BOOL proxMsg, UDWORD id)
{
	MESSAGE			*psMessage;
	UDWORD			currID;//, i;
	RESEARCH		*psResearch;

	ASSERT( proxMsg != true,
		"intIntelButtonPressed: Shouldn't be able to get a proximity message!" );

	if(id == 0)
	{
		intRemoveIntelMap();
		return;
	}

	/* message button has been pressed - clear the old button and messageView*/
	if (messageID != 0)
	{
		widgSetButtonState(psWScreen, messageID, 0);
		intRemoveMessageView(false);
		psCurrentMsg = NULL;
	}

	/* Lock the new button */
	// This means we can't click on the same movie button twice.
	widgSetButtonState(psWScreen, id, WBUT_CLICKLOCK);
	messageID = id;

	//Find the message for the new button */
	currID = IDINTMAP_MSGSTART;
	for(psMessage = apsMessages[selectedPlayer]; psMessage; psMessage =
		psMessage->psNext)
	{
		if (psMessage->type != MSG_PROXIMITY)
		{
			if (currID == id)
			{
				break;
			}
			currID++;
		}
	}

	//deal with the message if one
	if (psMessage)
	{
		//set the current message
		psCurrentMsg = psMessage;

		//set the read flag
		psCurrentMsg->read = true;

		debug(LOG_GUI, "intIntelButtonPressed: Dealing with a new message type=%d",
		      psMessage->type);

		//should never have a proximity message
		if (psMessage->type == MSG_PROXIMITY)
		{
			return;
		}
		// If its a video sequence then play it anyway
		if (((VIEWDATA *)psMessage->pViewData)->type == VIEW_RPL)
		{

			if (psMessage->pViewData)
			{
				intAddMessageView(psMessage);
			}

			StartMessageSequences(psMessage,true);

		}
		else if (((VIEWDATA *)psMessage->pViewData)->type == VIEW_RES)
		{
			psResearch = getResearchForMsg((VIEWDATA *)psMessage->pViewData);
			if (psResearch != NULL)
			{
				static const float maxVolume = 1.f;
				static AUDIO_STREAM *playing = NULL;

				// only play the sample once, otherwise, they tend to overlap each other
				if (sound_isStreamPlaying(playing))
				{
					sound_StopStream(playing);
				}

				switch(psResearch->iconID)
				{
				case IMAGE_RES_DROIDTECH:
					playing = audio_PlayStream("sequenceaudio/res_droid.ogg", maxVolume, NULL, NULL);
						break;
				case IMAGE_RES_WEAPONTECH:
					playing = audio_PlayStream("sequenceaudio/res_weapons.ogg", maxVolume, NULL, NULL);
						break;
				case IMAGE_RES_COMPUTERTECH:
					playing = audio_PlayStream("sequenceaudio/res_com.ogg", maxVolume, NULL, NULL);
						break;
				case IMAGE_RES_POWERTECH:
					playing = audio_PlayStream("sequenceaudio/res_pow.ogg", maxVolume, NULL, NULL);
						break;
				case IMAGE_RES_SYSTEMTECH:
					playing = audio_PlayStream("sequenceaudio/res_systech.ogg", maxVolume, NULL, NULL);
						break;
				case IMAGE_RES_STRUCTURETECH:
					playing = audio_PlayStream("sequenceaudio/res_strutech.ogg", maxVolume, NULL, NULL);
						break;
				case IMAGE_RES_CYBORGTECH:
					playing = audio_PlayStream("sequenceaudio/res_droid.ogg", maxVolume, NULL, NULL);
						break;
				case IMAGE_RES_DEFENCE:
					playing = audio_PlayStream("sequenceaudio/res_strutech.ogg", maxVolume, NULL, NULL);
						break;
				}
			}

			//and finally for the dumb?
			if (psMessage->pViewData)
			{
				intAddMessageView(psMessage);
			}
		}
	}
}