Search code examples
c++audioenumssfmlstatus

Compiler error on Stopped enum value using GetStatus


I'm trying to get the status of a sound effect but I don't know how to actually find out what the status is. I'm quite new to C++. I tried to read up about enums and apply what I saw, but it won't work. Here's my code

sf::Sound::Status BeepStatus = Beep.GetStatus();
cout << BeepStatus;
if (BeepStatus == Stopped)
{
    Beep.SetPitch(float((rand()%15)-1)/10);
    Beep.Play();
}

That code won't work. During compile it will say that Stopped is not defined. What should I do?


Solution

  • You need to use the scope operator for your Stopped variable.

    Likely, it's this:

    sf::Sound::Stopped