The Dink Network

Sound commands in FreeDink

March 4th 2020, 08:33 PM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
For some reason I cannot get any DinkC commands that kill sound to work in FreeDink 109.6

I ask for anyone's willingness to test and confirm the following:
sound_set_kill(&soundbank);
kill_all_sounds();

These commands appear to do nothing, in any situation, in the latest FreeDink (109.6).
At least, I can't seem to get them to work. Did the commands change or something?

If not, too bad if there's no one around that can, and is willing to fix these again.
March 4th 2020, 09:26 PM
spike.gif
Hmm, do you have false expectations from a command called KILLSOUND? IIRC, those commands are only supposed to k[b]</b>ill 'survive' sounds. (ie. Playsound(päläpäläpälä, 1))

To kill a sound right away you had to do something wonky, like assign a variable to it. Maybe even create a sprite and play the sound through that, then kill the sprite to kill the sound, I forget.

Ps. 'smart'phones suck. You' d have to be a moron to write on TDN with one. Or reddit. Or anywhere really. Ducking good for nothing touchscreens.WHY DO PEOPLE TYPE LONG MESSAGES ON THESE IT'S AWFUL
March 4th 2020, 09:47 PM
anon.gif
Robj
Ghost They/Them
 
Yep, that's what I mean. I tried the variable way, and tried setting it to survive and then killing it via set_kill_sound.

Tested and works in dink 1.08, but does nothing in freedink 109.6

But in testing I found a crazy bug in the engine that I can't believe people haven't found before, which occured for me in both FreeDink and 1.08.

If you go between two screens via a warp (not a screen change), and both of those screens contains a sprite that has a sound attached, it will do this weird thing where the sounds "merge" together (the sprite with sp_sound will be playing both sounds). I only noticed this when I was testing this further and was going in and out of house... the house had a fireplace playing the fire sound, and outside was a savebot.

Further more, if you constantly go between the screens, the sounds just keep latching onto whatever sprite has a sound set on it, and eventually it'll bank up and run out of soundbank slots (you can tell, when the door warp sound stops working).

The fix is to place a delay of wait(40) on a sprite with a sp_sound set on it, and then it doesn't happen.

Strange.
March 4th 2020, 11:24 PM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
Deleted.

No work around needed

See below for fix.
March 11th 2020, 09:54 AM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
Deleted. See below for fix.
May 23rd 2020, 09:23 AM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
I figured this out and am putting this here because it is definitely helpful.

It is not the commands that are broken. It is the way FreeDink stores the soundbank numbers.
For some reason FreeDink stores the soundbank number+1, thus you need to subtract 1 from the value returned before killing it off.

i.e:
int &soundbank = playsound(23, 22050, 0, 0, 0);
&soundbank -= 1;
wait(1000);
sound_set_kill(&soundbank);


Same obviously goes for using any sound command that uses a soundbank number.

Using my Version Checker Dmod, you can check and alter your scripts based on the version the player is using to assure sounds don't break based on this.
June 2nd 2020, 04:45 PM
dinkdead.gif
Robj! You've saved me

I have some freshly baked chocolate chip cookies here, you can have them all!

...On second thoughts that's a bit drastic. You can have 2