예제 #1
0
static void _disclaimer_cool ( void )
{
	ledUpdate = 1;
	exit      = 0;

	drawDisclaimerGraphics( );
	doTextDisclaimerFadeIn( );
	doDisclaimerBGFadeIn( );

	disclaimerLogoLedIndex = 0;

	doDisclaimerLogoFadeIn( );

	u8 i = getHz();

	while ( i-- )
	{
		WAITBREAK_DISCLAIMER(4);
		doDisclaimerLogoLedUpdate ( );
	}

	doDisclaimerBGFadeOut( );
	doTextDisclaimerFadeOut( );

	ledUpdate = 0;
	doDisclaimerLogoFadeOut ( );

	displayOff(0);
	resetScreen();
}
QVariant GraphicEQFilterGUIItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant& value)
{
	QVariant result = QGraphicsItem::itemChange(change, value);

	if (change == ItemScenePositionHasChanged)
	{
		GraphicEQFilterGUIScene* s = qobject_cast<GraphicEQFilterGUIScene*>(scene());
		s->itemMoved(index);
	}
	else if (change == ItemSelectedHasChanged)
	{
		GraphicEQFilterGUIScene* s = qobject_cast<GraphicEQFilterGUIScene*>(scene());
		s->itemSelectionChanged(index, value.toBool());
	}
	else if (change == ItemPositionChange)
	{
		GraphicEQFilterGUIScene* s = qobject_cast<GraphicEQFilterGUIScene*>(scene());
		if (s->getBandCount() != -1)
		{
			QPointF newPos = value.toPointF();
			newPos.setX(s->hzToX(getHz()));
			result = newPos;
		}
	}

	return result;
}
예제 #3
0
void waitSc ( u16 sc )
{
	sc *= getHz();

	while ( sc-- )
	{
		VDP_waitVSync();
	}
}
예제 #4
0
파일: riff.cpp 프로젝트: DDVTECH/mistserver
 void fmt::toPrettyString(std::ostream &o, size_t indent) const{
   o << std::string(indent, ' ') << "[" << getType() << "] (" << (getPayloadSize() + 8)
     << "b):" << std::endl;
   indent += 1;
   o << std::string(indent, ' ') << "Codec: " << getCodec() << " (" << getFormat() << ")"
     << std::endl;
   o << std::string(indent, ' ') << "Channels: " << getChannels() << std::endl;
   o << std::string(indent, ' ') << "Sample rate: " << getHz() << "Hz" << std::endl;
   o << std::string(indent, ' ') << "Bytes/s: " << getBPS() << std::endl;
   o << std::string(indent, ' ') << "Block size: " << getBlockSize() << " bytes" << std::endl;
   o << std::string(indent, ' ') << "Sample size: " << getSize() << " bits" << std::endl;
   if (getExtLen()){
     o << std::string(indent, ' ') << "-- extended " << getExtLen() << "bytes --" << std::endl;
     if (getExtLen() >= 2){
       o << std::string(indent, ' ') << "Valid bits: " << getValidBits() << std::endl;
     }
     if (getExtLen() >= 6){
       o << std::string(indent, ' ') << "Channel mask: " << getChannelMask() << std::endl;
     }
     if (getExtLen() >= 22){
       o << std::string(indent, ' ') << "GUID: " << getGUID() << std::endl;
     }
   }
 }
예제 #5
0
파일: Timer.cpp 프로젝트: AliAlawieh/kalibr
 double Timing::getHz(std::string const & tag)
 {
   return getHz(getHandle(tag));
 }
