[directmusic] Re: Fade out and stop

  • From: "Scott Selfon" <scottsel@xxxxxxxxxxxxx>
  • To: <directmusic@xxxxxxxxxxxxx>
  • Date: Tue, 8 Oct 2002 16:40:01 -0700

Yup, DX Audio script routines are meant to be designed to quickly
execute - so putting in loops or sleep are not generally recommended
(and can in some instances cause the rest of the DirectMusic performance
thread to become unhappy). This causes something like fading out and
stopping music often a bit more tricky.=20

One solution is that at the same time that you fire off the fade out
(either as you did with SetMasterVolume - although this globally fades
out *everything*, not just the primary piece of piece - or using
audiopath.SetVolume), you fire off a secondary segment that is roughly
the same length as the fade out, or perhaps a little longer. That
secondary segment just has a script track, and has a single script event
towards the end that fires off your dmAllStop routine.

I ramble on and on about the topic in more detail in this white paper:

http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dnmusi=
c
/html/dmp_crossfade.asp

Hope this helps!
-Scott

-----Original Message-----
From: Aaron R Leiby [mailto:aleiby@xxxxxxxxxxxxx]=20
Sent: Friday, October 04, 2002 9:36 PM
To: directmusic@xxxxxxxxxxxxx
Subject: [directmusic] Fade out and stop


Simple question:

How might I create a script method that fades the music out and then
stops
it?

Individually I can do:

sub dmLowVolume
    SetMasterVolume -1000, 3000
end sub

sub dmAllStop
    select case PlayFlag
    case 1
        mySeg.stop
    [...]
    end select
end sub

So that would lead me to believe I would simply need to do:

sub dmFadeout
    dmLowVolume
    sleep 3000
    dmAllStop
end sub

Of course things never work as I expect.  :)

For future reference, where's the best place to look for what VB
DirectMusic
supports and what it does not?

Thanks.


Aaron.




Other related posts: