Пример #1
0
bool GameDriver::init(IPalette *pal)
{
	_palette = pal;

	// recalculate the refresh rate
	_videoInfo.refreshRate = _numInterruptsPerSecond/_numInterruptsPerVideoUpdate;

	// try to load all the files
	if (!loadFiles()){
		return false;
	}

	// call template method to do any necessary processing
	filesLoaded();

	// try to decode the graphics
	if (!decodeGraphics()){
		_errorMsg = "unable to decode GFX";
		deallocateFilesMemory();

		return false;
	}

	// call template method to do any necessary processing
	graphicsDecoded();

	// deallocate memory used by the files
	deallocateFilesMemory();

	// init input port values
	for (InputPorts::size_type i = 0; i < _inputs.size(); i++){
		_inputs[i]->reset();
	}

	// call template method to inform that the initialization process has finished
	finishInit();

	return true;
}
Пример #2
0
void ParallelSortClusteredCursor::fullInit(OperationContext* txn) {
    startInit(txn);
    finishInit(txn);
}
Пример #3
0
bVector<T> &bVector<bVector<T> >::operator[](long i){
  if (!initialized)
    finishInit(0);
  return data[i];
}
Пример #4
0
int MBASE::init(double p[], int n_args)
{
    int    flag, UseMikes;
    float  outskip, inskip, abs_factor, dummy;
    double R, T, dist;

    outskip = p[0];
    inskip = p[1];
    m_dur = p[2];
    if (m_dur < 0)                      /* "dur" represents timend */
        m_dur = -m_dur - inskip;

    if (rtsetinput(inskip, this) == -1) { // no input
		  return(DONT_SCHEDULE);
	}
    insamps = (int)(m_dur * SR);
	
   	inamp = p[3];

	if (inamp < 0) {
		m_paths = 1;	// Dont process secondary paths
		inamp = -inamp;
	}

    /* Get results of Minc setup calls (space, mikes_on, mikes_off, matrix) */
    if (get_setup_params(Dimensions, &m_attenParams,
						 &dummy, &abs_factor, &UseMikes, &MikeAngle,
						 &MikePatternFactor) == -1) {
		return die(name(), "You must call setup routine `space' first.");
	}

	// call inst-specific init code
    if (localInit(p, n_args) == DONT_SCHEDULE)
		  return die(name(), "localInit failed.");

    if (m_inchan >= inputChannels())
       return die(name(), "You asked for channel %d of a %d-channel input file.",
                  m_inchan, inputChannels());

    if (inputChannels() == 1)
       m_inchan = 0;
	
	if (outputChannels() != 4)
		return die(name(), "Output must be 4-channel (2 signal, 2 reverb feed).");
	
    /* (perform some initialization that used to be in space.c) */
    int meanLength = MFP_samps(SR, Dimensions); // mean delay length for reverb
    get_lengths(meanLength);              /* sets up delay lengths */
    set_gains();                		/* sets gains for filters */
    set_walls(abs_factor);              /* sets wall filts for move routine */


   /* flag for use of ear filters */
   m_binaural = (!UseMikes && m_dist < 0.8 && m_dist != 0.0);

   amparray = floc(1);
   if (amparray) {
      int amplen = fsize(1);
      tableset(SR, m_dur, amplen, amptabs);      /* controls input dur only */
   }
   
   /* determine extra run time for this routine before calling rtsetoutput() */
   double reflectionDur = 0.0;
   finishInit(&reflectionDur);
   
   m_branch = 0;
   
   if (rtsetoutput(outskip, m_dur + reflectionDur, this) == -1)
      return DONT_SCHEDULE;
   DBG1(printf("nsamps = %d\n", nSamps()));
   return nSamps();
}
Пример #5
0
int BASE::init(double p[], int n_args)
{
	int	UseMikes;
	float  outskip, inskip, abs_factor, rvb_time;

	outskip = p[0];
	inskip = p[1];
	m_dur = p[2];
	if (m_dur < 0)					  /* "dur" represents timend */
		m_dur = -m_dur - inskip;

	if (rtsetinput(inskip, this) == -1) { // no input
	  return(DONT_SCHEDULE);
	}
	insamps = (int)(m_dur * SR);
	inamp = p[3];

	double Matrix[12][12];
   
	/* Get results of Minc setup calls (space, mikes_on, mikes_off, matrix) */
	if (get_setup_params(Dimensions, Matrix, &abs_factor, &rvb_time,
						 &UseMikes, &MikeAngle, &MikePatternFactor) == -1) {
	   return die(name(), "You must call setup routine `space' first.");
	}

	// call inst-specific init code
	if (localInit(p, n_args) == DONT_SCHEDULE) {
		return die(name(), "localInit failed.");
	}

	if (m_inchan >= inputChannels()) {
	   return die(name(),
				  "You asked for channel %d of a %d-channel input file.", 
				  m_inchan, inputChannels());
	}
	if (inputChannels() == 1)
	   m_inchan = 0;

	if (outputChannels() != 2) {
		return die(name(), "Output must be stereo.");
	}

	wire_matrix(Matrix);

	/* (perform some initialization that used to be in space.c) */
	int meanLength = MFP_samps(SR, Dimensions); // mean delay length for reverb
	get_lengths(meanLength);			  /* sets up delay lengths */
	set_gains(rvb_time);				/* sets gains for filters */
	set_walls(abs_factor);			  /* sets wall filts for move routine */
	set_allpass();
	set_random();					   /* sets up random variation of delays */

   /* flag for use of ear filters */
   m_binaural = (!UseMikes && m_dist < 0.8 && m_dist != 0.0);

   amparray = floc(1);
   if (amparray) {
	  int amplen = fsize(1);
	  tableset(SR, m_dur, amplen, amptabs);	  /* controls input dur only */
   }
   else
	  rtcmix_advise(name(), "Setting phrase curve to all 1's.");
   
   /* determine extra run time for this routine before calling rtsetoutput() */
   double ringdur = 0.0;
   finishInit(rvb_time, &ringdur);
   
   m_branch = 0;

   if (rtsetoutput(outskip, m_dur + ringdur, this) == -1)
	  return DONT_SCHEDULE;
   DBG1(printf("nsamps = %d\n", nSamps()));
   return nSamps();
}
Пример #6
0
Kiten::Kiten( QWidget *parent, const char *name )
: KXmlGuiWindow( parent )
, _lastQuery( DictQuery() )
, _radselect_proc( new KProcess( this ) )
, _kanjibrowser_proc( new KProcess( this ) )
{
  _radselect_proc->setProgram( QStandardPaths::findExecutable( "kitenradselect" ) );
  _kanjibrowser_proc->setProgram( QStandardPaths::findExecutable( "kitenkanjibrowser" ) );
  setStandardToolBarMenuEnabled( true );
  setObjectName( QLatin1String( name ) );

  /* Set up the config */
  _config = KitenConfigSkeleton::self();
  _config->load();

  /* Set up hot keys */
  //KDE4 TODO
/*	Accel = new KGlobalAccel( this );
  (void) Accel->insert(   "Lookup English/Japanese word"
                        , i18n("Lookup English/Japanese Word")
                        , i18n( "Looks up current text on clipboard in the same way as if you used Kiten's regular search." )
                        , Qt::CTRL + Qt::ALT + Qt::Key_S
                        , Qt::CTRL + Qt::ALT + Qt::Key_S
                        , this
                        , SLOT(searchClipboardContents()) );
  Accel->readSettings( KSharedConfig::openConfig() );
  Accel->updateConnections();
*/
  /* ResultsView is our main widget, displaying the results of a search */
  _mainView = new ResultsView( this, "mainView" );

  /* Create the export list */
//	setupExportListDock();

  /* TODO: have a look at this idea
  detachedView = new ResultsView( NULL, "detachedView" );
  */

  setCentralWidget( _mainView->widget() );

  setupActions();
  // Be sure to create this manager before creating the GUI
  // as it needs to add a KAction to it.
  _dictionaryUpdateManager = new DictionaryUpdateManager( this );

  createGUI();

  _statusBar = statusBar();
  _optionDialog = 0;

  /* Start the system tray icon. */
  _sysTrayIcon = new QSystemTrayIcon( windowIcon(), this );
  _sysTrayIcon->show();

  /* Set things as they were (as told in the config) */
  _autoSearchToggle->setChecked( _config->autosearch() );
  _inputManager->setDefaultsFromConfig();
  updateConfiguration();
  applyMainWindowSettings( KSharedConfig::openConfig()->group( "kitenWindow" ) );

  /* What happens when links are clicked or things are selected in the clipboard */
  connect(_mainView, &ResultsView::urlClicked, this, &Kiten::searchText);
  connect( QApplication::clipboard(), SIGNAL(selectionChanged()),
                                this,   SLOT(searchClipboard()) );
  connect(_inputManager, &SearchStringInput::search, this, &Kiten::searchFromEdit);

  connect( _mainView->view()->verticalScrollBar(), SIGNAL(valueChanged(int)),
                                            this,   SLOT(setCurrentScrollValue(int)) );
  /* We need to know when to reload our dictionaries if the user updated them. */
  connect(_dictionaryUpdateManager, &DictionaryUpdateManager::updateFinished, this, &Kiten::loadDictionaries);

  /* See below for what else needs to be done */
  QTimer::singleShot( 10, this, SLOT(finishInit()) );
}