Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi. I'm having an issue stopping sounds. I am using a sound manager class to keep track of these sounds. I store ISound pointers in a map, and they are being loaded something like this:
I have a member function that plays sounds no problem by doing something like this:
In another member function, I attempt to stop a sound:
Peculiarly, the sound continues to play after this stop method is called. With the help of a debugger, I have determined that the sounds are being loaded, found, and played correctly. The only thing that doesn't work is stopping the sound. The stop method is being called in the correct place in my project, and it almost seems that the sound->stop() and sound->drop() are being "skipped" over, but I know this isn't the issue. I was able to force a sound to stop with the line:
However, this is not necessarily what I want since I want to be able to play a sound again without calling my load method again. I've searched through the forums for a bit looking for a solution but haven't found one. Any help getting me pointed in the right direction would be superb! Thanks! |
||||
|
Hm, are you sure that you are stopping the right instance of the sound? Because you are mapping them by sound name. And if you play the same sound twice, it has the same entry in the map, that way you cannot stop a nice instance anymore. Also, when you dropping it, be sure that you forget every reference to that sound, since if you try to dereference the pointer again, it might not exist anymore. |
|