Audio Fade on Exit

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Audio Fade on Exit

    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
    Indigo Rose Staff Alumni
    • Aug 2002
    • 9745

    #2
    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

    Comment


    • #3
      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

      Comment

      • TJ_Tigger
        Indigo Rose Customer
        • Sep 2002
        • 3159

        #4
        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.

        Code:
        --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
        TJ-Tigger
        "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
        "Draco dormiens nunquam titillandus."
        Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

        Comment

        • Toosheds
          Indigo Rose Customer
          • Mar 2004
          • 53

          #5
          almost two years later .....

          ... 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

          Comment

          • Intrigued
            Indigo Rose Customer
            • Dec 2003
            • 6138

            #6
            Originally posted by Toosheds
            ... 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.
            Intrigued

            Comment

            • TJ_Tigger
              Indigo Rose Customer
              • Sep 2002
              • 3159

              #7
              Originally posted by Toosheds
              ... 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
              TJ-Tigger
              "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
              "Draco dormiens nunquam titillandus."
              Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

              Comment

              • Intrigued
                Indigo Rose Customer
                • Dec 2003
                • 6138

                #8
                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.
                Intrigued

                Comment

                • TJ_Tigger
                  Indigo Rose Customer
                  • Sep 2002
                  • 3159

                  #9
                  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
                  TJ-Tigger
                  "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
                  "Draco dormiens nunquam titillandus."
                  Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

                  Comment

                  • Toosheds
                    Indigo Rose Customer
                    • Mar 2004
                    • 53

                    #10
                    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

                    Comment

                    • valym23
                      Forum Member
                      • Oct 2007
                      • 34

                      #11
                      Here is the script exemple...

                      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
                      Attached Files

                      Comment

                      Working...
                      X