The Dink Network

kill sound

April 7th 2003, 08:14 PM
pq_frog.gif
Ric
Peasant They/Them Canada
 
I have a .wav playing for the intro screen, but I need to kill it when play starts.
I tried "sound_set_kill(56); " but the game crashes. What works for this?
April 7th 2003, 08:27 PM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
<roots through old Dink source>

Well, I think there are two ways of getting rid of this I believe the first way is to make a variable for the playsound command:

&holybejebus = playsound(56, 22050, 0, 0, 1);

Then kill it using "sound_set_kill(&holybejebus)". I'm pretty sure this method works.

However, my favorite method is to simply use "kill_all_sounds()". It really does ends all wavs that are currently playing (don't know about midis). I'm 100% sure this works and you don't need to use up a variable.
April 7th 2003, 09:08 PM
duck.gif
Tal
Noble He/Him United States
Super Sexy Tal Pal 
A double post 11 minutes later? Hmm... this is suspicious
April 7th 2003, 09:42 PM
knightg.gif
WC
Peasant He/Him United States
Destroying noobs since 1999. 
Umm, no Tal. He edited that post 11 minutes later.
April 7th 2003, 09:58 PM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
Actually, what happened was that the window got stuck on the "returning you to forum" page. But I had already clicked away to another forum that I where I was writing something else. Then I came back and saw that I was still stuck on the screen. So after clicking some stuff I noticed I had two posts... I honestly don't know when the second was created.
April 8th 2003, 07:33 PM
pq_frog.gif
Ric
Peasant They/Them Canada
 
I just tried kill_all_sounds(); in room scripts and sprite scripts. No luck. Does vers. 1.07 have a problem with this? Hm... the original seemed to use a midi for intro. Mabey thats why.
April 8th 2003, 09:22 PM
custom_odd.gif
kill_all_sounds(); kills all wavs that are currently playing..

the fact that the original uses a midi doesn't matter

you should be able to use kill_all_sounds(); or killing only the specific sound.. I cannot say what is wrong without seeing the script, because the error is there, not in the version of the game.
April 9th 2003, 05:16 AM
pq_frog.gif
Ric
Peasant They/Them Canada
 
Here is the main from save-bot (modified).
void main( void )
{
kill_all_sounds();
sp_seq(&current_sprite, 449);
sp_sound(&current_sprite, 34);
sp_brain(&current_sprite, 6);
sp_hitpoints(&current_sprite, 0);
}
playsound(56, 22050,0, 0, 0); is in the start script, right after the sounds load. Still no luck.
April 9th 2003, 07:53 AM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
Hmm... that's kind of odd, because I know for a fact that Sphinx killed the intro.wav that he had playing at the beggining of BFTG with a kill_all_sounds() function.

Maybe instead of adding that function to the save-bot, maybe you should just put it into the "start-1.c" in its "click" function. It's normally kind of silly to have that in a save-bot anyway.
April 9th 2003, 11:03 AM
pq_skull.gif
Ah sound problems. Perhaps you're wav. isn't in the right format. It did that for me alot, PCM Format and you gotta make sure it's the right type otherwise it WILL crash. Like mine did. Alot. There. G'day
April 9th 2003, 04:02 PM
wizardg.gif
Paul
Peasant He/Him United States
 
Does no one read the manual? It's not the best piece of documentation ever written (by a longshot) but does explain how to do this.

There are two ways.

What Striker said:
&holybejebus = playsound(56, 22050, 0, 0, 1);
sound_set_kill(&holybejebus);
(obviously &holybejebus would have to be global if these are not in the same script)

and

&holybejebus = playsound(56, 22050, 0, 0, 1);
sound_set_survive(&holybejebus, 1);
kill_all_sounds();

Because as dinkc.txt explains, kill_all_sounds really only kills all "survive" sounds.
April 9th 2003, 04:24 PM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
Actually, no. The help file is wrong, it really can stop non-"survive" wavs, but I suppose there could be other undocumented criteria that has to be met for it work. *shrug*
April 9th 2003, 08:31 PM
pq_frog.gif
Ric
Peasant They/Them Canada
 
O.k., this is in start after the sounds load:
&look = playsound(56, 22050,0, 0, 0);
sound_set_survive(&look,1);
and this is in start1 and start2 just before the task is killed:
sound_set_kill(&look);
still doesn't kill it though.
(&look is a global I put in main)
April 11th 2003, 10:07 AM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
That's pretty f$@%ed up right there. I don't really know what other advice I can give right now.
April 11th 2003, 04:24 PM
pq_frog.gif
Ric
Peasant They/Them Canada
 
ah....
honesty


Hey I got it! It had to be a global used only for that so loading a game wouldn't change it, and it had to initialize in main equal to 56.
April 12th 2003, 11:23 AM
custom_odd.gif
I thought you said it was a global.. didn' you?

Ah well, ya that's definately it.. well you don't need me to tell you, as it works now.. So I'll just shut up
April 12th 2003, 11:34 AM
wizardg.gif
Paul
Peasant He/Him United States
 
Huh, right you are Striker. I guess it probably works on any looping sound. I admit not using that command much, I usually use sound_set_kill instead. But from the quick tests I did, it seems like looping is the important thing.