I just have a little problem. My program do segfault when i release a sound that was used.

I really do not understand why, maybe you can help.

The thing I do to release is to first stop playing the sound if it is playing, then use the Sample_Free function.

Im’ sure that the sound is correctly load, and I check before the Sample_Free if the sample I’m going to release have not hits pointer set to NULL. So This is bad and I did not see why it does a segfault.

int Sound::findStr(string src,string s)
{
int pos=-1;
pos=src.find(s,0); //Search the string s in the src string
if (pos==string::npos)
pos=-1;
return pos; //Return the position of the string find -1 if not found
}

void Sound::playSound()
{
switch (this -> fileType) //Start playing the song depending on the file type
{
case 1:
this -> channel = FSOUND_PlaySound(FSOUND_FREE, this -> sample);
this -> Playing = true; //the song is now played
break;
case 2:
this -> channel = FSOUND_Stream_Play(FSOUND_FREE, this -> stream);
this -> Playing = true; //the song is now played
break;
case 3:
FMUSIC_PlaySong(this -> module);
this -> Playing = true; //the song is now played
break;
}
}

bool Sound::isPlaying()
{
return this -> Playing; //Return if the song is playing or not
}

I use the this, just to clearly make that I use the class members. It is better since my teacher said during my computing studies, but it give the same result if I do it without the [b:5470a396]this[/b:5470a396] keyword