1
Audio / Re: How to play another music after a music finish playing?
« on: December 09, 2014, 12:06:48 pm »
The only SFML stuff I use is audio. Other parts of program are just combination of beginner stuffs such as cin&cout, if-else statements, and some loops which doesn't affect the musics.
It looks something like:
It looks something like:
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <SFML/Audio.hpp>
... //Some functions prototype
using namespace std;
using namespace sf;
int main()
{
cout<<"..."<<endl;
Music music;
if (!music.openFromFile("music1.ogg"))
return -1;
music.play();
if (music.Stopped==1) // I tried a lot of other things to check if music1 has stopped or\ not too
{
Music music;
if (!music.openFromFile("music2.ogg"))
return -1;
music.play();
music.setLoop(true);
}
... // Long code of cin, cout, if-else, loops, switch-case, etc.
cin.get();
return 0;
}
... // other functions
#include <cstdlib>
#include <time.h>
#include <SFML/Audio.hpp>
... //Some functions prototype
using namespace std;
using namespace sf;
int main()
{
cout<<"..."<<endl;
Music music;
if (!music.openFromFile("music1.ogg"))
return -1;
music.play();
if (music.Stopped==1) // I tried a lot of other things to check if music1 has stopped or\ not too
{
Music music;
if (!music.openFromFile("music2.ogg"))
return -1;
music.play();
music.setLoop(true);
}
... // Long code of cin, cout, if-else, loops, switch-case, etc.
cin.get();
return 0;
}
... // other functions