I am trying to play a wav file but it doesn't play until the end. It plays only the first 3 or 5 seconds. This is the code:
int main()
{
// i make a sprite here
...
// i make some text
...
// here is the sound stuff
sf::SoundBuffer Sound;
if (!Sound.LoadFromFile("C:\\sound.wav"))
return 0;
sf::Sound MySound;
MySound.SetBuffer(Sound);
MySound.SetLoop(true);
sf::Event myEvent;
while (App.IsOpened())
{
while (App.GetEvent(myEvent))
{
if (myEvent.Type == sf::Event::Closed)
App.Close();
}
// Get elapsed time
float ElapsedTime = App.GetFrameTime();
// move sprite on input
...
App.Clear();
App.Draw(Sprite);
App.Draw(Text);
MySound.Play();
App.Display();
}
return 0;
}
Sorry if it is a stupid question, im a beginner.
Im using SFML 1.5 if necessary to know.