Ejemplo n.º 1
0
int Player_AD::readBuffer(int16 *buffer, const int numSamples) {
	Common::StackLock lock(_mutex);

	int len = numSamples;

	while (len > 0) {
		if (!_samplesTillCallback) {
			if (_curOffset) {
				updateMusic();
			}

			updateSfx();

			_samplesTillCallback = _samplesPerCallback;
			_samplesTillCallbackRemainder += _samplesPerCallbackRemainder;
			if (_samplesTillCallbackRemainder >= AD_CALLBACK_FREQUENCY) {
				++_samplesTillCallback;
				_samplesTillCallbackRemainder -= AD_CALLBACK_FREQUENCY;
			}
		}

		const int samplesToRead = MIN(len, _samplesTillCallback);
		_opl2->readBuffer(buffer, samplesToRead);

		buffer += samplesToRead;
		len -= samplesToRead;
		_samplesTillCallback -= samplesToRead;
	}

	return numSamples;
}
Ejemplo n.º 2
0
void Console::updateCaches() {
	::Engines::Console::updateCaches();

	updateCampaigns();
	updateModules();
	updateAreas();
	updateMusic();
}
Ejemplo n.º 3
0
void Player_AD::onTimer() {
	Common::StackLock lock(_mutex);

	if (_curOffset) {
		updateMusic();
	}

	updateSfx();
}
Ejemplo n.º 4
0
void DrasculaEngine::updateEvents() {
	Common::Event event;
	Common::EventManager *eventMan = _system->getEventManager();

	updateMusic();

#ifdef _WIN32_WCE
	if (eventMan->pollEvent(event)) {
#else
	while (eventMan->pollEvent(event)) {
#endif
		switch (event.type) {
		case Common::EVENT_KEYDOWN:
			if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) {
				// Start the debugger
				getDebugger()->attach();
				getDebugger()->onFrame();
			}
			addKeyToBuffer(event.kbd);
			break;
		case Common::EVENT_KEYUP:
			break;
		case Common::EVENT_MOUSEMOVE:
			_mouseX = event.mouse.x;
			_mouseY = event.mouse.y;
			break;
		case Common::EVENT_LBUTTONDOWN:
			_leftMouseButton = 1;
			break;
		case Common::EVENT_LBUTTONUP:
			_leftMouseButton = 0;
			break;
		case Common::EVENT_RBUTTONDOWN:
			// We changed semantic and react only on button up event
			break;
		case Common::EVENT_RBUTTONUP:
			_rightMouseButton = 1;
			break;
		default:
			break;
		}
	}
}

void DrasculaEngine::delay(int ms) {
	uint32 end = _system->getMillis() + ms * 2; // originally was 1

	do {
		_system->delayMillis(10);
		updateEvents();
		_system->updateScreen();
	} while (_system->getMillis() < end && !shouldQuit());
}
Ejemplo n.º 5
0
void DrasculaEngine::updateEvents() {
	Common::Event event;
	Common::EventManager *eventMan = _system->getEventManager();

	updateMusic();

#ifdef _WIN32_WCE
	if (eventMan->pollEvent(event)) {
#else
	while (eventMan->pollEvent(event)) {
#endif
		switch (event.type) {
		case Common::EVENT_KEYDOWN:
			addKeyToBuffer(event.kbd);
			break;
		case Common::EVENT_KEYUP:
			break;
		case Common::EVENT_MOUSEMOVE:
			mouseX = event.mouse.x;
			mouseY = event.mouse.y;
			break;
		case Common::EVENT_LBUTTONDOWN:
			leftMouseButton = 1;
			break;
		case Common::EVENT_LBUTTONUP:
			leftMouseButton = 0;
			break;
		case Common::EVENT_RBUTTONDOWN:
			// We changed semantic and react only on button up event
			break;
		case Common::EVENT_RBUTTONUP:
			rightMouseButton = 1;
			break;
		case Common::EVENT_QUIT:
			// TODO
			endChapter();
			_system->quit();
			break;
		default:
			break;
		}
	}
}

void DrasculaEngine::delay(int ms) {
	uint32 end = _system->getMillis() + ms * 2; // originally was 1

	do {
		_system->delayMillis(10);
		updateEvents();
		_system->updateScreen();
	} while (_system->getMillis() < end);
}
Ejemplo n.º 6
0
void Console::cmdListMusic(const CommandLine &cl) {
	updateMusic();
	printList(_music, _maxSizeMusic);
}