SFML community forums

Help => Audio => Topic started by: darekg11 on October 03, 2010, 03:02:27 pm

Title: Playing music just ONCE
Post by: darekg11 on October 03, 2010, 03:02:27 pm
Hello, at first I would like to sorry for all that  nooby post I write.
I am using SfMusic_CreateFromFile function to play a music when mouse is over a String but my problem is that it's playing all the time, and I would like to just play it ONCE and then PAUSE but when I put fsMusic_Pause in a same loop as sfMusic_Play it will just play and stop all the time so it still play forever.

My playing code:
Code: [Select]
extern "C"
{
#include <SFML/Audio.h>
sfMusic* Mysz;
//sfMusic* Tlo;
int Odtworz(const char* sciezka);
}
int Odtworz(const char* sciezka)
{
    Mysz = sfMusic_CreateFromFile(sciezka);
    sfMusic_Play(Mysz);
    return 0;
}


And my code in detection section:
Code: [Select]

if (CzyNajechany(NapisMenuGlowne) == TRUE) // Cheking if mosue is over String
{
RysujKwadrat(info.Left ,info.Top, info.Right, info.Bottom);
sfRenderWindow_DrawShape(aaa, prostokat);
Odtworz("Dzwieki/Najechanie.ogg");
}


I tryed sfMusic_SetLoop function but it's also not helping.