Esempio n. 1
0
void MidiController::loop() {
  unsigned long now = micros();
  if (now >= _next) {
    _next += _sleep;

    Clock();
    if (_timerCallback) {
      _timerCallback();
    }
  }

  midiOUT2.read();
  midiOUT.read();
  midiIN.read();
}
Esempio n. 2
0
bool OSystem_IPHONE::pollEvent(Common::Event &event) {
	//printf("pollEvent()\n");

	long curTime = getMillis();

	if (_timerCallback && (curTime >= _timerCallbackNext)) {
		_timerCallback(_timerCallbackTimer);
		_timerCallbackNext = curTime + _timerCallbackTimer;
	}

	if (_queuedInputEvent.type != Common::EVENT_INVALID && curTime >= _queuedEventTime) {
		event = _queuedInputEvent;
		_queuedInputEvent.type = Common::EVENT_INVALID;
		return true;
	}

	int eventType;
	int x, y;

	if (iPhone_fetchEvent(&eventType, &x, &y)) {
		switch ((InputEvent)eventType) {
		case kInputMouseDown:
			if (!handleEvent_mouseDown(event, x, y))
				return false;
			break;

		case kInputMouseUp:
			if (!handleEvent_mouseUp(event, x, y))
				return false;
			break;

		case kInputMouseDragged:
			if (!handleEvent_mouseDragged(event, x, y))
				return false;
			break;
		case kInputMouseSecondDragged:
			if (!handleEvent_mouseSecondDragged(event, x, y))
				return false;
			break;
		case kInputMouseSecondDown:
			_secondaryTapped = true;
			if (!handleEvent_secondMouseDown(event, x, y))
				return false;
			break;
		case kInputMouseSecondUp:
			_secondaryTapped = false;
			if (!handleEvent_secondMouseUp(event, x, y))
				return false;
			break;
		case kInputOrientationChanged:
			handleEvent_orientationChanged(x);
			return false;
			break;

		case kInputApplicationSuspended:
			suspendLoop();
			return false;
			break;

		case kInputKeyPressed:
			handleEvent_keyPressed(event, x);
			break;

		case kInputSwipe:
			if (!handleEvent_swipe(event, x))
				return false;
			break;

		default:
			break;
		}

		return true;
	}
	return false;
}
Esempio n. 3
0
static void _timerCallbackVoid() {
	//NP("timer running");
	_timerCallback(_timerInterval);	//FIXME ?? (*_timercallback)(_timerinterval);
}