void Music::Play(Music::Setting setting) { switch(setting) { case MENU: menu_snd.play(); battle_snd.stop(); break; case BATTLE: menu_snd.stop(); battle_snd.play(); break; } }
void newGame () { music.stop(); music.openFromFile("./dati/audio/Morricone.ogg"); music.play(); main_camera.setLocRot(locRot(0,0,0,0,0,0)); int j; t=reset_time(t); for(j=0; j<18; j++){ m[j]=reset_motion(m[j]); } livello=1; // for the score score = 0; gun0.bullet_number = BULLET_NUMBER; first = TRUE; return; }
static void swap_to_song_type(music_purpose new_purpose) { if(new_purpose == NONE) { currently_playing.stop(); current_song = -1; return; } ///at the moment do shit int new_song = -1; for(int i=0; i<(int)file_names.size(); i++) { int song_offset = (i + current_song) % file_names.size(); music_purpose current_purpose = (music_purpose)purpose[song_offset]; if((current_purpose & new_purpose) > 0) { new_song = song_offset; break; } } if(new_song == -1) return; if(new_song == current_song && currently_playing.getStatus() != sf::SoundSource::Stopped) return; currently_playing.stop(); currently_playing.openFromFile("res/" + file_names[new_song]); currently_playing.play(); current_song = new_song; }
void ManageSound() { assert( now_log != 0 ); // null pointer is unexceptable and there is no solution //stop whatever Sound Effect playing right now SoundFx.stop(); //empty the queue if there is still any member on the queue while( !sound_queue.empty() ) sound_queue.pop(); for( unsigned i = 0; i < now_log -> soundFx_path.size(); ++i ){ sound_queue.push( &(now_log->soundFx_path[i]) ); } if( now_log -> music_path.size() != 0 ){ SoundMusic.openFromFile( now_log -> music_path ); } }
void levelChanger(void) { if (score >= 100) { if(livello==3){ //musica music.stop(); music.openFromFile("./dati/audio/Stuck_In_Guacamole.ogg"); music.play(); menu_id=4; } else{ changeLevel(UP); reload(); score = 0; } } return; }
void stop() { sound.stop(); }
void Music::Stop() { music.stop(); }
void TWindows :: ResumeMenu(sf::RenderWindow& oknoAplikacji, bool& skip, sf::Music& Gmusic, int TGmusic) { while( oknoAplikacji.isOpen() ) { //CZYSZCZENIE OKNA EventsWin(oknoAplikacji, tribe, option, skip, 1); if(skip==true) if(TGmusic!=-1) { Gmusic.stop(); } sf::Texture textur; bool viewtext=textur.loadFromFile("tloczarne.png"); if(viewtext==true) { sf::Sprite blackpic; blackpic.setColor(sf::Color(0, 0, 0, 125)); blackpic.setTexture(textur); blackpic.setScale(10,10); oknoAplikacji.draw(blackpic); } sf::Font czcionka; sf::Text costam,costam1, costam2; if(czcionka.loadFromFile("XG-pixo.ttf")) { costam.setFont(czcionka); //TEXT W MENU TYTULOWYM costam.setString("*PAUSE*"); costam.setCharacterSize(60); //costam.setStyle(sf::Text::Bold); costam.setPosition(100, 50); costam.setScale(2,2); costam.setColor(sf::Color(255,255,255)); oknoAplikacji.draw(costam); //RESUME costam.setString("RESUME"); costam.setCharacterSize(20); //costam.setStyle(sf::Text::Bold); costam.setPosition(295, 300); costam.setScale(2,2); if(option==0) { costam.setColor(sf::Color(125,125,125)); } else { costam.setColor(sf::Color(255,255,255)); } oknoAplikacji.draw(costam); //EXIT costam.setString("EXIT"); if(option==0) { costam.setColor(sf::Color(255,255,255)); } else { costam.setColor(sf::Color(125,125,125)); } costam.setPosition(340, 350); oknoAplikacji.draw(costam); } oknoAplikacji.display(); if(tribe==1 || skip==true) break; } oknoAplikacji.clear(sf::Color( 10, 10, 10 )); tribe=0; option=0; }
void ambiance::tick(int madness) { ambMadness = 101-madness; ambMaxVolume = 100; // SO THE ENGINE BEGINS // // IF NOT PLAYING AA /////////////////////////////////////////////////// if (ALLambAA[ambAARandom].getStatus() == 0) { // FILE SELECTOR // ambAARandom = rand()% ARRAY_SIZE(ambAAFile); //ALLambAA[ambAARandom].openFromFile(ambAAFile[ambAARandom]); // VOLUME RESET // ALLambAA[ambAARandom].setVolume(0); ambAAVolume = 0; ambAADynamics = 100000; // LENGTH // ambAALength = rand() % 60 + 40; ambAASecCounter = 0; // FADE // ambAAFadeSpeed = rand()% 2 + 3; ambAAFadeOut = false; // PITCH // ambAAPitch = rand() % 100; ambAAPitch = ambAAPitch/200+0.75; ALLambAA[ambAARandom].setPitch(ambAAPitch); // PLAY // ALLambAA[ambAARandom].play(); } // IF NOT PLAYING AB ///////////////////////////////////////////////////////// if (ALLambAB[ambABRandom].getStatus() == 0) { // FILE SELECTOR // ambABRandom = rand()% ARRAY_SIZE(ambABFile); //ALLambAB[ambABRandom].openFromFile(ambABFile[ambABRandom]); // VOLUME RESET // ALLambAB[ambABRandom].setVolume(0); ambABVolume = 0; ambABDynamics = 100000; // LENGTH // ambABLength = rand() % 30 + 30; ambABSecCounter = 0; // FADE // ambABFadeSpeed = rand()% 2 + 3; ambABFadeOut = false; // PITCH // ambABPitch = rand() % 100; ambABPitch = ambABPitch/200+0.75; ALLambAB[ambABRandom].setPitch(ambABPitch); // PLAY // ALLambAB[ambABRandom].play(); } // FADE AA //////////////////////////////////////////////////////////////// // COUNTERS // ambAAFrameCounter++; if (ambAAFrameCounter>60) { ambAAFrameCounter = 0; ambAASecCounter++; } // FADE // if (ALLambAB[ambABRandom].getStatus() == 2) { ambAADynamics = 10000*(ambMadness*0.25/100) + 2500; // FADE VOLUME UP // if (ambAAVolume + ambAAFadeSpeed < ambAADynamics && ambAAFadeOut == false) { ambAAVolume = ambAAVolume + ambAAFadeSpeed; ambAAIntToFloat = ambAAVolume; ALLambAA[ambAARandom].setVolume(ambAAIntToFloat/100*(ambMaxVolume/100)); } // FADE VOLUME DOWN // else if (ambAAVolume > ambAADynamics && ambAAFadeOut == false) { ambAAVolume = ambAAVolume - ambAAFadeSpeed*2; ambAAIntToFloat = ambAAVolume; ALLambAA[ambAARandom].setVolume(ambAAIntToFloat/100*(ambMaxVolume/100)); } // FADE OUT // if (ambAASecCounter > ambAALength && ambABFadeOut == false) { ambAAFadeOut = true; if (ambAAVolume > ambAAFadeSpeed) { ambAAVolume = ambAAVolume - ambAAFadeSpeed; ambAAIntToFloat = ambAAVolume; ALLambAA[ambAARandom].setVolume(ambAAIntToFloat/100*(ambMaxVolume/100)); } // STOP // if (ambAAVolume <= ambAAFadeSpeed*2) { ambAAVolume = 0; ambAAFadeOut = false; ALLambAA[ambAARandom].setVolume(0); ALLambAA[ambAARandom].stop(); } } } // FADE AB //////////////////////////////////////////////////////////////// // COUNTERS // ambABFrameCounter++; if (ambABFrameCounter>60) { ambABFrameCounter = 0; ambABSecCounter++; } // FADE // if (ALLambAB[ambABRandom].getStatus() == 2) { ambABDynamics = 10000*(ambMadness*0.4/100) + 1000; // FADE VOLUME UP // if (ambABVolume + ambABFadeSpeed < ambABDynamics && ambABFadeOut == false) { ambABVolume = ambABVolume + ambABFadeSpeed; ambABIntToFloat = ambABVolume; ALLambAB[ambABRandom].setVolume(ambABIntToFloat/100*(ambMaxVolume/100)); } // FADE VOLUME DOWN // else if (ambABVolume > ambABDynamics && ambABFadeOut == false) { ambABVolume = ambABVolume - ambABFadeSpeed*2; ambABIntToFloat = ambABVolume; ALLambAB[ambABRandom].setVolume(ambABIntToFloat/100*(ambMaxVolume/100)); } // FADE OUT // if (ambABSecCounter > ambABLength && ambAAFadeOut == false) { ambABFadeOut = true; if (ambABVolume > ambABFadeSpeed) { ambABVolume = ambABVolume - ambABFadeSpeed; ambABIntToFloat = ambABVolume; ALLambAB[ambABRandom].setVolume(ambABIntToFloat/100*(ambMaxVolume/100)); } // STOP // if (ambABVolume <= ambABFadeSpeed*2) { ambABVolume = 0; ambABFadeOut = false; ALLambAB[ambABRandom].setVolume(0); ALLambAB[ambABRandom].stop(); } } } // IF NOT PLAYING BA ///////////////////////////////////////////////////////// if (ALLambBA[ambBARandom].getStatus() == 0 && ambMadness > ambBATriggerLevel) { // FILE SELECTOR // ambBARandom = rand()% ARRAY_SIZE(ambBAFile); //ALLambBA[ambBARandom].openFromFile(ambBAFile[ambBARandom]); // RESETS // ALLambBA[ambBARandom].setVolume(0); ambBAUpDown = 0; ambBAOffOn = 0; // PLAY // ALLambBA[ambBARandom].play(); } // IF NOT PLAYING BB ///////////////////////////////////////////////////////// if (ALLambBB[ambBBRandom].getStatus() == 0 && ambMadness > ambBBTriggerLevel) { // FILE SELECTOR // ambBBRandom = rand()% ARRAY_SIZE(ambBBFile); //ALLambBB[ambBBRandom].openFromFile(ambBBFile[ambBBRandom]); // RESETS // ALLambBB[ambBBRandom].setVolume(0); ambBBUpDown = 0; ambBBOffOn = 0; // PLAY // ALLambBB[ambBBRandom].play(); } // IF NOT PLAYING BC ///////////////////////////////////////////////////////// if (ALLambBC[ambBCRandom].getStatus() == 0 && ambMadness > ambBCTriggerLevel) { // FILE SELECTOR // ambBCRandom = rand()% ARRAY_SIZE(ambBCFile); //ALLambBC[ambBCRandom].openFromFile(ambBCFile[ambBCRandom]); // RESETS // ALLambBC[ambBCRandom].setVolume(0); ambBCUpDown = 0; ambBCOffOn = 0; // PLAY // ALLambBC[ambBCRandom].play(); } // FADE BA //////////////////////////////////////////////////////////////// if (ALLambBA[ambBARandom].getStatus() == 2) { // TRIGGER // ambBAFrameCounter++; if (ambBAOffOn == 0 && ambBAFrameCounter-300 + (ambMadness-ambBATriggerLevel)*7 + rand()% 200 > 500) { ambBAOffOn = 1; ambBAFadeInSpeed = 300 + (ambMadness-ambBATriggerLevel)*5 + rand()% 200; ambBAFadeOutSpeed = 20 + (ambMadness-ambBATriggerLevel)/2 + rand()% 30; ambBAPitch = rand() % 100; ambBAPitch = ambBAPitch/200+0.75; ALLambBA[ambBARandom].setPitch(ambBAPitch*(ambMadness/200)+0.5); } // FADE IN // if (ambBAOffOn == 1 && ambBAUpDown == 0) { ambBAVolume = ambBAVolume + ambBAFadeInSpeed; ambBAIntToFloat = ambBAVolume; ambBAIntToFloat = ambBAIntToFloat/100; ALLambBA[ambBARandom].setVolume(100*(ambBAIntToFloat*ambBAIntToFloat/100*((ambMadness-40)/100)/100)*(ambMaxVolume/100)); if (ambBAVolume > 10000) { ambBAUpDown = 1; } } // FADE OUT // else if (ambBAUpDown == 1) { ambBAVolume = ambBAVolume - ambBAFadeOutSpeed; ambBAIntToFloat = ambBAVolume; ambBAIntToFloat = ambBAIntToFloat/100; ALLambBA[ambBARandom].setVolume(100*(ambBAIntToFloat*ambBAIntToFloat/100*((ambMadness-40)/100)/100)*(ambMaxVolume/100)); if (ambBAVolume <= ambBAFadeOutSpeed*2) { ambBAUpDown = 0; ambBAOffOn = 0; ambBAFrameCounter = 0; ambBAVolume = 0; ambBAIntToFloat = 0; ALLambBA[ambBARandom].setVolume(0); } } // STOP // if (ambMadness < ambBATriggerLevel && ALLambBA[ambBARandom].getVolume() == 0) { ambBAUpDown = 0; ambBAOffOn = 0; ambBAFrameCounter = 0; ambBAVolume = 0; ambBAIntToFloat = 0; ALLambBA[ambBARandom].setVolume(0); ALLambBA[ambBARandom].stop(); } } // FADE BB //////////////////////////////////////////////////////////////// if (ALLambBB[ambBBRandom].getStatus() == 2) { // TRIGGER // ambBBFrameCounter++; if (ambBBOffOn == 0 && ambBBFrameCounter-200 + (ambMadness-ambBBTriggerLevel)*7 + rand()% 200 > 400) { ambBBOffOn = 1; ambBBFadeInSpeed = 300 + (ambMadness-ambBBTriggerLevel)*5 + rand()% 200; ambBBFadeOutSpeed = 20 + (ambMadness-ambBBTriggerLevel)/2 + rand()% 30; ambBBPitch = rand() % 100; ambBBPitch = ambBBPitch/200+0.75; ALLambBB[ambBBRandom].setPitch(ambBBPitch*(ambMadness/200)+0.5); } // FADE IN // if (ambBBOffOn == 1 && ambBBUpDown == 0) { ambBBVolume = ambBBVolume + ambBBFadeInSpeed; ambBBIntToFloat = ambBBVolume; ambBBIntToFloat = ambBBIntToFloat/100; ALLambBB[ambBBRandom].setVolume(100*(ambBBIntToFloat*ambBBIntToFloat/100*((ambMadness-40)/100)/100)*(ambMaxVolume/100)); if (ambBBVolume > 10000) { ambBBUpDown = 1; } } // FADE OUT // else if (ambBBUpDown == 1) { ambBBVolume = ambBBVolume - ambBBFadeOutSpeed; ambBBIntToFloat = ambBBVolume; ambBBIntToFloat = ambBBIntToFloat/100; ALLambBB[ambBBRandom].setVolume(100*(ambBBIntToFloat*ambBBIntToFloat/100*((ambMadness-40)/100)/100)*(ambMaxVolume/100)); if (ambBBVolume <= ambBBFadeOutSpeed*2) { ambBBUpDown = 0; ambBBOffOn = 0; ambBBFrameCounter = 0; ambBBVolume = 0; ambBBIntToFloat = 0; ALLambBB[ambBBRandom].setVolume(0); } } // STOP // if (ambMadness < ambBBTriggerLevel && ALLambBB[ambBBRandom].getVolume() == 0) { ambBBUpDown = 0; ambBBOffOn = 0; ambBBFrameCounter = 0; ambBBVolume = 0; ambBBIntToFloat = 0; ALLambBB[ambBBRandom].setVolume(0); ALLambBB[ambBBRandom].stop(); } } // FADE BC //////////////////////////////////////////////////////////////// if (ALLambBC[ambBCRandom].getStatus() == 2) { // TRIGGER // ambBCFrameCounter++; if (ambBCOffOn == 0 && ambBCFrameCounter-100 + (ambMadness-ambBCTriggerLevel)*7 + rand()% 200 > 300) { ambBCOffOn = 1; ambBCFadeInSpeed = 300 + (ambMadness-ambBCTriggerLevel)*5 + rand()% 200; ambBCFadeOutSpeed = 20 + (ambMadness-ambBCTriggerLevel)/2 + rand()% 30; ambBCPitch = rand() % 100; ambBCPitch = ambBCPitch/200+0.75; ALLambBC[ambBCRandom].setPitch(ambBCPitch*(ambMadness/200)+0.5); } // FADE IN // if (ambBCOffOn == 1 && ambBCUpDown == 0) { ambBCVolume = ambBCVolume + ambBCFadeInSpeed; ambBCIntToFloat = ambBCVolume; ambBCIntToFloat = ambBCIntToFloat/100; ALLambBC[ambBCRandom].setVolume(100*(ambBCIntToFloat*ambBCIntToFloat/100*((ambMadness-40)/100)/100)*(ambMaxVolume/100)); if (ambBCVolume > 10000) { ambBCUpDown = 1; } } // FADE OUT // else if (ambBCUpDown == 1) { ambBCVolume = ambBCVolume - ambBCFadeOutSpeed; ambBCIntToFloat = ambBCVolume; ambBCIntToFloat = ambBCIntToFloat/100; ALLambBC[ambBCRandom].setVolume(100*(ambBCIntToFloat*ambBCIntToFloat/100*((ambMadness-40)/100)/100)*(ambMaxVolume/100)); if (ambBCVolume <= ambBCFadeOutSpeed*2) { ambBCUpDown = 0; ambBCOffOn = 0; ambBCFrameCounter = 0; ambBCVolume = 0; ambBCIntToFloat = 0; ALLambBC[ambBCRandom].setVolume(0); } } // STOP // if (ambMadness < ambBCTriggerLevel && ALLambBC[ambBCRandom].getVolume() == 0) { ambBCUpDown = 0; ambBCOffOn = 0; ambBCFrameCounter = 0; ambBCVolume = 0; ambBCIntToFloat = 0; ALLambBC[ambBCRandom].setVolume(0); ALLambBC[ambBCRandom].stop(); } } // IF NOT PLAYING CA ///////////////////////////////////////////////////////// if (ambMadness > ambCATriggerLevel && ALLambCA[ambCARandom].getStatus() == 0) { // FILE SELECTOR // ambCARandom = rand()% ARRAY_SIZE(ambCAFile); //ALLambCA[ambCARandom].openFromFile(ambCAFile[ambCARandom]); // VOLUME RESET // ALLambCA[ambCARandom].setVolume(0); // PITCH // ambCAPitch = rand() % 100; ambCAPitch = ambCAPitch/400+0.87; ALLambCA[ambCARandom].setPitch(ambCAPitch); // PLAY // ALLambCA[ambCARandom].play(); } // IF NOT PLAYING CB ///////////////////////////////////////////////////////// if ( ambMadness > ambCBTriggerLevel && ALLambCB[ambCBRandom].getStatus() == 0) { // FILE SELECTOR // ambCBRandom = rand()% ARRAY_SIZE(ambCBFile); //ALLambCB[ambCBRandom].openFromFile(ambCBFile[ambCBRandom]); // VOLUME RESET // ALLambCB[ambCBRandom].setVolume(0); // PITCH // ambCBPitch = rand() % 100; ambCBPitch = ambCBPitch/400+0.87; ALLambCB[ambCBRandom].setPitch(ambCBPitch); // PLAY // ALLambCB[ambCBRandom].play(); } // IF NOT PLAYING CC ///////////////////////////////////////////////////////// if (ambMadness > ambCCTriggerLevel && ALLambCC[ambCCRandom].getStatus() == 0) { // FILE SELECTOR // ambCCRandom = rand()% ARRAY_SIZE(ambCCFile); //ALLambCC[ambCCRandom].openFromFile(ambCCFile[ambCCRandom]); // VOLUME RESET // ALLambCC[ambCCRandom].setVolume(0); // PITCH // ambCCPitch = rand() % 100; ambCCPitch = ambCCPitch/400+0.87; ALLambCC[ambCCRandom].setPitch(ambCCPitch); // PLAY // ALLambCC[ambCCRandom].play(); } // VOLUME CA //////////////////////////////////////////////////////////////// if (ALLambCA[ambCARandom].getStatus() == 2) { /*if((ambMadness - ambCATriggerLevel)*(ambMadness/100+1)*0.50*(ambMaxVolume/100)*0.75 >= 50) ALLambCA[ambCARandom].setVolume(50); else*/ ALLambCA[ambCARandom].setVolume((ambMadness - ambCATriggerLevel)*(ambMadness/100+1)*0.50*(ambMaxVolume/100)*0.20); // STOP // if (ambMadness <= ambCATriggerLevel) { ALLambCA[ambCARandom].stop(); ALLambCA[ambCARandom].setVolume(0); } } // VOLUME CB //////////////////////////////////////////////////////////////// if (ALLambCB[ambCBRandom].getStatus() == 2) { /*if((ambMadness - ambCATriggerLevel)*(ambMadness/100+1)*0.50*(ambMaxVolume/100)*0.75 >= 50) ALLambCB[ambCBRandom].setVolume(50); else*/ ALLambCB[ambCBRandom].setVolume((ambMadness - ambCATriggerLevel)*(ambMadness/100+1)*0.50*(ambMaxVolume/100)*0.20); // STOP // if (ambMadness <= ambCBTriggerLevel) { ALLambCB[ambCBRandom].stop(); ALLambCB[ambCBRandom].setVolume(0); } } // VOLUME CC //////////////////////////////////////////////////////////////// if (ALLambCC[ambCCRandom].getStatus() == 2) { /*if((ambMadness - ambCATriggerLevel)*(ambMadness/100+1)*0.50*(ambMaxVolume/100)*0.75 >= 50) ALLambCC[ambCCRandom].setVolume(50); else*/ ALLambCC[ambCCRandom].setVolume((ambMadness - ambCATriggerLevel)*(ambMadness/100+1)*0.50*(ambMaxVolume/100)*0.20); // STOP // if (ambMadness <= ambCCTriggerLevel) { ALLambCC[ambCCRandom].stop(); ALLambCC[ambCCRandom].setVolume(0); } } // PLAY D ////////////////////////////////////////////////////////////////////////////// if (ambMadness > ambDTriggerLevel || ambDBeforeAfter == 1) { ambDCounter++; // LONG BEEP TRIGGER // if (ambMadness >= 100 && ambDB.getStatus() == 0) { ambDA.stop(); ambDB.setVolume(ambMaxVolume*0.60); ambDB.play(); ambDBeforeAfter = 1; ambDTimer = 0; } // BEFORE BEEP PLAY // else if (ambDCounter > 160-((ambMadness*ambMadness)/75) && ambDBeforeAfter == 0 && ambDB.getStatus() == 0) { ambDCounter = 0; ambDA.setVolume((ambMadness-ambDTriggerLevel)*(ambMadness-ambDTriggerLevel)*(ambMaxVolume/100)*0.60); ambDA.play(); } // AFTER BEEP PLAY // else if (ambDB.getStatus() == 0 && ambDCounter > 90 && ambDBeforeAfter == 1) { ambDCounter = 0; ambDTimer++; ambDC.setVolume(ambDCVolumeTable[ambDTimer]*(ambMaxVolume/100)*0.4); ambDD.setVolume(ambDDVolumeTable[ambDTimer]*(ambMaxVolume/100)*0.4); if (ambDBeforeAfter == 1) { ambDC.play(); ambDD.play(); } // STOP // if (ambDTimer == 11) { ambDBeforeAfter = 0; ambDTimer = 0; } } } }
int main(int argc, char** argv){ if (argc != 7) { cerr << "Wrong call\n"; return 1; } // [Dirtracker][PortTracker][NodoActualDir][NodoActualPort][DirFiles][Delay] // ./Client localhost 5555 localhost 6666 Temp 5 string TrackerDir=argv[1]; string TrackerPort=argv[2]; string NodeDir=argv[3]; string NodePort=argv[4]; string TrackerConnect="tcp://"+TrackerDir+":"+TrackerPort; string NodeListenerConnect="tcp://*:"+NodePort; string NodeDirSite="tcp://"+NodeDir+":"+NodePort; Tpath= argv[5]; cout<<"Path: "<<Tpath<<endl; int Time = atoi(argv[6]); zctx_t* context = zctx_new(); void* Tracker = zsocket_new(context, ZMQ_DEALER); int a = zsocket_connect(Tracker, TrackerConnect.c_str()); cout << "connecting to Tracker: "<<TrackerConnect << (a == 0 ? " OK" : "ERROR") << endl; cout << "Listening! Tracker" << endl; void* NodeListener = zsocket_new(context, ZMQ_ROUTER); int b = zsocket_bind(NodeListener,NodeListenerConnect.c_str()); cout << "Listening! Nodes at : "<<NodeListenerConnect << (b == 0 ? " OK" : "ERROR") << endl; zmq_pollitem_t items[] = {{Tracker, 0, ZMQ_POLLIN, 0}, {NodeListener, 0, ZMQ_POLLIN, 0}}; DirFiles(Tpath); SplitFiles(Tpath); DirFiles(Tpath); RegPeer(Tracker,NodeDirSite); thread Poll(PollItems,Tracker,NodeListener,items,context,NodeDirSite); Poll.detach(); for(int i=0;i<FileList.size();i++){ cout<<"Item ["<<i<<"]: "<<FileList[i]<<endl; } int op=0; while(op!=7){ cout<<"LL iii lll ' TTTTTTT tt"<<endl; cout<<"LL lll ''' TTT oooo rr rr rr rr eee nn nnn tt"<<endl; cout<<"LL iii lll '' TTT oo oo rrr r rrr r ee e nnn nn tttt"<<endl; cout<<"LL iii lll TTT oo oo rr rr eeeee nn nn tt"<<endl; cout<<"LLLLLLL iii lll TTT oooo rr rr eeeee nn nn tttt"<<endl; cout<<"::::::::::::::::::::::::::::::"<<endl; cout<<":::::::: MENU :::::::::"<<endl; cout<<"::::::::::::::::::::::::::::::"<<endl; cout<<":: 1-> Search :::"<<endl; cout<<":: 2-> Download :::"<<endl; cout<<":: 3-> Play Song (sin extensión) :::"<<endl; cout<<":: 4-> Pause :::"<<endl; cout<<":: 5-> Stop :::"<<endl; cout<<":: 6-> Play in memory :::"<<endl; cout<<":: 7-> Exit :::"<<endl; cin>>op; switch (op){ case 1 : QuerySearch(Tracker); break; case 2 : QueryListFile(Tracker); break; case 3 : Save.lock(); if(Cont1!=Cont2){ cout<<"No se puede reproducir, canción incompleta , \n ¡espera hasta que se termine de descargar!"<<endl; }else{ string Song; cin>>Song; string sentence= "7z x Temp/"+Song+".7z.001"; system(sentence.c_str()); if(music.openFromFile("Temp/"+Song+".ogg")){ music.stop(); music.play(); } } Save.unlock(); break; case 4 : music.pause(); break; case 5 : music.stop(); break; case 6 : music.play(); break; } } DirFiles(Tpath); Disconnect(Tracker,NodeDirSite); Poll.~thread(); zctx_destroy(&context); return 0; }
// ---------------------------------------------------------------------------- //Called when a key is pressed void handleKeypress(unsigned char key, //The key that was pressed int x, int y) { //The current mouse coordinates float xrotrad, yrotrad; switch (key) { case 'f': case 'F': if(full_screen){ full_screen=FALSE; f_s_off=TRUE; } else full_screen=TRUE; break; case 'r': case 'R': reload(); break; case 32://Space key if(menu && menu_id==0)menu_id=2; //metti menu credits break; case 'c': case 'C': if(menu && menu_id==0)menu_id=1; //metti menu comandi break; case 13: //Enter key if(menu_id==0){ menu_id=5; //Inizia a Giocare (Esci dai menu!) newGame(); menu=FALSE; } break; case 8: //Backspace key if(!pause){ if(menu_id==4){ music.stop(); music.openFromFile("./dati/audio/Rango_Theme.ogg"); music.play(); } menu_id=0;//Torna al menu pricipale menu=TRUE; } break; case 'p': case 'P': if(menu && menu_id==0)menu_id=3; //metti menu personaggi break; case 's': case 'S': if(menu_id==5){ if(pause) { music_pause.stop(); music.play(); pause=FALSE; } else { //musica music.pause(); music_pause.openFromFile("./dati/audio/Lizard.ogg"); music_pause.play(); pause=TRUE; } } break; case 27: //Escape key exit(0); //Exit the program } }