Yes, in the original code it was, but the sound wont play if the sf::Sound goes out of scope, even if the sound buffer has not been lost.
And... Part 2 (and believe me, nobody was dreading a part 2 more than me
)
The buffer and sf::Sound objects are now safely tucked away elsewhere
void Timer_Alarm()
{ //Alarm::Play_path = "ElapsedTimer.ogg";
if (!Alarm::buffer.loadFromFile(Cmd_dashdash::Get_directory().append("\\Countdown\\Audio\\").append(Alarm::Play_path)))
{ Cmd_dashdash::Newline();
Cmd_dashdash::Print_line("Unable to Load Audio");
}
else
{ Alarm::output.setVolume(100);
Alarm::output.setBuffer(Alarm::buffer);
Cmd_dashdash::Print_line("Able to Load Audio");
Alarm::output.play();
}
}
But the goal here is for the file path in question to be modifyable without recompiling the program. Alarm::Play_path is a string that is set to the appropriate file name earlier in the code by loading from a text file. If I uncomment that first line setting it to "ElapsedTimer.ogg", the program works fine, but if not, buffer.loadFromFile() rejects the file path & says that the file cannot be loaded. The file paths look absolutely identical to me, and I have double checked the value in the text file multiple times. What could possibly make it behave this way?