示例#1
0
void OEMFGame :: die()
{
	musicPlayer->playSound(sounds[SND_OHNO]);
	m_player->m_vy = 0.0f;
	
	m_level->moveObject(m_player, m_level->startX() * 32, m_level->startY() * 32);
	
	if (m_lives > 0)
	{
		m_lives -= 1;
		darkenRect(160, 128, 320, 48);
		char msg[256];
		sprintf(msg, "You died! Lives left:    x%2d", m_lives);
		fonts[FNT_AMIGA]->blitText(this, msg, 0xFF7700, 176, 128 + 16, 320 - 32, false);
		blitImage(images[IMG_OEMFOEMINI], 160 + 112 + 80, 128 + 16);
		updateScreen();
		SDL_Delay(2000);
		fadeOut();
	}
	else
	{
		// GAME OVER!
		m_done = 1;
		darkenRect(160, 128, 320, 48);
		fonts[FNT_AMIGA]->blitCenterText(this, string("GAME OVER!"), 0xFF0000, 128 + 16, m_screenWidth, false);
		updateScreen();
		SDL_Delay(3000);
		fadeOut();
	}
}
示例#2
0
文件: main.c 项目: hartmannaf/rxTools
static _Noreturn void mainLoop()
{
	uint32_t pad;

	while (true) {
		pad = InputWait();
		if (pad & (BUTTON_DOWN | BUTTON_RIGHT | BUTTON_R1))
			MenuNextSelection();

		if (pad & (BUTTON_UP | BUTTON_LEFT | BUTTON_L1))
			MenuPrevSelection();

		if (pad & BUTTON_A) {
			OpenAnimation();
			MenuSelect();
		}

		if (pad & BUTTON_SELECT) {
			fadeOut();
			ShutDown(1); //shutdown
		}
		if (pad & BUTTON_START) {
			fadeOut();
			ShutDown(0); //reboot
		}

		MenuShow();
	}
}
示例#3
0
文件: lhpControl.cpp 项目: j45ch/lhp
void lhpControl::enterScene()
{
	int i, p, s;
	s = insideSceneID;
	decisionString = "enter scene "+ofToString(s+1);
	
	// just for good measure
	fadeOut(map->music[authorID]);// stop music activity
	
	signalString = "signal: ";
	for(i = 0; i < map->numberOfZones; i++) {	// set all signalActives to 0
		fadeOut(map->zones[i].signals[0]);
		// fadeOut(map->zones[i].atmo[0]);
		fadeOut(map->zones[i].atmo[1]);

		if(map->zones[i].signalActive == 1) {
			map->zones[i].signalActive = 0;
			map->zones[i].prevSignalState = 0;
			signalString += "stop "+ofToString(i+1)+" ";		
		} else {
			map->zones[i].prevSignalState = 0;
			signalString = "";
		}
	}
	
	p = map->zones[s].partID; // current p
	if(map->zones[s].scenes[p].finished == 1) {
		
		if (map->zones[s].partID < map->zones[s].numberOfScenes-1) {	// it is NOT the last scene
			map->zones[s].partID++;							// increment partID
//			printf("incrementing zone[%d].partID to %d\n", s, map->zones[s].partID);
			p = map->zones[s].partID;						// update p
			map->zones[s].scenes[p].elapsedTime = 0;		// reset elapsedTime for next scene
		}
	}
	
	graphicState = 4;
	
	p = map->zones[s].partID;
	if(map->zones[s].scenes[p].finished == 0){
		sceneGraphicState = 1; // full alpha
	} else {
		sceneGraphicState = 0; // reduced alpha
	}
//	printf("sceneGraphicState is %d s %d partID %d\n", sceneGraphicState, s,  map->zones[s].partID);
	decisionString += " part: "+ofToString(map->zones[s].partID+1);
	if (sceneGraphicState == 0) {
		decisionString += " off";
	}else{
		decisionString += " on";
	}

	// starting scene player if it was off
//	if(p < map->zones[s].numberOfScenes){
//		fadeIn(map->zones[s].scenes[p]);
//	} else {
//		fadeIn(map->zones[s].atmo[1]);
//	}
}
示例#4
0
void OEMFIntro :: run(void)
{
	// small hack to display "loading..." without the amiga rom being loaded
	
	OEMFImage * amigarom = new OEMFImage(PREPATH "font.png");
	OEMFFontFactory * tempfont = new OEMFFontFactory(amigarom, 32, 127, 8, 16, 96);
	delete amigarom;
	tempfont->blitCenterText(this, "Loading...", 0xFFFFFF00, 216, m_screenWidth);
	updateScreen();
	delete tempfont;
	
	// loading...
	setLoadProgressCB(progress, this);
	loadFilesIntoDataMemory("resources.def");
	clearRectWithColor(0, 216, 640, 16, 0xFF000000, false);
	updateScreen();
	
#ifndef __DEBUG__
	OEMFFontFactory * ff = fonts[FNT_AMIGA];
	OEMFFontFactory * menufont = fonts[FNT_MENU];
	OEMFImage * oemfoelogo = images[IMG_INTRO];
	
	// loading done
	//ripEffect(224, 16);
	SDL_Delay(1000);
	fadeOut();
	
	//clearWithColor(0xFFFFFF);
	//blitImage(images[IMG_SDL], (m_screenWidth - images[IMG_SDL]->width()) / 2, 120);
//	ff->blitCenterText(this, "http://www.libsdl.org", 0x330077, 400, m_screenWidth, false);
//	updateScreen();
//	SDL_Delay(3000);
//	fadeOut();

	ff->blitCenterText(this, "Royal Belgian Beer Squadron", 0xFFFFFFFF, 224, m_screenWidth);
	SDL_UpdateRect(m_screen, 0, 0, m_screenWidth, m_screenHeight);
	SDL_Delay(1500);
	//ripEffect(224, 16);
	fadeOut();
	
	ff->blitCenterText(this, "presents...", 0xFFFFFFFF, 224, m_screenWidth);
	SDL_UpdateRect(m_screen, 0, 0, m_screenWidth, m_screenHeight);
	SDL_Delay(1500);
	//ripEffect(224, 16);
	fadeOut();
	
	// draw welcome screen
	blitImage(oemfoelogo, 0, 0);
	ff->blitCenterText(this, "Idea:                      Oemfoe", 0xFFFFFFFF, 192+192, m_screenWidth, true);
	ff->blitCenterText(this, "Coding:                    Oemfoe", 0xFFFFFFFF, 208+192, m_screenWidth, true);
	ff->blitCenterText(this, "GFX:                       Kuroto", 0xFFFFFFFF, 224+192, m_screenWidth, true);
	ff->blitCenterText(this, "Music:            Belief Systems*", 0xFFFFFFFF, 240+192, m_screenWidth, true);
	SDL_UpdateRect(m_screen, 0, 0, m_screenWidth, m_screenHeight);
	SDL_Delay(3000);
#endif
	
	if (musicPlayer->isPlayingSong())
		musicPlayer->stopSong();
}
示例#5
0
文件: lhpControl.cpp 项目: j45ch/lhp
void lhpControl::enterAtmo()
{
//	lhpMap * map = lhpMap::get();
	insideAtmoFlag = 1;
	decisionString = "enter atmo "+ofToString(insideAtmoID+1);
	signalString = "signal: ";
	
	for(int i = 0; i < map->numberOfZones; i++) {	// set all signalActives to 0
		fadeOut(map->zones[i].signals[0]);		// stopping i-th signal player if playing
		if(map->zones[i].signalActive == 1) {
			map->zones[i].signalActive = 0;
			map->zones[i].prevSignalState = 0;
			signalString += "stop "+ofToString(i+1)+" ";		
		} else {
			map->zones[i].prevSignalState = 0;
		}
	}
	graphicState = 3;

	// stop  intro and outro and music
	fadeOut(map->music[0]);
	fadeOut(map->music[1]);
	fadeOut(map->music[authorID]);

	// starting atmo player
	// fadeIn(map->zones[insideAtmoID].atmo[0]); // chnaged to scene start here

	// TODO: start scene here
	int i, p, s;
	s = insideAtmoID ;
	p = map->zones[s].partID; // current p
	if(map->zones[s].scenes[p].finished == 1) {

		if (map->zones[s].partID < map->zones[s].numberOfScenes-1) {	// it is NOT the last scene
			map->zones[s].partID++;							// increment partID
			//			printf("incrementing zone[%d].partID to %d\n", s, map->zones[s].partID);
			p = map->zones[s].partID;						// update p
			map->zones[s].scenes[p].elapsedTime = 0;		// reset elapsedTime for next scene
		}
	}

	p = map->zones[s].partID;
	if(map->zones[s].scenes[p].finished == 0){
		sceneGraphicState = 1; // full alpha
	} else {
		sceneGraphicState = 0; // reduced alpha
	}

	// starting scene player if it was off
	if(p < map->zones[s].numberOfScenes){
		fadeIn(map->zones[s].scenes[p]);
	} else {
		fadeIn(map->zones[s].atmo[1]);
	}

}
示例#6
0
文件: lhpControl.cpp 项目: j45ch/lhp
void lhpControl::leaveAtmo()
{
	decisionString = "exit atmo "+ofToString(prevAtmoID+1);
	graphicState = 2;
	// fadeOut(map->zones[prevAtmoID].atmo[0]);	// fade out atmo1 if playing
	fadeOut(map->zones[prevAtmoID].atmo[1]);	// fade out atmo2 if playing
	
	int ID = map->zones[prevAtmoID].partID;
	fadeOut(map->zones[prevAtmoID].scenes[ID]); // also stop scene
	
	fadeIn(map->music[authorID]);				// restart music activity 
	moreSignalChecks();
}
示例#7
0
void CopyGui::on_btnEdit_clicked()
{
    checkEdit = true;
    QModelIndex modelBarcode = queryModel->index(ui->tableView->currentIndex().row(), 1, QModelIndex());
    QModelIndex modelBorrowingStatus = queryModel->index(ui->tableView->currentIndex().row(), 2, QModelIndex());
    QModelIndex modelTimeBorrowed = queryModel->index(ui->tableView->currentIndex().row(), 3, QModelIndex());
    QModelIndex modelDate = queryModel->index(ui->tableView->currentIndex().row(), 4, QModelIndex());
    QModelIndex modelTimeBorrow = queryModel->index(ui->tableView->currentIndex().row(), 5, QModelIndex());

    ui->lnCPBarCode->setText(modelBarcode.data().toString());
    ui->cbCPStatus->setCurrentText(modelBorrowingStatus.data().toString());
    ui->lnCPTimeBorrowed->setText(modelTimeBorrowed.data().toString());
    //ui->lnCPDateBorrow->setText(modelDate.data().toString());
    ui->dateBorrow->setDate(QDate::fromString(modelDate.data().toString(), "yyyy-MM-dd"));
    ui->lnCPTimeBorrow->setText(modelTimeBorrow.data().toString());

    ui->btnCPAdd->setText("Edit");

    if(checkHide == false){
      ui->widget->show();
      fadeIn(ui->widget);
      checkHide = true;
    }else if(checkHide == true){
      fadeOut(ui->widget);
      checkHide = false;
    }
}
示例#8
0
XineEngine::~XineEngine()
{
    // Wait until the fader thread is done
    if( s_fader ) {
        m_stopFader = true;
        s_fader->resume(); // safety call if the engine is in the pause state
        s_fader->wait();
    }

    delete s_fader;
    delete s_outfader;

    if( PanaConfig::fadeoutOnExit() ) {
        bool terminateFader = false;
        fadeOut( PanaConfig::fadeoutLength(), &terminateFader, true ); // true == exiting
    }

    if( m_xine )       xine_config_save( m_xine, configPath() );

    if( m_stream )     xine_close( m_stream );
    if( m_eventQueue ) xine_event_dispose_queue( m_eventQueue );
    if( m_stream )     xine_dispose( m_stream );
    if( m_audioPort )  xine_close_audio_driver( m_xine, m_audioPort );
    if( m_post )       xine_post_dispose( m_xine, m_post );
    if( m_xine )       xine_exit( m_xine );

    debug() << "xine closed\n";

    debug() << "Scope statistics:\n"
            << "  Average list size: " << Log::bufferCount / Log::scopeCallCount << endl
            << "  Buffer failure:    " << double(Log::noSuitableBuffer*100) / Log::scopeCallCount << "%\n";
}
示例#9
0
void ECandle::setState(const CandleState newState)
//переключение в новое состояние
{
#ifdef DEBUG_ECANDLE
	Serial.print("ECandle::setState() ID=");
	int tmp = getID();
	Serial.print( tmp );
	Serial.print(" new State=");
	Serial.println(newState);
#endif	
	switch ( newState ) {
		case csOn:
			this->currentState = csOn;
			on();
			break;
		case csOff:
			this->currentState = csOff;
			off();
			break;
		case csFadeIn: //?????
			this->currentState=csFadeIn;
			fadeIn();
			break;
		case csFadeOut:  //?????
			this->currentState = csFadeOut;
			fadeOut();
			break;		
		case csFlickering: //??????
			this->currentState = csFlickering;
			startFlickering();
			break;		
	} //switch newState		
};		
示例#10
0
文件: game.c 项目: dibas/portalDS
void killGame(void)
{
	fadeOut();
	NOGBA("KILLING IT");
	freePlayer();
	freeEnergyBalls();
	freeBigButtons();
	freeCubes();
	freeDoors();
	freeElevators();
	freeEmancipation();
	freePlatforms();
	freeTimedButtons();
	freeTurrets();
	freeWallDoors();
	freeSludge();
	freeRoom(&gameRoom);
	freePortals();
	freeState(NULL);
	freeSound();
	freePause();

	resetAllPI();

	NOGBA("END mem free : %dko (%do)",getMemFree()/1024,getMemFree());
}
示例#11
0
// This method creates the control for the first time. It should only be called
// on creation
void LibraryMenuControl::init(QSharedPointer<Library>& library)
{
	destroy();

	if (!winOS->GetLibraryManager())
		return;
	
	getStyle().setFloating(true);
	
	_dropDownMenu = new DropDownMenu();
	
	LibraryMenuItem* toSelect = NULL;
	const QList< QSharedPointer<Library> >& libraries = winOS->GetLibraryManager()->getLibraries();
	QListIterator< QSharedPointer<Library> > iter(libraries);
	while (iter.hasNext())
	{
		QSharedPointer<Library> lib = iter.next();
		LibraryMenuItem* item = new LibraryMenuItem(lib);
		if (lib->getHashKey().startsWith(QT_NT("usr_")) && library != lib)
			item->setDeleteable(true);
		_dropDownMenu->addItem(item);
		if (lib->getHashKey() == library->getHashKey())
			toSelect = item;
	}
	
	BrowseFolderMenuItem* browseFolder = new BrowseFolderMenuItem(QString("More places..."));
	_dropDownMenu->addItem(browseFolder);

	if (toSelect)
		_dropDownMenu->select(toSelect);

	this->addItem(_dropDownMenu);
	scnManager->registerOverlay(this);
	fadeOut(_unHoveredAlpha);
}
示例#12
0
void CopyGui::on_btnSelectBorrower_clicked()
{

    QModelIndex current_index = ui->tableView->currentIndex();
    QModelIndex current_index_id = queryModel->index(current_index.row(), 0, QModelIndex());
    QModelIndex current_index_status = queryModel->index(current_index.row(),2,QModelIndex());

    int days_borrow = ui->spinDaysBorrow->text().toInt();


    qDebug() << current_index_id.data().toInt() << " - "<< current_index_status.data().toString();
    int copy_id = current_index_id.data().toInt();
    int borrower_id = ui->cbBorrower->itemData(ui->cbBorrower->currentIndex()).toInt();
    QSqlQuery qry;
    qry.prepare( "UPDATE borrowers SET items_borrowed = items_borrowed +1 WHERE id=:id ");
    qry.bindValue(":id", borrower_id);
    if( !qry.exec() )
        qDebug() << "update borrower fail: " <<qry.lastError();

    qry.prepare("UPDATE copy SET status='Borrowed', times_borrow = times_borrow + 1, days_borrowed = :days_borrow, borrow_date = date('now'), borrowed_by = :borrower_id WHERE id=:copy_id ");
    qry.bindValue(":days_borrow",days_borrow);
    qry.bindValue(":copy_id",copy_id);
    qry.bindValue(":borrower_id",borrower_id);
    if( !qry.exec() )
        qDebug() << "update copy fail "<< qry.lastError();

    fadeOut(ui->widget_2);
    checkHide2=false;
    readData();


}
示例#13
0
MessageBubble::MessageBubble(QGraphicsWidget* parent)
: GraphicsHudWidget(parent)
, d(new MessageBubblePrivate)
{
    d->mWidget = new QGraphicsWidget;
    d->mCountDownWidget = new CountDownWidget;
    d->mCountDownWidget->setValue(1);
    d->mLabel = new GraphicsHudLabel;

    QTimeLine* timeLine = new QTimeLine(TIMEOUT, this);
    connect(timeLine, SIGNAL(valueChanged(qreal)),
            SLOT(slotTimeLineChanged(qreal)));
    connect(timeLine, SIGNAL(finished()),
            SLOT(fadeOut()));
    connect(this, SIGNAL(fadedOut()),
            SLOT(deleteLater()));
    timeLine->start();

    d->mLayout = new QGraphicsLinearLayout(d->mWidget);
    d->mLayout->setContentsMargins(0, 0, 0, 0);
    d->mLayout->addItem(d->mCountDownWidget);
    d->mLayout->addItem(d->mLabel);

    init(d->mWidget, GraphicsHudWidget::OptionCloseButton);
}
示例#14
0
// create window three for the addition
float* fillWindowThree(int fadingWindow, int startFade, float* windowOne, float* windowTwo) {

    // Size of the window three
    int windowThreeSize = fadingWindow * 2;

    // initial value of window three
    float* windowThree = new float[windowThreeSize];

    for (int s = 0; s < fadingWindow; s++) {
        windowThree[s] = windowOne[startFade++];
        windowThree[fadingWindow + s] = windowTwo[s];
    }


    // all fading position in window three
    for (int i = 0; i < fadingWindow; i++) {
        windowThree[i] *= fadeIn(i, fadingWindow);

    }

    for (int j = fadingWindow; j < windowThreeSize; j++) {
        windowThree[j] *= fadeOut(j, fadingWindow);

    }

    return windowThree;
}
示例#15
0
void CompositorHelper::toggle() {
    if (_fadeInAlpha) {
        fadeOut();
    } else {
        fadeIn();
    }
}
示例#16
0
void FadeToBlack::process(unsigned char* _buf, unsigned char * _oBuf, int _w, int _h, float _pos){
    if(multiplier > 0.0){
        fadeOut(_buf,_oBuf,_w,_h,_pos);
    } else {
        fadeIn(_buf,_oBuf,_w,_h,_pos);
    }
}
示例#17
0
//! Main Menu events
void CSceneMenu::manageMainMenu()
{
  if (!QuitIsFading && !NewGameIsFading) {
    if (Control->commandEntered(NEngine::NControl::ECI_MENU_DOWN, NEngine::NEvent::EET_ONCE)) {
      MainMenu->nextOption();
    }
    if (Control->commandEntered(NEngine::NControl::ECI_MENU_UP, NEngine::NEvent::EET_ONCE)) {
      MainMenu->prevOption();
    }
    if (Control->commandEntered(NEngine::NControl::ECI_MENU_OK, NEngine::NEvent::EET_ONCE)) {
      switch (MainMenu->getCurrentOption()) {
        case 0:
          // Fade Out and boolean to go to gameplay (demo)
          fadeOut(0.5f);
          NewGameIsFading = true;
          break;
          /*
        case 1:
          createSaveListMenu();
          break;
        case 2:
          createOptionMenu();
          break;
          */
        case 1:
          // Fade Out and boolean to quit the game
          fadeOut(0.5f);
          QuitIsFading = true;
          break;
        default: break;
      }
    }
  } else {
    if (OutFader->isReady()) {
      if (NewGameIsFading) {
        // New Game
        NEngine::NCore::CGame::getCurrentSave()->newGame(NEngine::NGameplay::EDL_MEDIUM);
      }
      if (QuitIsFading) {
        // Quit to OS
        NEngine::NCore::CGame::quit();
      }
    }
  }
}
示例#18
0
文件: lhpControl.cpp 项目: j45ch/lhp
void lhpControl::enterPerimeterFirst()
{
	decisionString = "first time entering perimeter ";
	graphicState = 1;	

	fadeOut(map->music[1]);				// stopping outro if still playing
	fadeIn(map->music[2]);				// play entry sequence

}
示例#19
0
void ImageItem::mousePressEvent(QMouseEvent *e)
{
	Q_UNUSED(e);

	if(!mIsAnimationFinished) // still animating
		return;

	fadeOut();
}
void setup (){

  fadeIn(10, 5);
  bmp_draw("robotsh",0,0);
  delay(2000);
  fadeOut(10, 5);
  //display the splash screen 
  delay(100);
  fadeIn(10, 5);
  bmp_draw("stisplsh", 0, 0);
  
  //Serial.begin(9600); //set up the TouchShield serial connection
  //delay(3000); //and wait a little for the Arduino to boot up

  //Serial.print('U'); //send a sync character to the Arduino
  fadeOut(10, 5);
  fadeIn(10,5);
}
示例#21
0
bool LibraryMenuControl::onMouseDown(MouseOverlayEvent& mouseEvent)
{
	if (_dropDownMenu && !intersects(mouseEvent.getAbsolutePosition(), _dropDownMenu->getBounds()))
	{
		_dropDownMenu->slideClosed();
		fadeOut(_unHoveredAlpha);
	}
	return AbsoluteOverlayLayout::onMouseDown(mouseEvent);
}
示例#22
0
// prepare window one for the addition
float* editWindowOne(int fadingWindow, int startFade, float* windowOne) {

    for (int i = 0; i < fadingWindow; i++) {
        windowOne[startFade++] *= fadeOut(i, fadingWindow);

    }

    return windowOne;
}
示例#23
0
文件: lhpControl.cpp 项目: j45ch/lhp
void lhpControl::moreSignalChecks()
{
	// check all Signals to see whether we're inside a Signalradius
	// RULE: no more than 3 Signal are allowed to overlap
	signalString = "signal: ";
	insideSignalFlag = 0;
	decisionString = "inside perimeter ";
	
	for(int i = 0; i < map->numberOfZones; i++) {			// run through all zones
		int ID = map->zones[i].partID;						// get scene ID for the zone
		fadeOut(map->zones[i].scenes[ID]);					// stopping any scene player that might have been playing
		// check to see if we're inside the signal radius AND outside an atmo radius		
		if(map->zones[i].distance <= map->zones[i].radius[2] &&
		   map->zones[i].distance > map->zones[i].radius[1]) 
		{ 
			if(insideSignalFlag == 0) {
				decisionString = "inside signal ";			// set if ANY signal reached
				insideSignalFlag = 1;
			}
			// // printf("inside zone %d signal radius: active %d, prev %d\n", i, map->zones[i].signalActive, map->zones[i].prevSignalState);
			map->zones[i].signalActive = 1;
			if(map->zones[i].prevSignalState == 0) {		// it was off -> now we move inside				
				map->zones[i].prevSignalState = 1;
				signalString += "start "+ofToString(i+1)+" ";
				decisionString += ofToString(i+1);			// set if ANY signal reached
				fadeIn(map->zones[i].signals[0]);			// starting i-th signal player if it was not playing
			} else {											// unchanged state // stay inside 
				signalString += "run "+ofToString(i+1)+" ";
				decisionString += ofToString(i+1)+" ";		// set if ANY signal reached	
			}
		} else {
			// we're outside the signal radius
			map->zones[i].signalActive = 0;
			if(map->zones[i].prevSignalState == 1) {		// prevState was active -> we just moved outside
				map->zones[i].prevSignalState = 0;
				decisionString += "signal "+ofToString(i+1)+" stop ";
				fadeOut(map->zones[i].signals[0]);			// stopping i-th signal player if it was playing
			} else {	
				map->zones[i].prevSignalState = 0;			// remaining outside
			}
		}
	}
}
示例#24
0
/* This is the function that is called when the program starts. */
int main (int argc, char *argv[])
{
  /* Variable declarations. */
  struct wavpcm_input input;
  struct wavpcm_output output;
  short buffer[BUFFERSIZE]; 
  short reconstructedBuffer[BUFFERSIZE];
  int bufPos, bufIndex, read;

  struct fade_chunk chunk;
  chunk.fadeOutCoefficient = FADEOUTCOEFFICIENT;
  printf("chunk.fadeOutCoefficient: %f\n",chunk.fadeOutCoefficient);
  chunk.currentFadeCoefficient = 1;

  memset(&input, 0, sizeof(struct wavpcm_input));
  input.resource=INPUTWAVFILE;
  memset(&output, 0, sizeof(struct wavpcm_output));
  output.resource=OUTPUTWAVFILE;

  /* First open input file and parse header, */
  wavpcm_input_open (&input);
  /* and then use this same header configuration for the output file */
  wavpcm_output_copy_settings(&input, &output);
  wavpcm_output_open(&output);
  
  /*bufPos expressed in temporal samples*/
  for (bufPos=0; bufPos<input.samplesAvailable; bufPos+=(BUFFERSIZE/2)) {
    /* Try to read BUFFERSIZE samples (16 bits, pairwise identical if input is mono, interleaved if input is stereo)  */
    /* into buffer, with read the actual amount read (expressed in bytes! =  (2*read)/(channels * bitDepth/8) array elements)*/
    read = wavpcm_input_read (&input, buffer);

    /* transform buffer */
    if(bufPos<(2*(BUFFERSIZE/2)))
      {
      printf("chunk.fadeOutCoefficient: %f\n",chunk.fadeOutCoefficient);
      printf("chunk.currentFadeCoefficient: %f\n",chunk.currentFadeCoefficient);
      }

    fadeOut(buffer,&chunk);

    /* if required, dump compressed output */

    /* inverse transform buffer */
    for (bufIndex=0; bufIndex<BUFFERSIZE; bufIndex++)
      reconstructedBuffer[bufIndex]=buffer[bufIndex];

    /* dump reconstructed output */
    wavpcm_output_write (&output, reconstructedBuffer, read);
  }

  /* finalize output (write header) and close */
  wavpcm_output_close (&output);  
  /* Return successful exit code. */
  return 0;
}
示例#25
0
文件: main.c 项目: motezazer/rxTools
int main(){
	if (Initialize())
		while (1);

	//7.X Keys stuff
	File KeyFile;
	const char *keyfile = "/slot0x25KeyX.bin";
	if(FileOpen(&KeyFile, keyfile, 0)){
		uint8_t keyX[16];
		FileRead(&KeyFile, keyX, 16, 0);
		FileClose(&KeyFile);
		setup_aeskeyX(0x25, keyX);
	}else{
		if (sysver < 7) {
			ConsoleInit();
			ConsoleSetTitle(strings[STR_WARNING]);
			print(strings[STR_ERROR_OPENING], keyfile);
			print(strings[STR_WARNING_KEYFILE]);
			print(strings[STR_PRESS_BUTTON_ACTION], strings[STR_BUTTON_A], strings[STR_CONTINUE]);
			ConsoleShow();
			WaitForButton(BUTTON_A);
		}
	}

	//That's the Main Menu initialization, easy and cool
	OpenAnimation();
	MenuInit(&MainMenu);
	MenuShow();
	while (true) {
		uint32_t pad_state = InputWait();
		if (pad_state & (BUTTON_DOWN | BUTTON_RIGHT | BUTTON_R1)) MenuNextSelection(); //I try to support every theme style
		if (pad_state & (BUTTON_UP   | BUTTON_LEFT  | BUTTON_L1)) MenuPrevSelection();
		if (pad_state & BUTTON_A)    	{ OpenAnimation(); MenuSelect(); }
		if (pad_state & BUTTON_SELECT)	{ fadeOut(); ShutDown(); }
		if (pad_state & BUTTON_START)	{ fadeOut(); returnHomeMenu(); }
		TryScreenShot();
		MenuShow();
	}

	FSDeInit();
	return 0;
}
示例#26
0
void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason) {
    auto avatar = std::static_pointer_cast<OtherAvatar>(removedAvatar);
    AvatarHashMap::handleRemovedAvatar(avatar, removalReason);
    avatar->tearDownGrabs();

    avatar->die();
    queuePhysicsChange(avatar);

    // remove this avatar's entities from the tree now, if we wait (as we did previously) for this Avatar's destructor
    // it might not fire until after we create a new instance for the same remote avatar, which creates a race
    // on the creation of entities for that avatar instance and the deletion of entities for this instance
    avatar->removeAvatarEntitiesFromTree();
    if (removalReason != KillAvatarReason::AvatarDisconnected) {
        if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble) {
            emit AvatarInputs::getInstance()->avatarEnteredIgnoreRadius(avatar->getSessionUUID());
            emit DependencyManager::get<UsersScriptingInterface>()->enteredIgnoreRadius();
        }

        workload::Transaction workloadTransaction;
        workloadTransaction.remove(avatar->getSpaceIndex());
        _space->enqueueTransaction(workloadTransaction);

        const render::ScenePointer& scene = qApp->getMain3DScene();
        render::Transaction transaction;
        avatar->removeFromScene(avatar, scene, transaction);
        scene->enqueueTransaction(transaction);
    } else {
        // remove from node sets, if present
        DependencyManager::get<NodeList>()->removeFromIgnoreMuteSets(avatar->getSessionUUID());
        DependencyManager::get<UsersScriptingInterface>()->avatarDisconnected(avatar->getSessionUUID());
        render::Transaction transaction;
        auto scene = qApp->getMain3DScene();
        avatar->fadeOut(transaction, removalReason);

        workload::SpacePointer space = _space;
        transaction.transitionFinishedOperator(avatar->getRenderItemID(), [space, avatar]() {
            if (avatar->getLastFadeRequested() != render::Transition::Type::USER_LEAVE_DOMAIN) {
                // The avatar is using another transition besides the fade-out transition, which means it is still in use.
                // Deleting the avatar now could cause state issues, so abort deletion and show message.
                qCWarning(interfaceapp) << "An ending fade-out transition wants to delete an avatar, but the avatar is still in use. Avatar deletion has aborted. (avatar ID: " << avatar->getSessionUUID() << ")";
            } else {
                const render::ScenePointer& scene = qApp->getMain3DScene();
                render::Transaction transaction;
                avatar->removeFromScene(avatar, scene, transaction);
                scene->enqueueTransaction(transaction);

                workload::Transaction workloadTransaction;
                workloadTransaction.remove(avatar->getSpaceIndex());
                space->enqueueTransaction(workloadTransaction);
            }
        });
        scene->enqueueTransaction(transaction);
    }
}
示例#27
0
void TeenAgentEngine::loadScene(byte id, uint16 x, uint16 y, byte o) {
	if (scene->last_event_type() != SceneEvent::kCreditsMessage)
		fadeOut();

	SceneEvent event(SceneEvent::kLoadScene);
	event.scene = id;
	event.dst.x = x;
	event.dst.y = y;
	event.orientation = o;
	scene->push(event);
	fadeIn();
}
示例#28
0
文件: hid.c 项目: ArnoJuan/rxTools
static void bgWork()
{
	TryScreenShot();

	// Check whether HOME or POWER button has been pressed
	if (*(volatile uint8_t *)0x10147021 == 13) {
		fadeOut();
		// Return to HOME menu
		i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 2);
		while (1);
	}
}
示例#29
0
文件: lhpControl.cpp 项目: j45ch/lhp
void lhpControl::leavePerimeter()
{
	decisionString = "exit perimeter";
	graphicState = 5;
	
	fadeOut(map->music[0]);				// stop Intro if running
	fadeOut(map->music[2]);				// play entry sequence

	fadeOut(map->music[authorID]);		// stop Music if running

	fadeIn(map->music[1]);				// starting Outro
	
	for(int i = 0; i < map->numberOfZones; i++) {	// set all signalActives to 0
		// force ALL zone players off: signal, atmo, scene[ID]
		fadeOut(map->zones[i].signals[0]);
		// fadeOut(map->zones[i].atmo[0]);
		fadeOut(map->zones[i].atmo[1]);
		int ID = map->zones[i].partID;
		fadeOut(map->zones[i].scenes[ID]);

		if(map->zones[i].signalActive == 1) {
			signalString += "stop "+ofToString(i+1)+" ";
			map->zones[i].signalActive = 0;
			map->zones[i].prevSignalState = 1;
		} else {
			map->zones[i].signalActive = 0;
			map->zones[i].prevSignalState = 0;
		}		
	}
}
示例#30
0
void CopyGui::on_btnCPAdd_clicked()
{
    //Add new collection to database
    QString barcode = ui->lnCPBarCode->text();
    QString status = ui->cbCPStatus->currentText();
    QString times_borrow = ui->lnCPTimeBorrowed->text();
    QString borrow_date = ui->dateBorrow->date().toString("yyyy-MM-dd");
    QString days_borrowed = ui->lnCPTimeBorrow->text();

    QSqlQuery qry;
    if (!checkEdit) {
        qry.prepare( "CREATE TABLE IF NOT EXISTS copy (id INTEGER UNIQUE PRIMARY KEY , barcode INTEGER UNIQUE, status VARCHAR(30), times_borrow INTEGER, borrow_date VARCHAR(30), days_borrowed INTEGER, collection_id INTEGER,borrowed_by INTEGER )" );
        if( !qry.exec() )
        qDebug() << qry.lastError();
        else
        qDebug() << "Table created!";


        qry.prepare( "INSERT INTO copy (barcode, status, times_borrow, days_borrowed, collection_id) VALUES (:barcode, :status, :times_borrow, :days_borrowed, :collection_id)" );
        qry.bindValue(":barcode",barcode);
        qry.bindValue(":status",status);
        qry.bindValue(":times_borrow",times_borrow);
        qry.bindValue(":borrow_date",borrow_date);

        qry.bindValue(":collection_id",selected_id);
        if( !qry.exec() )
        qDebug() << "error on inserted" <<qry.lastError();
        else
        qDebug( "Inserted!" );
    } else {
        int copy_id =queryModel->index(ui->tableView->currentIndex().row(),0,QModelIndex()).data().toInt();
        qry.prepare("UPDATE copy SET barcode=:barcode, status=:status, times_borrow=:times_borrow, borrow_date=:borrow_date, days_borrowed=:days_borrowed WHERE id=:id");
        qry.bindValue(":id",copy_id);
        qry.bindValue(":barcode",barcode);
        qry.bindValue(":status",status);
        qry.bindValue(":times_borrow",times_borrow);
        qry.bindValue(":borrow_date",borrow_date);
        qry.bindValue(":days_borrowed",days_borrowed);

        if( !qry.exec() )
        qDebug() << "error on edit copy" <<qry.lastError();
        else
        qDebug( "Edited!" );
    }


    //Fade out the add form
    fadeOut(ui->widget);
    checkHide = false;
    readData();
}