Exemple #1
0
Imuse::~Imuse() {
	g_system->getTimerManager()->removeTimerProc(timerHandler);
	stopAllSounds();
	for (int l = 0; l < MAX_IMUSE_TRACKS + MAX_IMUSE_FADETRACKS; l++) {
		delete _track[l];
	}
	delete _sound;
}
Exemple #2
0
Player_AD::~Player_AD() {
	_mixer->stopHandle(_soundHandle);

	stopAllSounds();
	Common::StackLock lock(_mutex);
	delete _opl2;
	_opl2 = 0;
}
Exemple #3
0
void Player_Mac::stopSound(int nr) {
	Common::StackLock lock(_mutex);
	debug(5, "Player_Mac::stopSound(%d)", nr);

	if (nr == _soundPlaying) {
		stopAllSounds();
	}
}
void HexagonGame::goToMenu()
{
    stopAllSounds();
    playSound("beep");

    checkAndSaveScore();
    window.setGame(&mgPtr->getGame());
    mgPtr->init();
}
Exemple #5
0
IMuseDigital::~IMuseDigital() {
	_vm->getTimerManager()->removeTimerProc(timer_handler);
	stopAllSounds();
	for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
		delete _track[l];
	}
	delete _sound;
	free(_audioNames);
}
Exemple #6
0
	void HexagonGame::goToMenu(bool mSendScores)
	{
		stopAllSounds();
		playSound("beep.ogg");
		fpsWatcher.disable();

		if(mSendScores && !status.hasDied) checkAndSaveScore();
		runLuaFunction<void>("onUnload");
		window.setGameState(mgPtr->getGame());
		mgPtr->init();
	}
