Page 1 of 1

Stopping sounds with a lost sound handle?

Posted: Tue Sep 25, 2018 5:14 pm
by Gambit37
I seem to lose the sound handle of background sounds when restoring a save game. But DSB is still playing that sound upon restore -- and I can't stop it without a handle ID.

Is there a way to either

* ensure the handle is retained when saving?
* or stop all sounds upon restore even if the handle has been lost (and then run my own code to re-initialise and re-start any necessary sounds -- mainly background ambience)

Re: Stopping sounds with a lost sound handle?

Posted: Wed Sep 26, 2018 8:31 pm
by Sophia
You can save the handle by putting it in a variable that you dsb_export, or adding it to an exported table. If you control background sounds with some object in the dungeon, you can also store it in that object's exvar which is also saved.

This should probably do what you want it to, but I could add some brute-force way to stop all sounds if that is needed.

Re: Stopping sounds with a lost sound handle?

Posted: Fri Sep 28, 2018 12:54 pm
by Gambit37
Great, thanks, I'll see if storing the sound handle upon save works.

Re: Stopping sounds with a lost sound handle?

Posted: Fri Nov 09, 2018 4:49 pm
by Gambit37
So after a lot of experimenting, I think a brute force stop_all_sounds() function would be very, very useful. Please would it be possible for you to add one?