PDA

View Full Version : Audio Fade on Exit



Kazoo
02-20-2004, 03:31 PM
Heres a script that i managed to peice together from another post regarding Volume Fade. It doesnt quite fade the volume, but turns it off completely. I suppose because theres no delay at which the script cycles. Can anyone fix?


vol = Audio.GetVolume(CHANNEL_BACKGROUND);
if vol > 1 then
vol = vol - 1
Audio.SetVolume(CHANNEL_BACKGROUND, vol)
else
end
Application.Exit();



Thanks

Corey
02-20-2004, 04:21 PM
Do you have it on a page timer? If so, you can reduce the interval speed, that should work. An idea anyhow... :)

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Kazoo
02-23-2004, 05:49 PM
Well, i am using the page timers now..
Only problem is, i have to fade out from the MAIN page on EXIT,
fade out music when going to the MUSIC page and fade music back IN when returning to the MAIN page...

Thats 3 fade in/out and only 2 pages to use the page timers on...

Theres got to be a better way to do this..

Kazoo

TJ_Tigger
02-23-2004, 07:08 PM
My suggestion would be to create a function that would fade music in and out. Then you can call the function any time you want.



--channel is the name of channel you want to fade
--fade is the time increment in milliseconds that you want to use when fading
--jump is the name of the page you want to jump to,
--Jump can also be set to true to exit the application
function FadeIn(channel, timeinc, jump)
vol = Audio.GetVolume(channel); --get current volume
if vol > 1 then --if volume is greater than one then do the following
vol = vol - 1 ;--lower volume
Application.Sleep(timeinc);
Audio.SetVolume(channel, vol) ;
if vol <=0) then
jumprdy = true;
else
jumprdy = false;
end
end
--Perform page jump or exit
if (jump == true) and (jumprdy == true) then
Application.Exit();
elseif (jumprdy == true) then
-- Get the names of all of the pages in the application.
tbPages = Application.GetPages();
-- Look for your page in the table
for index, pagename in tbPages do
if jump == pagename then
Page.Jump(jump);
end
end

end
end --ends function


I have not tested all the code. Try this as a function and see if it works for you.

Tigg

Toosheds
02-04-2006, 11:57 AM
... this post gets added to.

I am trying to get two timed "On Shutdown" actions to run at the same time. I don't know if this is possible. I use a splash screen timed at four seconds and would like to have the background music fade out during the splash screen. So far I can only get them to run consecutively, not concurrently. Can anyone please help?

Also have tips on easy mp3 to ogg conversion if anyone is interested.

Thanks

Intrigued
02-04-2006, 06:01 PM
... this post gets added to.

I am trying to get two timed "On Shutdown" actions to run at the same time. I don't know if this is possible. I use a splash screen timed at four seconds and would like to have the background music fade out during the splash screen. So far I can only get them to run consecutively, not concurrently. Can anyone please help?

Also have tips on easy mp3 to ogg conversion if anyone is interested.

Thanks

How about having a separate .exe for the Splash Action and don't have the .exe wait for a return. Well, least it's worth a try.

TJ_Tigger
02-04-2006, 09:01 PM
... this post gets added to.

I am trying to get two timed "On Shutdown" actions to run at the same time. I don't know if this is possible. I use a splash screen timed at four seconds and would like to have the background music fade out during the splash screen. So far I can only get them to run consecutively, not concurrently. Can anyone please help?

Also have tips on easy mp3 to ogg conversion if anyone is interested.

Thanks

Problem seems to be that the application is asleep during the splash screen. Have you thought about creating a video or flash splash and having that show with the music fade out?

Tigg

Intrigued
02-04-2006, 10:35 PM
Also, how about muting the project music and have the Splash mirror the end of the sound track/music file, etc.. Thus is all handled by the Splash. Just stop the project sound(s) before you run that Splash.

TJ_Tigger
02-05-2006, 12:50 PM
You could use Worms SetMask dll and configure a page with your splash screen and fade out of song. Just launch the page, set the mask around the splash image and fade out the song that is playing.

Tigg

Toosheds
02-06-2006, 10:14 AM
Tried Tigger's last suggestion (without Worm's mask dll), and it works without hassle, I asssume because the application stops all other activities while fading the music. I tried using a timer but ran into the same problems as before. It seems the Audio.FadeOut script (I think I got it from Worm) acts like a timer itself!

Thanks for the help

valym23
10-14-2007, 03:15 AM
I have to remind that the multipage fade in-out script was made by Longedge (Great Thanx, man:yes).

I only add the exit script lines in the apz file.
Look at exit button "OnShow" and at page "OnShow" and "OnTimer" functions.

Good Luck!!!;)

Hey, Again great thanx to LONGEDGE;)