Exemple #7
0
void resetUX(void) {
	// set all LEDs to off
	setLED(LED_ALL_INDIV,OFF);
	setLED(LED_ALL_CITIES,CITY_OFF);
	setLED(LED_START_BUTTON,FLASHING);
	
	// set all audio to off
	stopAllSounds();
	
	// set all servos to off
	SetFlagsInactive();
}
Exemple #8
0
// fireReadyUX: turn off IR LED & turn on indicator light
void fireReadyUX(void) {
	printf("Fire READY UX: turn raindrops on & turn ammo on\r\n");
	/*
	ES_Event Event2Post;
	Event2Post.EventType = TURN_IR_OFF;
	// ES_PostAll(Event2Post); // only post to IRControl
	PostIRControl(Event2Post);
	PostEventPrinter(Event2Post);
*/
	// turn on indicator light
	setLED( LED_SHOOTING_INDICATOR, ON);
	setLED( LED_CANISTER1 << (numAmmo-1), ON);
	// stop playing spray sound
	stopAllSounds();
}
Exemple #9
0
MScene::~MScene()
{
	stopAllSounds();

	// delete objects
	unsigned int oSize = m_objects.size();
	for(unsigned int i=0; i<oSize; i++)
		SAFE_DELETE(m_objects[i]);

	m_objects.clear();

	m_entities.clear();
	m_cameras.clear();
	m_lights.clear();
	m_sounds.clear();
}
Exemple #10
0
// stopArmedUX - Return flags, Turn off all LEDs momentarily, start pulsing red LEDs, BONUS: pulse red LEDs around CA locations with low frequency (slowly increasing frequency over the duration of the game)
void stopArmedUX(void) {
	printf("Stopped Armed UX: Return flags, Turn off all LEDs momentarily, start pulsing red LEDs\r\n");
	// return flags
//	SetServoAngle(FLAG_INACTIVE_ANG, LEFT_FLAG);
//	SetServoAngle(FLAG_INACTIVE_ANG, RIGHT_FLAG);
	SetFlagsActive();
	
	// turn off all LEDs momentarily
	setLED(LED_ALL_INDIV, OFF);
	/*
	// turn on red LEDs
		setLED(LED_ALL_CITIES, CITY_OFF);
	setLED( LED_ALL_CITIES_RED , CITY_ON);
*/
	// stop sound
	stopAllSounds();
}
void CSound::destroy()
{
	stopAllSounds();

    SDL_LockAudio();
	SDL_CloseAudio();
	m_mixing_channels = 0;

	if(!m_MixedForm.empty())
		m_MixedForm.clear();

	if(!m_soundchannel.empty())
		m_soundchannel.clear();

	// Shutdown the OPL Emulator here!
	g_pLogFile->ftextOut("SoundDrv_Stop(): shut down.<br>");

	m_OPL_Player.shutdown();
}
void HexagonGame::newGame(string mId, bool mFirstPlay)
{
    clearMessages();

    setLevelData(getLevelData(mId), mFirstPlay);

    stopAllSounds();
    playSound("play");

    pm->resetAdj();

    stopLevelMusic();
    playLevelMusic();

    rotationDirection = getRnd(0, 100) > 50 ? true : false;

    scripts.clear();

    timeStop = 0;
    randomSideChangesEnabled = true;
    incrementEnabled = true;
    maxPulse = 85;
    minPulse = 75;
    pulseSpeedBackwards = 1;
    pulseSpeed = 1;

    hasDied = false;
    mustRestart = false;
    currentTime = 0;
    incrementTime = 0;
    setSides(levelData.getSides());
    radius = minPulse;

    manager.clear();
    createPlayer(manager, this, centerPos);

    scriptsTimeline = Timeline{};
    messagesTimeline = Timeline{};
    timeline = Timeline{};
}
void IMuseDigital::parseScriptCmds(int cmd, int b, int c, int d, int e, int f, int g, int h) {
	int soundId = b;
	int sub_cmd = c;

	if (!cmd)
		return;

	switch (cmd) {
	case 10: // ImuseStopAllSounds
		stopAllSounds();
		break;
	case 12: // ImuseSetParam
		switch (sub_cmd) {
		case 0x400: // select group volume
			selectVolumeGroup(soundId, d);
			break;
		case 0x500: // set priority
			setPriority(soundId, d);
			break;
		case 0x600: // set volume
			setVolume(soundId, d);
			break;
		case 0x700: // set pan
			setPan(soundId, d);
			break;
		default:
			warning("IMuseDigital::doCommand SetParam DEFAULT command %d", sub_cmd);
			break;
		}
		break;
	case 14: // ImuseFadeParam
		switch (sub_cmd) {
		case 0x600: // set volume fading
			if ((d != 0) && (e == 0))
				setVolume(soundId, d);
			else if ((d == 0) && (e == 0))
				stopSound(soundId);
			else
				setFade(soundId, d, e);
			break;
		default:
			warning("IMuseDigital::doCommand FadeParam DEFAULT sub command %d", sub_cmd);
			break;
		}
		break;
	case 25: // ImuseStartStream
		debug(3, "ImuseStartStream (%d, %d, %d)", soundId, c, d);
		break;
	case 26: // ImuseSwitchStream
		debug(3, "ImuseSwitchStream (%d, %d, %d, %d, %d)", soundId, c, d, e, f);
		break;
	case 0x1000: // ImuseSetState
		debug(5, "ImuseSetState (%d)", b);
		if ((_vm->_game.id == GID_DIG) && (_vm->_game.features & GF_DEMO)) {
			if (b == 1) {
				fadeOutMusic(200);
				startMusic(1, 127);
			} else {
				if (getSoundStatus(2) == 0) {
					fadeOutMusic(200);
					startMusic(2, 127);
				}
			}
		} else if ((_vm->_game.id == GID_CMI) && (_vm->_game.features & GF_DEMO)) {
			if (b == 2) {
				fadeOutMusic(108);
				startMusic("in1.imx", 1100, 0, 127);
			} else if (b == 4) {
				fadeOutMusic(108);
				startMusic("in2.imx", 1120, 0, 127);
			} else if (b == 8) {
				fadeOutMusic(108);
				startMusic("out1.imx", 1140, 0, 127);
			} else if (b == 9) {
				fadeOutMusic(108);
				startMusic("out2.imx", 1150, 0, 127);
			} else if (b == 16) {
				fadeOutMusic(108);
				startMusic("gun.imx", 1210, 0, 127);
			} else {
				fadeOutMusic(120);
			}
		} else if (_vm->_game.id == GID_DIG) {
			setDigMusicState(b);
		} else if (_vm->_game.id == GID_CMI) {
			setComiMusicState(b);
		} else if (_vm->_game.id == GID_FT) {
			setFtMusicState(b);
		}
		break;
	case 0x1001: // ImuseSetSequence
		debug(5, "ImuseSetSequence (%d)", b);
		if (_vm->_game.id == GID_DIG) {
			setDigMusicSequence(b);
		} else if (_vm->_game.id == GID_CMI) {
			setComiMusicSequence(b);
		} else if (_vm->_game.id == GID_FT) {
			setFtMusicSequence(b);
		}
		break;
	case 0x1002: // ImuseSetCuePoint
		debug(5, "ImuseSetCuePoint (%d)", b);
		if (_vm->_game.id == GID_FT) {
			setFtMusicCuePoint(b);
		}
		break;
	case 0x1003: // ImuseSetAttribute
		debug(5, "ImuseSetAttribute (%d, %d)", b, c);
		assert((_vm->_game.id == GID_DIG) || (_vm->_game.id == GID_FT));
		if (_vm->_game.id == GID_DIG) {
			_attributes[b] = c;
		}
		break;
	case 0x2000: // ImuseSetGroupSfxVolume
		break;
	case 0x2001: // ImuseSetGroupVoiceVolume
		break;
	case 0x2002: // ImuseSetGroupMusicVolume
		break;
	default:
		error("IMuseDigital::doCommand DEFAULT command %d", cmd);
	}
}
Exemple #14
0
void MScene::end(void)
{
	stopAllSounds();
}
Exemple #15
0
	void HexagonGame::newGame(const string& mId, bool mFirstPlay, float mDifficultyMult)
	{
		firstPlay = mFirstPlay;
		setLevelData(getLevelData(mId), mFirstPlay);
		difficultyMult = mDifficultyMult;

		// Audio cleanup
		stopAllSounds();
		playSound("go.ogg");
		stopLevelMusic();
		playLevelMusic();

		// Events cleanup
		clearMessage();

		for(auto eventPtr : eventPtrs) delete eventPtr;
		eventPtrs.clear();

		while(!eventPtrQueue.empty()) { delete eventPtrQueue.front(); eventPtrQueue.pop(); }
		eventPtrQueue = queue<EventData*>{};

		// Game status cleanup
		status = HexagonGameStatus{};
		restartId = mId;
		restartFirstTime = false;
		setSides(levelData.getSides());

		// Manager cleanup
		manager.clear();
		factory.createPlayer();

		// Timeline cleanup
		timeline.clear(); timeline.reset();
		messageTimeline.clear(); messageTimeline.reset();
		effectTimelineManager.clear();

		// FPSWatcher reset
		fpsWatcher.reset();
		if(getOfficial()) fpsWatcher.enable();

		// LUA context cleanup
		if(!mFirstPlay) runLuaFunction<void>("onUnload");
		lua = Lua::LuaContext{};
		initLua();
		runLuaFile(levelData.getValueString("lua_file"));
		runLuaFunction<void>("onLoad");

		// Random rotation direction
		if(getRnd(0, 100) > 50) setRotationSpeed(getRotationSpeed() * -1);

		// Reset zoom
		overlayCamera.setView({{getWidth() / 2.f, getHeight() / 2.f}, sf::Vector2f(getWidth(), getHeight())});
		backgroundCamera.setView({{0, 0}, {getWidth() * getZoomFactor(), getHeight() * getZoomFactor()}});
		backgroundCamera.setRotation(0);

		// 3D Cameras cleanup
		depthCameras.clear();
		unsigned int depth{styleData.get3DDepth()};
		if(depth > get3DMaxDepth()) depth = get3DMaxDepth();
		for(unsigned int i{0}; i < depth; ++i) depthCameras.push_back({window, {}});
	}
