本文整理汇总了C++中sf::Music::stop方法的典型用法代码示例。如果您正苦于以下问题:C++ Music::stop方法的具体用法?C++ Music::stop怎么用?C++ Music::stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::Music
的用法示例。
在下文中一共展示了Music::stop方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Play
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;
}
}
示例2: newGame
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;
}
示例3: swap_to_song_type
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;
}
示例4: ManageSound
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 );
}
}
示例5: levelChanger
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;
}
示例6: stop
void stop() {
sound.stop();
}
示例8: ResumeMenu
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;
}
示例9: tick
//.........这里部分代码省略.........
}
// 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));
}
示例10: main
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 :
//.........这里部分代码省略.........
示例11: handleKeypress
// ----------------------------------------------------------------------------
//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
}
}