Hi Everybody. For some reason I can't load sounds or music in sfml anymore. I got it to work and I used music in a lot of my other programs but not suddenly it won't work! It won't even display an error message , the window just crashes when it tries to load the file , which generally shouldn't happen
Here's my code
void Sound::LoadSound (const char* filename, int linenum) {
string test;
ifstream openfile (filename);
cout << "opened " << filename << endl;
for (int i = 0; i <= linenum; i ++) {
if (openfile.is_open())
openfile >> test;
}
//name = "Sound/audio.wav";
cout << "Done" << endl;
cout << test << endl;
if (SoundBuf.LoadFromFile(test)) {
cout << "Loaded " << test << " successfully" << endl;
SoundInst.SetBuffer (SoundBuf);
}
else
cout << "Failed" << endl;
} // End of LoadSound ( , )
void Sound::LoadMusic (const char* filename, int linenum) {
ifstream openfile;
string testing;
openfile.open(filename, ifstream::in);
for (int i = 0; i <= linenum; i ++)
openfile >> testing;
cout << testing << endl;
if (MusicInst.OpenFromFile (testing))
cout << "Loaded " << testing << " successfully" << endl;
} // End of LoadMusic ( , )
I used cout to see it if got the directory right and it works I just don't know why the sound and music won't load and why it crashes the window.
I'm using sfml 1.6 on windows vista and I'm using code::blocks
Help would be greatly appreciated
[/code]