Exemple #16
0
extern "C" void handle_ipc(u32 type)
{
//	if (arm7_initialised)
//	{
//		keepalive++;
//		if (keepalive > 96)
//		{
//			ARM7_PRINT("keepalive\n");
//			keepalive = 0;
//		}
//	}
	
	
	//if (quake_ipc_9to7->message == 0xffffffff)
	//{
//		ARM7_PRINTF("message type %d\n", quake_ipc_9to7->message_type);
		
		switch (type)
		{
			case kPrintMessage:
			{
				ARM7_PRINTF((char *)quake_ipc_9to7_buf);
				break;
			}
			case kStopAllSounds:
			{
				ARM7_PRINT("ARM7: Stopping sounds...");
				stopAllSounds();
				ARM7_PRINT("...done\n");
				
				break;
			}
			case kPlayMP3:
			{
				ARM7_PRINT("arm7 mp3 start msg\ntrack: ");
				memcpy((void *)track_name, (void *)quake_ipc_9to7_buf, 100);
				ARM7_PRINT((char *)track_name);
				ARM7_PRINT("\n");
				do_mp3 = 1;
				
				break;
			}
			case kStopMP3:
			{
				ARM7_PRINT("arm7 mp3 stop msg\n");
				do_mp3 = 0;
				
//				if (decoder_stopped)
//					send_mp3_stop_message();
				
				break;
			}
			
			//sound subsystem
			case kS_Init:
			{
				S_Init7(((unsigned int *)quake_ipc_9to7_buf)[0], ((unsigned int *)quake_ipc_9to7_buf)[1]);
				break;
			}
			case kS_AmbientOff:
			{
				S_AmbientOff7();
				break;
			}
			case kS_AmbientOn:
			{
				S_AmbientOn7();
				break;
			}
			case kS_Shutdown:
			{
				S_Shutdown7();
				break;
			}
			case kS_TouchSound:
			{
				S_TouchSound7((char *)quake_ipc_9to7_buf);
				break;
			}
			case kS_ClearBuffer:
			{
				S_ClearBuffer7();
				break;
			}
			case kS_StaticSound:
			{
				float *floats = (float *)quake_ipc_9to7_buf;
				S_StaticSound7((void *)*(unsigned int *)quake_ipc_9to7_buf,
					&floats[1],
					floats[4],
					floats[5]);
				break;
			}
			case kS_StartSound:
			{
				float *floats = (float *)quake_ipc_9to7_buf;
				S_StartSound7(((unsigned int *)quake_ipc_9to7_buf)[0], ((unsigned int *)quake_ipc_9to7_buf)[1],
					(void *)((unsigned int *)quake_ipc_9to7_buf)[2],
					&floats[3], //floats[6], floats[7],
					((unsigned int *)quake_ipc_9to7_buf)[8], ((unsigned int *)quake_ipc_9to7_buf)[9]);
				break;
			}
			case kS_StopSound:
			{
				S_StopSound7(((unsigned int *)quake_ipc_9to7_buf)[0], ((unsigned int *)quake_ipc_9to7_buf)[1]);
				break;
			}
			case kS_StopAllSounds:
			{
				S_StopAllSounds7(((unsigned int *)quake_ipc_9to7_buf)[0]);
				break;
			}
			case kS_ClearPrecache:
			{
				S_ClearPrecache7();
				break;
			}
			case kS_BeginPrecaching:
			{
				S_BeginPrecaching7();
				break;
			}
			case kS_EndPrecaching:
			{
				S_EndPrecaching7();
				break;
			}
			case kS_PrecacheSound:
			{
				void *pc = S_PrecacheSound7((char *)quake_ipc_9to7_buf);
				*(unsigned int *)quake_ipc_7to9_buf = (unsigned int)pc;
				break;
			}
			case kS_Update:
			{
//				float *floats = (float *)quake_ipc_9to7_buf;
//				S_Update7(&floats[0], &floats[3], &floats[6], &floats[9]);
				S_UpdateStatics((void *)((unsigned int *)quake_ipc_9to7_buf)[12], ((unsigned int *)quake_ipc_9to7_buf)[13]);
				break;
			}
			case kS_ExtraUpdate:
			{
				S_ExtraUpdate7();
				break;
			}
			case kS_LocalSound:
			{
				S_LocalSound7((char *)quake_ipc_9to7_buf);
				break;
			}
			case kFreeTime:
			case kRunningOut:
			case kGetReady:
			{
				//free_time = quake_ipc_9to7->message_type;
//				ARM7_PRINTF("free time is %d\n", quake_ipc_9to7->message_type);
				break;
			}
			case kStartWifi:
			{
#ifdef WIFI_ON_DEMAND
//				ARM7_PRINT("ARM7 Initialising wifi...\n");
				wifi_go();
//				ARM7_PRINTF("ARM7 ...done\n");
#else
				ARM7_PRINT("Wifi has already been initialised\n");
#endif
				break;
			}
			case kDMATransfer:
			{
				unsigned int source = ((unsigned int *)quake_ipc_9to7_buf)[0];
				unsigned int size = ((unsigned int *)quake_ipc_9to7_buf)[1];
				unsigned int dest = ((unsigned int *)quake_ipc_9to7_buf)[2];
				
				while(DMA_CR(dma_channel & 0x3) & DMA_BUSY);

				DMA_SRC(dma_channel & 0x3) = source;
				DMA_DEST(dma_channel & 0x3) = dest;
				DMA_CR(dma_channel & 0x3) = (DMA_ENABLE | DMA_32_BIT  | DMA_DST_FIX | DMA_START_NOW) | size;
				
				while(DMA_CR(dma_channel & 0x3) & DMA_BUSY);
//				ARM7_PRINT("from ");
//				ARM7_PRINT_NUMBER(source);
//				ARM7_PRINT("to ");
//				ARM7_PRINT_NUMBER(dest);
//				ARM7_PRINT("size ");
//				ARM7_PRINT_NUMBER(size);
				
				dma_channel++;
				break;
			}
			case kPowerOff:
			{
				ARM7_PRINT("ARM7: Powering down...\n");
				SerialWaitBusy();

				REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz | SPI_CONTINUOUS;
				REG_SPIDATA = 0;

				SerialWaitBusy();

				REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz;
				REG_SPIDATA = 1 << 6;

				break;
			}
			case kBspRender:
			{
//				ARM7_PRINT("ARM7: BSP Render\n");
				
				setup_bsp_render((void *)((unsigned int *)quake_ipc_9to7_buf)[0],
					(void *)((unsigned int *)quake_ipc_9to7_buf)[1],
					((int *)quake_ipc_9to7_buf)[2],
					((int *)quake_ipc_9to7_buf)[3],
					(unsigned char *)((unsigned int *)quake_ipc_9to7_buf)[4],
					(int **)((unsigned int *)quake_ipc_9to7_buf)[5],
					(int *)((unsigned int *)quake_ipc_9to7_buf)[6],
					(unsigned int *)((unsigned int *)quake_ipc_9to7_buf)[7]);
//				ARM7_PRINT("ARM7: BSP Render done\n");
				break;
			}
			//
			default:
			{
				ARM7_PRINT("some other message, ");
				ARM7_PRINT_NUMBER(type);
				ARM7_PRINT("\n");
				break;
			}
		}
		//quake_ipc_9to7->message = 0;
		fifoSendValue32(FIFO_9to7,0);
	//}

low_mem:

	if (low_memory)
	{
		mark_freeable();
		free_marked();
		
		low_memory = false;
	}
}
Exemple #17
0
// stopSprayingUX - turn off end of hose LEDs, turn off ‘PUMP’ message
void stopSprayingUX(void) {
	printf("Stopped Shooting UX: turn off end of hose LEDs, turn off ‘PUMP’ message\r\n");
	setLED( (LED_BACK_PUMP | LED_BACK_SPRAY), OFF);
	stopAllSounds();
}
Exemple #18
0
Player_AD::~Player_AD() {
	stopAllSounds();
	Common::StackLock lock(_mutex);
	delete _opl2;
	_opl2 = 0;
}
Exemple #19
0
// stopMixingUX - turn off ‘MIX CHEMICALS’ backlight and turn off ARROW backlight
void stopMixingUX(void) {
	printf("Stop Mixing UX: turn off ‘MIX CHEMICALS’ backlight and turn off ARROW backlight\r\n");
	setLED( (LED_BACK_MIX | LED_BACK_ARROW), OFF);
	// stop all sounds
	stopAllSounds();
}