Page 1 of 1

Sound Questions

Posted: Thu Nov 29, 2012 1:00 am
by Gambit37
OK, some sound related questions

1) How do I play different sounds for different types of doors opening/closing? Is there a property I can set in door archs, I couldn't find one?
2) How do I play a "one-shot" ambient sound? (Not looped)
3) Related to #2, there seems to be a "noloop = false" exvar, but it doesn't work? At least, I have that exvar on one of my sound objects, no idea where it came from :-?

Re: Graphics Replacement in DSB

Posted: Thu Nov 29, 2012 1:36 am
by Sophia
Gambit37 wrote:How do I play different sounds for different types of doors opening/closing? Is there a property I can set in door archs, I couldn't find one?
Yes, it's move_sound.
Gambit37 wrote:How do I play a "one-shot" ambient sound? (Not looped)
Set the exvar no_loop to true. (Don't forget the underscore!)

Re: Sound Questions

Posted: Fri Nov 30, 2012 8:10 pm
by Gambit37
Sorry about putting those questions in the graphics thread, oops!

It appears that all door sounds are played four times: is this hardcoded or can I override it? I know I could play a local "one_shot" ambient sound instead using dungeon mechanics, and set the door itself to silent, but I wondered if there's a way of overriding the four repeats in the arch itself?

Re: Sound Questions

Posted: Fri Nov 30, 2012 9:07 pm
by Sophia
It's hardcoded. However, this is something that is easy for me to change in the base code.

For 0.55, you'll be able to specify, by doing this:

Code: Select all

obj.my_door.move_silent = true
obj.my_door.open_sound = snd.one_time_clank
obj.my_door.close_sound = snd.one_time_clank
obj.my_door.reverse_sound = snd.one_time_clank
(Open and close sound should be obvious; reverse sound is what plays if the door bangs into something on the way down and changes direction)

Re: Sound Questions

Posted: Fri Nov 30, 2012 9:23 pm
by Gambit37
Sophia wrote:(Open and close sound should be obvious; reverse sound is what plays if the door bangs into something on the way down and changes direction)
He he, awesome :-)

Re: Sound Questions

Posted: Mon Dec 10, 2012 6:50 pm
by Gambit37
Can I stop a looped sound attached to a monster?

I revisited my code for the buzzing insect that swaps between a walking state and a flying state. When I use qswap to switch the flying version to the walking version, the looped flying sound effect is still playing and gets "left behind" on the tile where the creature was last in its flying state.

How do I fix this?

Re: Sound Questions

Posted: Mon Dec 10, 2012 8:19 pm
by Sophia
In whatever code that you do the dsb_qswap, you also need to call stop_sound_handle with an appropriate description. For example, if you have a looping step_sound, do this:

Code: Select all

stop_sound_handle(id, "step_sound")

Re: Sound Questions

Posted: Tue Dec 11, 2012 9:27 am
by Gambit37
Aha, right, I didn't know about this function. Where should this go in the Wiki, since it's not a dsb_ function?

Re: Sound Questions

Posted: Tue Dec 11, 2012 7:37 pm
by Sophia
We should probably make a separate page for utility functions that are defined as part of the base code.
Right now, what little documentation there is about these is mixed in with the dsb_* functions.

On the other hand, I'm not sure if the end user reading the documentation cares whether the function is defined as part of the base code or as part of the core-- they just want to know what the functions are. So maybe we should just mix them in and change the name of the page.