void KLameOptionsDialogue::setupInitialDefault()
{
    wipeSettings();
    if (lameOptions_ == "")         // Set basic defaults if no options given
        setupDisplay();
    else setDefaultOptions(lameOptions_);
}
int c_video_restart(lua_State *L) {
	initGameScreen();
	shutdownDisplay( gScreen );
	setupDisplay( gScreen );
	updateCallbacks();
	changeDisplay(-1);
	return 0;
}
Exemple #3
0
int main( int argc, char *argv[] ) {
  char *path;

#ifdef __FreeBSD__
  fpsetmask(0);
#endif

  SystemInit(&argc, argv);

  path = getFullPath("settings.txt");
  if(path != 0)
    initMainGameSettings(path); /* reads defaults from ~/.gltronrc */
  else {
    printf("fatal: could not settings.txt, exiting...\n");
    exit(1);
  }

  parse_args(argc, argv);

  /* sound */

#ifdef SOUND
  printf("initializing sound\n");
  initSound();
  path = getFullPath("gltron.it");
  if(path == 0 || loadSound(path)) 
    printf("error trying to load sound\n");
  else {
    if(game->settings->playMusic)
      playSound();
    free(path);
  }
#endif

  printf("loading menu\n");
  path = getFullPath("menu.txt");
  if(path != 0)
    pMenuList = loadMenuFile(path);
  else {
    printf("fatal: could not load menu.txt, exiting...\n");
    exit(1);
  }
  printf("menu loaded\n");
  free(path);

  initGameStructures();
  resetScores();

  initData();

  setupDisplay(game->screen);
  switchCallbacks(&guiCallbacks);
  switchCallbacks(&guiCallbacks);

  SystemMainLoop();

  return 0;
}
VideoTab::VideoTab(QWidget *parent, CodeInterface &codInt, const bool editFlag) : QWidget(parent)
{
	code_int = &codInt;
	setupDisplay();
	getStreamNum();
	createActions();
	setReadWrite(editFlag);
	onComboSelect(0);		//Initialise
	setup_autocomplete();
}
Exemple #5
0
QtDensity::QtDensity(RInside & R) : m_R(R)
{
    m_bw = 100;                 // initial bandwidth, will be scaled by 100 so 1.0
    m_kernel = 0;               // initial kernel: gaussian
    m_cmd = "c(rnorm(100,0,1), rnorm(50,5,1))"; // simple mixture
    m_R["bw"] = m_bw;           // pass bandwidth to R, and have R compute a temp.file name
    m_tempfile = QString::fromStdString(Rcpp::as<std::string>(m_R.parseEval("tfile <- tempfile()")));
    m_svgfile = QString::fromStdString(Rcpp::as<std::string>(m_R.parseEval("sfile <- tempfile()")));
    setupDisplay();
}
Exemple #6
0
void
UIManager::draw()
{
	setupDisplay();
	std::list<pp::Widget*>::iterator it;
	for(it=widgets.begin();it!=widgets.end();it++){
		(*it)->draw();		
	}
	drawCursor();	
}
Exemple #7
0
void initVideo(void) {
	videoInit();
	runScript(PATH_SCRIPTS, "video.lua");

	initVideoData();

	consoleInit();
	initArtpacks();
	runScript(PATH_SCRIPTS, "menu.lua");
	runScript(PATH_SCRIPTS, "menu_functions.lua");
  setupDisplay(gScreen);
}
Exemple #8
0
Raspbed::Raspbed(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::Raspbed), bed() {
    ui->setupUi(this);
    settings.loadSettings();

    setupDisplay();

    settingsMenu = ui->menuBar->addMenu("Menu");
    settingsAction = settingsMenu->addAction("Settings");

    connect(settingsAction, SIGNAL(triggered()), this, SLOT(openSettings()));

    selectedButton = ui->headUpButton;
    selected = false;
    callInProgress = false;
    numRightClicks = 0;
    numLeftClicks = 0;

    resetBed();
}
Exemple #9
0
//**********************************************************************************************************************************
void FWMenu::setupMenu(int pace) {

  // Button number masks.
  button1 = Btn1;
  button2 = Btn2;
  button3 = Btn3;
  button4 = Btn4;
  button5 = Btn5;
  button6 = Btn6;
  button7 = Btn7;
  button8 = Btn8;

  _pace = pace;   // Pace at which the menu changes - default 500 milliseconds.
  n = 0;          // Number of menu primary items. (Set by number of calls to addMenuItem).
  p = 0;          // Index to current menu item.   (array subscript).

  // Set up LED display. .
  setupDisplay(true, 7);

  // 'Option' mode to start.
  mode = 'o';
}
Exemple #10
0
/**
 * @brief Raspbed::openSettings
 */
