Bgt, fading sounds in and out

Hi.
So for a while now i've been trying to add a thing to my game where all the game's sounds will fade out and stay that way until they are faded back in, by which I mean they will slowly decrease in volume until they get to -20, and then stay there until the function to fade them back in is called, sort of like what stw does with sleep. However, I've been running into an issue, mainly that the sound just doesn't want to stay where it should. The sound will usually fade out for a second or two, then revert back to how it was, same with fading in. Here's my code, let me know what I'm doing wrong.

void fade_pool_out(sound_pool@ pool, bool destroy=true)
{
int volume=0;
while(volume>-20)
{
volume--;
for (uint i=0; i<pool.items.length(); i++)
{
if (@pool.items[i].handle!=null)
pool.items[i].handle.volume=volume;
}
wait(20);
}
if(destroy)
pool.destroy_all();
}
void fade_pool_in(sound_pool@ pool)
{
int volume=-20;
while(volume<0)
{
volume++;
for (uint i=0; i<pool.items.length(); i++)
{
if (@pool.items[i].handle!=null)
pool.items[i].handle.volume=volume;
}
wait(20);
}
}


-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : cmerry via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Reza . jdp via Audiogames-reflector

Reply via email to