kill sound
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?
I tried "sound_set_kill(56); " but the game crashes. What works for this?
<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.
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.
A double post 11 minutes later? Hmm... this is suspicious

Umm, no Tal. He edited that post 11 minutes later.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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*
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)
&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)
That's pretty f$@%ed up right there. I don't really know what other advice I can give right now.
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.
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.
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
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