void Raspbed::openSettings() {
    std::unique_ptr<Settings> settingsDialog(new Settings);

    QStringList serialPortOptions;
    for (std::string device : bed.getSerialPort()->getDevices()) {
        qDebug() << "Serial option: " << QString::fromStdString(device);

        if(device.find("USB") != std::string::npos){
            qDebug() << "Found:  " << QString::fromStdString(device);
            serialPortOptions.push_back(QString::fromStdString(device));
        }
    }

    settingsDialog->setSerialPorts(serialPortOptions);
    settingsDialog->setPort(settings.getPort());
    settingsDialog->setContact(settings.getContact());
    settingsDialog->setBordered(settings.isBordered());
    settingsDialog->setButtonMode(settings.isButtonMode());
    settingsDialog->setDarkHighlight(settings.isDarkHighlight());
    settingsDialog->setButtonHoldTime(
        QString::number(settings.getButtonHoldTime()));
    settingsDialog->populateSettings();
    settingsDialog->exec();

    if (settingsDialog->result() == QDialog::Accepted) {
        settings.setContact(settingsDialog->getContact());
        settings.setPort(settingsDialog->getPort());
        settings.setBordered(settingsDialog->isBordered());
        settings.setDarkHighlight(settingsDialog->isDarkHighlight());
        settings.setButtonMode(settingsDialog->isButtonMode());
        settings.setButtonHoldTime(settingsDialog->getButtonHoldTime().toInt());
        settings.saveSettings();

        setupDisplay();

        resetBed();
    }
}
Exemple #11
0
void
UIManager::drawCursor()
{
    GLuint texobj;
    char *binding;

    binding = "mouse_cursor";
    if ( !get_texture_binding( binding, &texobj ) ) {
	texobj = 0;
    }

    setupDisplay();

    glBindTexture( GL_TEXTURE_2D, texobj );

    glBegin( GL_QUADS );
    {
	glTexCoord2f( 0, 1 );
	glVertex2f( cursorPos.x, 
		    cursorPos.y );

	glTexCoord2f( 0, 0 );
	glVertex2f( cursorPos.x, 
		    cursorPos.y - 32 );

	glTexCoord2f( 1, 0 );
	glVertex2f( cursorPos.x + 32, 
		    cursorPos.y - 32 );

	glTexCoord2f( 1, 1 );
	glVertex2f( cursorPos.x + 32, 
		    cursorPos.y );

    }
    glEnd();
}
Exemple #12
0
void initGameStructures() { /* called only once */
  /* default art names */
  char *path;
  /* init game screen */
  /* init players. for each player: */
  /*   init model */
  /*   init display */
  /*   init ai */
  /*   create data */
  /*     create trails */
  /*   create camera */

  gDisplay *d;
  int i;
  /* int onScreen; */
  /* Data *data; */
  /* Camera *c; */
  /* Model *m; */
  AI *ai;
  Player *p;

  game->winner = -1;
  game->screen = (gDisplay*) malloc(sizeof(gDisplay));
  d = game->screen;
  d->h = game->settings->height; d->w = game->settings->width;
  d->vp_x = 0; d->vp_y = 0;
  d->vp_w = d->w; d->vp_h = d->h;
  d->blending = 1;
  d->fog = 0;
  d->shademodel = GL_SMOOTH;
  d->wall = 1;
  d->onScreen = -1;
  d->textures = (unsigned int*) malloc(game_textures * sizeof(unsigned int));
  


  //Setup display here
  setupDisplay(game->screen);
  
  game->players = PLAYERS;
  game->player = (Player *) malloc(MAX_PLAYERS * sizeof(Player));
  for(i = 0; i < game->players; i++) {
    p = (game->player + i);
    p->model = (Model*) malloc(sizeof(Model));
    p->display = (gDisplay*) malloc(sizeof(gDisplay));
    p->ai = (AI*) malloc(sizeof(AI));
    p->data = (Data*) malloc(sizeof(Data));
    p->data->trails = (line*) malloc(MAX_TRAIL * sizeof(line));
    p->camera = (Camera*) malloc(sizeof(Camera));
    p->camera->type = (CameraType*) malloc(sizeof(CameraType));

    /* init model & display & ai */
    update_splash(splash, 0.3+i*.1, "init model");
    initModel(p, i);

    ai = p->ai;
    if(game->settings->screenSaver) {
      ai->active = AI_COMPUTER;
    } else {
      switch(i) {
      case 0: ai->active = game->settings->ai_player1; break;
      case 1: ai->active = game->settings->ai_player2; break;
      case 2: ai->active = game->settings->ai_player3; break;
      case 3: ai->active = game->settings->ai_player4; break;
      default:
	fprintf(stderr, "player index #%d not caught!\n", i);
	ai->active = AI_NONE;
      }
    }
    ai->tdiff = 0;
    ai->moves = 0;
    ai->danger = 0;
    ai->lastx = 0;
    ai->lasty = 0;
  }

  /* load recognizer model */
  update_splash(splash, 0.7, "loading recognizer");
  path = getFullPath("recognizer.obj");
  if(path != NULL)
    // recognizer = loadModel(path, RECOGNIZER_HEIGHT, 0);
    // recognizer = loadModel(path, 60, MODEL_NORMALIZE | MODEL_INVERT_NORMALS);
    recognizer = loadModel(path, 60, MODEL_NORMALIZE );
  else {
    printf("fatal: could not load recognizer - exiting...\n");
    exit(1);
  }
  free(path);


  changeDisplay();

  game2->events.next = NULL;
  game2->mode = GAME_SINGLE;
}
int main(int argc, char** argv) {
	// Set up ROS.
	ros::init(argc, argv, "slice_client");
	ros::NodeHandle n;

	// Initialize node parameters from launch file or command line.
	// Use a private node handle so that multiple instances of the node can be run simultaneously
	// while using different parameters.
	ros::NodeHandle private_node_handle_("~");

	//Set up the clients, one to call for slices, the other to order stims
	ros::ServiceClient sliceClient = n.serviceClient<img_slicer::ImageSlicer>("red_px_counts");
	ros::ServiceClient stimClient = n.serviceClient<zanni::Stim>("deliver_stim");

	//Rate to loop in Hz
	ros::Rate r(10);

	//Run in a loop forever, making requests
	img_slicer::ImageSlicer srv;
	srv.request.slices = 5;

	//Set up plotter for visualization
	XPlotter* plot = setupDisplay();

	//Run in a loop making the calls
	while (n.ok()) {
		if (sliceClient.call(srv)) {
			redrawDisplay(plot, srv.response.pixelCount, MODE);

			uint64_t leftCount = 0;
			uint64_t rightCount = 0;
			for (int ii = 0; ii < 3; ii++) {
				leftCount += srv.response.pixelCount[ii];
				rightCount += srv.response.pixelCount[4 - ii];
			}
			ROS_INFO("R: %lu L: %lu\n", leftCount, rightCount);
			//Don't bother stimulating at all unless difference is big
			if (abs(leftCount - rightCount) > 500) {

				//Fill in the service request with the data from the header file.
				zanni::Stim stimSrv;
				int elements = sizeof(training_signal) / sizeof(training_signal[0]);
				for (int ii = 0; ii < elements; ii++) {
					stimSrv.request.signal.push_back(training_signal[ii] * 10000);
				}

				//Pick a channel
				if (leftCount > rightCount) {
					stimSrv.request.channel = 0; //Arbitrary decision that 0 = left
				} else {
					stimSrv.request.channel = 1;
				}

				//Make the call
				if (stimClient.call(stimSrv)) {
					if (stimSrv.response.done) {
						ROS_INFO("Stimulation sent");
					} else {
						ROS_WARN("Problem on stimulation end");
					}
				} else {
					ROS_ERROR("Failed to call stimulation");
					return 1;
				}

			}

		} else {
			ROS_ERROR("Call failed to get pixel counts");
		}

		r.sleep();
	}
	return 0;
}
Exemple #14
0
void Dialog::tabChanged(int index)
{
#ifdef QTM_EXAMPLES_SMALL_SCREEN
    switch(index) {
    case 0:
        setupGeneral();
        break;
    case 1:
        setupGeneral();
        break;
    case 2:
        setupDevice();
        break;
    case 3:
        setupDevice();
        break;
    case 4:
        setupDevice();
        break;
    case 5:
        setupDisplay();
        break;
    case 6:
        setupStorage();
        break;
    case 7:
        setupNetwork();
        break;
    case 8:
        setupNetwork();
        break;
    case 9:
        setupNetwork();
        break;
    case 10:
        setupSaver();
        break;
    };
#else
    switch(index) {
    case 0:
        setupGeneral();
        break;
    case 1:
        setupDevice();
        break;
    case 2:
        setupDisplay();
        break;
    case 3:
        setupStorage();
        break;
    case 4:
        setupNetwork();
        break;
    case 5:
        setupSaver();
        break;
    };
#endif
}
OMX_ERRORTYPE NonTextureEngine::onCameraEventParamOrConfigChanged()
{

	ofLogVerbose(__func__) << "START";
	
	OMX_ERRORTYPE error = OMX_SendCommand(camera, OMX_CommandStateSet, OMX_StateIdle, NULL);
	if (error != OMX_ErrorNone) 
	{
		ofLog(OF_LOG_ERROR, "camera OMX_SendCommand OMX_StateIdle FAIL error: 0x%08x", error);
	}
	
	//Enable Camera Output Port
	OMX_CONFIG_PORTBOOLEANTYPE cameraport;
	OMX_INIT_STRUCTURE(cameraport);
	cameraport.nPortIndex = CAMERA_OUTPUT_PORT;
	cameraport.bEnabled = OMX_TRUE;
	
	error =OMX_SetParameter(camera, OMX_IndexConfigPortCapturing, &cameraport);	
	if (error != OMX_ErrorNone) 
	{
		ofLog(OF_LOG_ERROR, "camera enable Output Port FAIL error: 0x%08x", error);
	}
	
	
	
	if (omxCameraSettings.doRecording) 
	{		
		if (omxCameraSettings.doRecordingPreview) 
		{
			//Set up renderer
			setupRenderer();
		} 
		
		
		//set up encoder
		OMX_CALLBACKTYPE encoderCallbacks;
		encoderCallbacks.EventHandler		= &BaseEngine::encoderEventHandlerCallback;
		encoderCallbacks.EmptyBufferDone	= &BaseEngine::encoderEmptyBufferDone;
		encoderCallbacks.FillBufferDone		= &NonTextureEngine::encoderFillBufferDone;
		
		
		string encoderComponentName = "OMX.broadcom.video_encode";
		
		error =OMX_GetHandle(&encoder, (OMX_STRING)encoderComponentName.c_str(), this , &encoderCallbacks);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "encoder OMX_GetHandle FAIL error: 0x%08x", error);
		}
		
		configureEncoder();
		
		if (omxCameraSettings.doRecordingPreview) 
		{
			//Create camera->video_render Tunnel
			error = OMX_SetupTunnel(camera, CAMERA_PREVIEW_PORT, render, VIDEO_RENDER_INPUT_PORT);
			if (error != OMX_ErrorNone) 
			{
				ofLog(OF_LOG_ERROR, "camera->video_render OMX_SetupTunnel FAIL error: 0x%08x", error);
			}
		}

		// Tunnel camera video output port and encoder input port
		error = OMX_SetupTunnel(camera, CAMERA_OUTPUT_PORT, encoder, VIDEO_ENCODE_INPUT_PORT);
		if(error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "CAMERA_OUTPUT_PORT->VIDEO_ENCODE_INPUT_PORT OMX_SetupTunnel FAIL error: 0x%08x", error);
		}

		
		//Set encoder to Idle
		error = OMX_SendCommand(encoder, OMX_CommandStateSet, OMX_StateIdle, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "encoder OMX_SendCommand OMX_StateIdle FAIL error: 0x%08x", error);
		}
		
		//Set camera to Idle
		error = OMX_SendCommand(camera, OMX_CommandStateSet, OMX_StateIdle, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "camera OMX_SendCommand OMX_StateIdle FAIL error: 0x%08x", error);
		}
		
		if (omxCameraSettings.doRecordingPreview)
		{
			//Enable camera preview port
			error = OMX_SendCommand(camera, OMX_CommandPortEnable, CAMERA_PREVIEW_PORT, NULL);
			if (error != OMX_ErrorNone) 
			{
				ofLog(OF_LOG_ERROR, "camera OMX_CommandPortEnable CAMERA_PREVIEW_PORT FAIL error: 0x%08x", error);
			}
		}
	
		//Enable camera output port
		error = OMX_SendCommand(camera, OMX_CommandPortEnable, CAMERA_OUTPUT_PORT, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "camera OMX_CommandPortEnable CAMERA_OUTPUT_PORT FAIL error: 0x%08x", error);
		}
		
		//Enable encoder input port
		error = OMX_SendCommand(encoder, OMX_CommandPortEnable, VIDEO_ENCODE_INPUT_PORT, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "encoder OMX_CommandPortEnable VIDEO_ENCODE_INPUT_PORT FAIL error: 0x%08x", error);
		}
		
		//Enable encoder output port
		error = OMX_SendCommand(encoder, OMX_CommandPortEnable, VIDEO_ENCODE_OUTPUT_PORT, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "encoder OMX_CommandPortEnable VIDEO_ENCODE_OUTPUT_PORT FAIL error: 0x%08x", error);
		}
		
		if (omxCameraSettings.doRecordingPreview) 
		{
			//Enable render input port
			error = OMX_SendCommand(render, OMX_CommandPortEnable, VIDEO_RENDER_INPUT_PORT, NULL);
			if (error != OMX_ErrorNone) 
			{
				ofLog(OF_LOG_ERROR, "render enable output port FAIL error: 0x%08x", error);
			}
		}

		OMX_PARAM_PORTDEFINITIONTYPE encoderOutputPortDefinition;
		OMX_INIT_STRUCTURE(encoderOutputPortDefinition);
		encoderOutputPortDefinition.nPortIndex = VIDEO_ENCODE_OUTPUT_PORT;
		error =OMX_GetParameter(encoder, OMX_IndexParamPortDefinition, &encoderOutputPortDefinition);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "encoder OMX_GetParameter OMX_IndexParamPortDefinition FAIL error: 0x%08x", error);
		}else 
		{
			ofLogVerbose(__func__) << "VIDEO_ENCODE_OUTPUT_PORT eColorFormat: " << OMX_Maps::getInstance().colorFormatTypes[encoderOutputPortDefinition.format.video.eColorFormat];
		}

		error =  OMX_AllocateBuffer(encoder, &encoderOutputBuffer, VIDEO_ENCODE_OUTPUT_PORT, NULL, encoderOutputPortDefinition.nBufferSize);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "encoder OMX_AllocateBuffer VIDEO_ENCODE_OUTPUT_PORT FAIL error: 0x%08x", error);
			
		}
		

		//Start camera
		error = OMX_SendCommand(camera, OMX_CommandStateSet, OMX_StateExecuting, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "camera OMX_StateExecuting FAIL error: 0x%08x", error);
		}
		
		//Start encoder
		error = OMX_SendCommand(encoder, OMX_CommandStateSet, OMX_StateExecuting, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "encoder OMX_StateExecuting FAIL error: 0x%08x", error);		
		}
		
		if (omxCameraSettings.doRecordingPreview) 
		{
			
			//Start renderer
			error = OMX_SendCommand(render, OMX_CommandStateSet, OMX_StateExecuting, NULL);
			if (error != OMX_ErrorNone) 
			{
				ofLog(OF_LOG_ERROR, "render OMX_StateExecuting FAIL error: 0x%08x", error);		
			}
			
			setupDisplay();
			
		}
		
		
		error = OMX_FillThisBuffer(encoder, encoderOutputBuffer);
		
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "encoder OMX_FillThisBuffer FAIL error: 0x%08x", error);		
		}
		
		bool doThreadBlocking	= true;
		startThread(doThreadBlocking);
		
	}else 
	{
		setupRenderer();
		
		
		//Create camera->video_render Tunnel
		error = OMX_SetupTunnel(camera, CAMERA_OUTPUT_PORT, render, VIDEO_RENDER_INPUT_PORT);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "camera->video_render OMX_SetupTunnel FAIL error: 0x%08x", error);
		}
		
		//Enable camera output port
		error = OMX_SendCommand(camera, OMX_CommandPortEnable, CAMERA_OUTPUT_PORT, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "camera enable output port FAIL error: 0x%08x", error);
		}
		
		//Enable render input port
		error = OMX_SendCommand(render, OMX_CommandPortEnable, VIDEO_RENDER_INPUT_PORT, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "render enable output port FAIL error: 0x%08x", error);
		}
		
		
		//Start renderer
		error = OMX_SendCommand(render, OMX_CommandStateSet, OMX_StateExecuting, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "render OMX_StateExecuting FAIL error: 0x%08x", error);		
		}
		
		//Start camera
		error = OMX_SendCommand(camera, OMX_CommandStateSet, OMX_StateExecuting, NULL);
		if (error != OMX_ErrorNone) 
		{
			ofLog(OF_LOG_ERROR, "camera OMX_StateExecuting FAIL error: 0x%08x", error);
		}
		
		setupDisplay();
				
	}

	isOpen = true;
	return error;
}
Exemple #16
0
void KLameOptionsDialogue::setDefaultOptions(QString& options)
{
    bool isOk;
    int parm = 0;
    short optionNumber = 0;
    QString option = parseOptions(options, optionNumber);
    QString additionalOpts = "";
    while (option != "")
    {
        QString keyword = option.section(" ",0,0);  // Pull out option keyword
        QString parameter = option.section(" ",1,1);// First parameter if any
        if (parameter != "") parm = parameter.toInt(&isOk,10);
        if (keyword == "-m")
        {
            if (parameter == "m")
                optionsDialogueUi.mode->setCurrentIndex(1);
            else if (parameter == "s")
                optionsDialogueUi.mode->setCurrentIndex(2);
            else if (parameter == "j")
                optionsDialogueUi.mode->setCurrentIndex(3);
            else if (parameter == "f")
                optionsDialogueUi.mode->setCurrentIndex(4);
            else if (parameter == "d")
                optionsDialogueUi.mode->setCurrentIndex(5);
        }
        else if (keyword == "-V")
        {
            optionsDialogueUi.qualityPref->setChecked(true);
            optionsDialogueUi.qualitySelect->setValue(100-parm*10);
        }
        else if (keyword == "--vbr-new")
        {
            optionsDialogueUi.qualityPref->setChecked(true);
            optionsDialogueUi.algorithmVbr->setCurrentIndex(1);
        }
        else if ((keyword == "--vbr-old") || (keyword == "-v"))
        {
            optionsDialogueUi.qualityPref->setChecked(true);
            optionsDialogueUi.algorithmVbr->setCurrentIndex(0);
        }
        else if (keyword == "-B")
        {
            optionsDialogueUi.useMaxBitrate->setChecked(true);
            optionsDialogueUi.maxBitrateVbr->setValue(parm);
        }
        else if (keyword == "-b")
        {
            optionsDialogueUi.bitrateSelect->setValue(parm);
            optionsDialogueUi.useMinVbrBitrate->setChecked(true);
        }
        else if (keyword == "--abr")
        {
            optionsDialogueUi.bitratePref->setChecked(true);
            optionsDialogueUi.abrBitrateSelect->setValue(parm);
        }
        else if (keyword == "--cbr")
        {
            optionsDialogueUi.bitratePref->setChecked(true);
            optionsDialogueUi.useCbr->setChecked(true);
        }
        else if (keyword == "-q")
            optionsDialogueUi.qualitySetting->setValue(parm);
        else if (keyword == "-k")
            optionsDialogueUi.noFiltering->setChecked(true);
// Obsolete keyword
//      else if (keyword == "-d")
//          blockSizeDifference->setChecked(true);
        else if (keyword == "--preset")
        {
            optionsDialogueUi.presetSelect->setChecked(true);
            if (parameter == "standard")
                optionsDialogueUi.presetComboBox->setCurrentIndex(0);
            if (parameter == "medium")
                optionsDialogueUi.presetComboBox->setCurrentIndex(1);
            if (parameter == "extreme")
                optionsDialogueUi.presetComboBox->setCurrentIndex(2);
            if (parameter == "insane")
                optionsDialogueUi.presetComboBox->setCurrentIndex(3);
        }
        else if (keyword == "--highpass")
        {
            optionsDialogueUi.highpassFreqSelect->setChecked(true);
            optionsDialogueUi.highpassFreq->setText(parameter);
        }
        else if (keyword == "--highpass-width")
        {
            optionsDialogueUi.highpassWidthSelect->setChecked(true);
            optionsDialogueUi.highpassWidth->setText(parameter);
        }
        else if (keyword == "--lowpass")
        {
            optionsDialogueUi.lowpassFreqSelect->setChecked(true);
            optionsDialogueUi.lowpassFreq->setText(parameter);
        }
        else if (keyword == "--lowpass-width")
        {
            optionsDialogueUi.lowpassWidthSelect->setChecked(true);
            optionsDialogueUi.lowpassWidth->setText(parameter);
        }
        else if (keyword == "--cwlimit")
        {
            optionsDialogueUi.useTonalityLimit->setChecked(true);
            optionsDialogueUi.tonalityLimit->setText(parameter);
        }
        else if (keyword == "--resample")
        {
            optionsDialogueUi.useResampleFrequency->setChecked(true);
            if (parameter == "8")
                optionsDialogueUi.resampleFrequency->setCurrentIndex(0);
            else if (parameter == "11.025")
                optionsDialogueUi.resampleFrequency->setCurrentIndex(1);
            else if (parameter == "12")
                optionsDialogueUi.resampleFrequency->setCurrentIndex(2);
            else if (parameter == "16")
                optionsDialogueUi.resampleFrequency->setCurrentIndex(3);
            else if (parameter == "22.05")
                optionsDialogueUi.resampleFrequency->setCurrentIndex(4);
            else if (parameter == "24")
                optionsDialogueUi.resampleFrequency->setCurrentIndex(5);
            else if (parameter == "32")
                optionsDialogueUi.resampleFrequency->setCurrentIndex(6);
            else if (parameter == "44.1")
                optionsDialogueUi.resampleFrequency->setCurrentIndex(7);
            else
                optionsDialogueUi.resampleFrequency->setCurrentIndex(8);
        }
        else if (keyword == "-X")
        {
            optionsDialogueUi.changeQualityMeasure->setChecked(true);
            optionsDialogueUi.qualityMeasure->setValue(parm);
        }
        else if (keyword != "--silent")
            additionalOpts += option + " ";
        optionNumber++;
        option = parseOptions(options, optionNumber);
    }
    setupDisplay();
    optionsDialogueUi.additionalOptions->setText(additionalOpts);
    on_qualityPref_toggled();
    on_bitratePref_toggled();
    on_useMaxBitrate_stateChanged();
    on_changeQualityMeasure_stateChanged();
    on_useResampleFrequency_stateChanged();
    on_useCbr_stateChanged();
}
Exemple #17
0
int main( int argc, char *argv[] ) {
  char *path;
  list *l;
#ifdef SOUND
  int c;
#endif

#ifdef __FreeBSD__
  fpsetmask(0);
#endif

#ifdef macintosh
    setupHomeEnvironment ();
#endif

  SystemInit(&argc, argv);

#ifndef CURRENT_EQ_DATA_DIR
  goto_installpath(argv[0]);
#endif

  /* initialize artpack list before loading settigns! */
  initArtpacks();

  path = getFullPath("settings.txt");
  if(path != NULL)
    initMainGameSettings(path); /* reads defaults from ~/.gltronrc */
  else {
    printf("fatal: could not settings.txt, exiting...\n");
    exit(1);
  }

  parse_args(argc, argv);

  consoleInit();
  initGameStructures();
  resetScores();

  /* sound */
  path = getMusicPath(MUSIC_DIR);
  game->settings->soundList = 
    readDirectoryContents(path, SONG_PREFIX);
  
  game->settings->soundIndex = -1;

  l = game->settings->soundList;

#ifdef SOUND
  printf("initializing sound\n");
  initSound();
  setFxVolume(game->settings->fxVolume);

  if(l->next != NULL) {
    char *tmp;
    tmp = malloc(strlen(path) + 1 + /* seperator */
		 strlen((char*) l->data) + 1);
    sprintf(tmp, "%s%c%s", path, SEPERATOR, 
	    (char*) l->data);
    fprintf(stderr, "loading song %s\n", tmp);
    loadSound(tmp);
    free(tmp);
    game->settings->soundIndex = 0;
  }

  c = 0;
  while(l->next != NULL) {
    l = l->next;
    c++;
  }
  game->settings->soundSongCount = c;

  if(game->settings->playMusic)
    playSound();
  fprintf(stderr, "setting music volume to %.3f\n",
	  game->settings->musicVolume);
  setMusicVolume(game->settings->musicVolume);
  free(path);
#endif

  printf("loading menu\n");
  path = getFullPath("menu.txt");
  if(path != NULL)
    pMenuList = loadMenuFile(path);
  else {
    printf("fatal: could not load menu.txt, exiting...\n");
    exit(1);
  }
  printf("menu loaded\n");
  free(path);

  setupDisplay(game->screen);
  switchCallbacks(&guiCallbacks);
  switchCallbacks(&guiCallbacks);

  SystemMainLoop();

  return 0;
}