예제 #6
0
int main(int argc, char **argv){
	// Be nice to other processes. Helps reduce mouse lag
	setpriority(PRIO_PROCESS, 0, 20);

	// Make sure we're running in the exe's directory
	char path[PATH_MAX];
	if (realpath("/proc/self/exe", path)){
		char *slash = strrchr(path, '/');
		if (slash) *slash = '\0';
		chdir(path);
	}



	initGlobals();

	float runTime = 1e30f;
	float staticTime = 0;
	bool isStatic = false, lastStatic = false;
	for (int i = 1; i < argc; i++){
		if (strcmp(argv[i], "-r") == 0 || strcmp(argv[i], "--run-for") == 0){
			if (++i < argc){
				runTime = atof(argv[i]);							
			}
		} else if (strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--static") == 0){
			isStatic = true;
			lastStatic = true;
			continue;
		} else if (lastStatic){
			staticTime = atof(argv[i]);								
		} else {
			printf("Unknown argument: %s\n", argv[i]);
		}
		lastStatic = false;
	}



	Display *display;
	int screen;

    initCPU();
    cpuHz = getHz();

	if (!app->init()) return 0;
	app->resetCamera();

	display = XOpenDisplay(0);
	screen = DefaultScreen(display);
	app->setDisplay(display, screen);

	app->initDisplayModes();
	app->initMenu();

	//toggleFullscreen = false;
	time = 0;
//	uint64 prev, curr = getCycleNumber();
	timeval prev, curr;
	gettimeofday(&curr, NULL);

	float rTime = 0;
	
	do {
		//if (toggleFullscreen) fullscreen = !fullscreen;
		toggleFullscreen = false;
		captureMouse = fullscreen;

		if (fullscreen) app->setDisplayMode(width = fullscreenWidth, height = fullscreenHeight, refreshRate);

		if (app->initAPI()){
			app->showCursor(!captureMouse);
			if (captureMouse) XWarpPointer(display, None, window, 0,0,0,0, middleX, middleY);

			if (app->load()){

				XEvent event;
				unsigned int key;
				done = false;
				
				do {
///*
					while (XPending(display) > 0){

						XNextEvent(display, &event);
						
						switch (event.type){
						case Expose:
							if (event.xexpose.count != 0) break;
							break;
						case MotionNotify:
							if (captureMouse){
								static bool changeMouse;
								float mouseSensibility = 0.0005f * mouseSpeed;

								//app->rotateView(mouseSensibility * (middleY - event.xmotion.y) * (invertMouse? 1 : -1),
								//				mouseSensibility * (middleX - event.xmotion.x));
								//float a = mouseSensibility * (middleY - event.xmotion.y) * (invertMouse? 1 : -1);
								//float b = mouseSensibility * (middleX - event.xmotion.x);
								mousexxxxxx = mouseSensibility * (middleY - event.xmotion.y) * (invertMouse? 1 : -1);
								mouseyyyyyy = mouseSensibility * (middleX - event.xmotion.x);
								printf("%f %f\n", mouseSensibility, middleY);
								if (changeMouse = !changeMouse) XWarpPointer(display, None, window, 0,0,0,0, middleX, middleY);
							}
							app->setMousePos(event.xmotion.x, event.xmotion.y, 0);
							break;
						case ConfigureNotify:
							app->setViewport(width = event.xconfigure.width, height = event.xconfigure.height);
							if (!fullscreen){
								windowedLeft   = event.xconfigure.x;
								windowedRight  = event.xconfigure.width + windowedLeft;
								windowedTop    = event.xconfigure.y;
								windowedBottom = event.xconfigure.height + windowedTop;
							}
							middleX = event.xconfigure.width  / 2;
							middleY = event.xconfigure.height / 2;
							break;
						case ButtonPress:
							if (!captureMouse && event.xbutton.button == 1){
								//XGrabPointer(display, window, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, window, blankCursor, CurrentTime);
								app->showCursor(false);
								XWarpPointer(display, None, window, 0, 0, 0, 0, middleX, middleY);
								captureMouse = true;
							}
							app->setButton((event.xbutton.button == 1)? MOUSE_LEFT : MOUSE_RIGHT, true);
							break;
						case ButtonRelease:
							app->setButton((event.xbutton.button == 1)? MOUSE_LEFT : MOUSE_RIGHT, false);
							break;
						case KeyPress:
							key = XLookupKeysym(&event.xkey, 0);
 							if (key == XK_Return && app->getKey(XK_Alt_L)){
								app->toggleScreenMode();
								app->closeWindow();
							} else {
								app->processKey(key);

								char str[8];
								int nChar = XLookupString(&event.xkey, str, sizeof(str), NULL, NULL);
								for (int i = 0; i < nChar; i++) app->processChar(str[i]);
							}
							break;
						case KeyRelease:
							key = XLookupKeysym(&event.xkey, 0);
							app->setKey(key, false);
							break;
						case ClientMessage:
							if (*XGetAtomName(display, event.xclient.message_type) == *"WM_PROTOCOLS"){
								app->closeWindow();
							}
							break;
						default:
							break;
						}
						
					}
//*/
					prev = curr;
//					curr = getCycleNumber();
//					frameTime = (float) (double(curr - prev) / cpuHz);
					gettimeofday(&curr, NULL);
					frameTime = (float(curr.tv_sec - prev.tv_sec) + 0.000001f * float(curr.tv_usec - prev.tv_usec));
					if (isStatic){
						time = staticTime;
					} else {
						time += frameTime;
					}
					rTime += frameTime;
					if (rTime > runTime) done = true;

					app->controls();
					/*int a = 0;
					for (unsigned long int i = 0; i < 10000000000; i++){
						a++;
						
					}
printf("%d ",a);*/
					app->beginFrame();
					app->drawFrame();
					app->drawGUI();
					app->endFrame();

				} while (!done);
				
				app->unload();
			} else {
				printf(getLogString());
			}

			app->closeAPI();
		} else {
			printf(getLogString());
		}
		//if (fullscreen) app->resetDisplayMode();

		XDestroyWindow(display, window);

	} while (toggleFullscreen);
	
	if (fullscreen) app->resetDisplayMode();

	app->exit();
	delete app;
	XCloseDisplay(display);

	flushGlobals();
	clearLog();

	return 0;
}
예제 #7
0
void waitJoyScBtn ( u16 sc )
{
    waitJoyHzBtn( sc * getHz() );
}
예제 #8
0
void waitJoySc ( u16 sc )
{
    waitJoyHz ( sc * getHz() );
}