Thanks Irv,

I appreciate all your help.


At 03:01 PM 11/29/00 -0800, you wrote:
>At 1:41 PM -0800 11/29/00, Irv Kalb wrote:
>>At 3:12 PM -0500 11/29/00, Conrad Ayala wrote:
>>>Is this suggestion for Director 8?
>>
>>
>>Yes.  Do you need a solution for an earlier version?
>>
>>>
>>>At 12:04 PM 11/29/00 -0800, you wrote:
>>>>At 12:54 PM -0500 11/29/00, Conrad Ayala wrote:
>>>>>Does anyone know how to fade a sound channel to a specific level adn keep
>>>>>it there?  For example, fade sound channel 3 to volume level 100 adn it
>>>>>stays there until told otherwise.
>>>>>
>>>>
>>>>
>>>>Check out:
>>>>
>>>>    sound(channelNum.fadeTo(volume{, milliseconds})
>>>>
>>>>listed under "fadeTo()" in the Using Lingo manual.
>>>>
>
>Completely untested, but the basic idea is right.  Put the following 
>code into a parent script and name it "Fade" (it will handle fading 
>up or down):
>
>-- Fade parent script
>property pSoundChannelNum  -- sound channel number
>property pEndVolume            -- ending desired volume
>property pnVolumeUnitsPerFrame  -- number of volume units to go up or 
>down each frame
>property psymFadeDirection  -- #down or #up
>
>on new me, soundChannelNum, endVolume, nVolumeUnitsPerFrame
>   pSoundChannelNum = soundChannelNum
>   pEndVolume = endVolume
>   pnVolumeUnitsPerFrame = nVolumeUnitsPerFrame
>   if the volume of sound soundChannelNum > pEndVolume then
>     psymFadeDirection = #down
>     pnVolumeUnitsPerFrame = -nVolumeUnitsPerFrame
>   else
>     psymFadeDirection = #up
>     pnVolumeUnitsPerFrame = nVolumeUnitsPerFrame
>   end if
>   -- This puts this object into the actor list,
>   -- it will get called on the stepFrame handler every frame
>   add(the actorList, me)
>   -- no need to return me, object reference is held in the actor list
>end
>
>-- Every time we are called, adjust the volume in the appropriate direction
>-- when we are done fading,  delete this object from the actorlist
>on stepFrame me
>   potentialNewVolume = the volume of sound pSoundChannelNum + 
>pnVolumeUnitsPerFrame
>   if psymFadeDirection = #down then
>      if potentialNewVolume <= pEndVolume then
>          the volume of sound pSoundChannelNum = pEndVolume
>          deleteOne(the actorList, me) -- bye!
>       else
>           the volume of sound pSoundChannelNum = potentialNewVolume
>       end if
>
>    else -- fading up
>      if potentialNewVolume >= pEndVolume then
>          the volume of sound pSoundChannelNum = pEndVolume
>          deleteOne(the actorList, me)  -- bye!
>       else
>           the volume of sound pSoundChannelNum = potentialNewVolume
>       end if
>    end if
>end
>
>
>Now whenever you want to fade a sound channel, just do this:
>
>   new(script "Fade", soundChannelNum, endVolume, nVolumeUnitsPerFrame)
>
>for example, to fade sound channel 1 down to 100, moving 3 sound 
>units per frame:
>
>   new(script "Fade", 1, 100, 3)
>
>Good luck,
>
>Irv
>
>
>-- 
>Lingo / Director / Shockwave development for all occasions.
>
>        (Over two millions lines of Lingo code served!)
>
>[To remove yourself from this list, or to change to digest mode, go to
>http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
>email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
>Lingo-L is for learning and helping with programming Lingo.  Thanks!]
>
>
>


Conrad Ayala
Interface Architect
The Spin Group, Inc.
http://www.spingroup.com/
Phone 1-414-672-8888  Fax 1-414-672-8183


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to