[directmusic] Re: directmusic Digest V1 #43

  • From: "Andrew Clark" <andrewclarkis@xxxxxxxxxxx>
  • To: directmusic@xxxxxxxxxxxxx
  • Date: Fri, 11 Oct 2002 10:53:14 -0400

Don't know about VB, but in C++ sending a DMUS_CURVE_PMSG on the appropriate 
PChannel for controller 7 (volume) or 11 (expression) works great for fades 
of various durations and styles (linear, log, exp).  Wicked bonus features: 
1) you can set a DMUS_CURVE_START_FROM_CURRENT  flag that automatically sets 
the start value to whatever the current level is, 2) you can use the 
wMergeIndex for additive control changes (i.e. wMergeIndex 0 is the overall 
band part level, wMergeIndex 1 is the fader level, wMergeIndes 2 is an 
amplitude LFO, wMergeIndex 3 is linked to a game parameter... mmm).

Love that DirectMusic!
Andrew

>From: FreeLists Mailing List Manager <ecartis@xxxxxxxxxxxxx>
>Reply-To: directmusic@xxxxxxxxxxxxx
>To: directmusic digest users <ecartis@xxxxxxxxxxxxx>
>Subject: directmusic Digest V1 #43
>Date: Fri, 11 Oct 2002 02:04:39 -0500 (EST)
>
>directmusic Digest     Thu, 10 Oct 2002        Volume: 01  Issue: 043
>
>In This Issue:
>               [directmusic] Re: Fade out and stop
>
>----------------------------------------------------------------------
>
>From: "Ciaran Walsh" <ciaran@xxxxxxxxxxxxxx>
>Subject: [directmusic] Re: Fade out and stop
>Date: Thu, 10 Oct 2002 12:54:19 +0100
>
>
>I posted this back in June in response to another question on the subject -
>the script example is roughly what you need I think and is pretty
>thorough...
>
> >>
>
>For POW (PC and Xbox) I needed to use a lot of fades in and out for
>conversations, cut
>scenes etc, many of them events that were skippable. This meant I had the
>problem of a fade in being triggered when a fade out was still playing,
>causing an unpleasant stuttering as the volume controllers clashed. The
>system I devised to solve this was very similar to what Bjorn has done in
>his script but on a slightly larger scale as it's designed to accomodate
>lots of different circumstances.
>
>Basically I created what I call my FadeManager script which uses a set of
>timer segments, variables and routine calls to keep track of the fades,
>queue up any new fades triggered during existing fades and ensure there are
>no clashes. Other than having a built in means of cutting off fades while
>they're playing (any chance of this MS people?) it's the best way I could
>think of. Here's a bit of sample script:
>
>note: another script sets FType and calls FadeManager
>
>Dim FType              ' Fade Type, in this case Fade In, Fade Out Short or 
>Fade Out
>Long
>Dim FT         ' true or false - whether a Fade Timer is currently playing
>Dim FWaiting   ' true or false - whether there is a fade in the queue
>Dim FadeVol            ' result of GetMasterVolume, used in FadeManager 
>routine to
>establish Fade state
>
>sub StartFT
>       if FType = 1 then
>               SetMasterVolume 0, 1500
>               FadeTimer2.play IsSecondary     ' segment with call to FTOff 
> after 1500ms
>(clocktime)
>               FT = 1                          ' a Fade Timer is playing
>       elseif FType = 2 then
>               SetMasterVolume -9600, 1500
>               FadeTimer2.play IsSecondary
>               FT = 1
>       elseif FType = 3 then
>               SetMasterVolume -9600, 3000     ' segment with call to FTOff 
> after 3000ms
>(clocktime)
>               FadeTimer1.play IsSecondary
>               FT = 1
>       end if
>end sub
>
>sub FTOff
>       FT = 0                                  ' Fade Timer has finished
>       if FWaiting = 1 then                    ' if there's something in the 
> queue
>               StartFT                         ' start next Fade Timer
>               FWaiting = 0
>       end if
>end sub
>
>sub FadeManager
>       FadeVol = GetMasterVolume               ' what is current Volume
>       if FadeVol = 0 then
>               if FType = 1 then
>                       FT = 0                  ' if the last fade was a Fade 
> In it's finished
>               end if
>       elseif FadeVol = -9600 then
>               if FType > 1 then
>                       FT = 0                  ' if the last fade was a Fade 
> Out it's finished
>               end if
>       end if
>       if FT = 1 then                          ' fade must be in progress
>               FWaiting = 1                    ' queue the new fade
>       elseif FT = 0 then                      ' fade must not be in progress
>               StartFT                         ' start the new fade now
>       end if
>end sub
>
>I've tried  very hard to break this and it always seems to work! Pretty 
>good
>example of the kind of control you can have with scripting I reckon....
>
>Cheers,
>Ciaran

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


Other related posts:

  • » [directmusic] Re: directmusic Digest V1 #43