Global DirectMusic Parameters


Scripting also exposes a number of DirectMusic's global parameters. A script can modify the master tempo at which all content is playing, for instance. Or the script can change the master groove level (handy for dynamic music that uses Style-based playback).

 Sub DoubleTime SetMasterTempo (200) End Sub Sub IncreaseIntensityLevel SetMasterGrooveLevel (GetMasterGrooveLevel + 1) End Sub 

This second example actually uses two global scripting functions, SetMasterGrooveLevel and GetMasterGrooveLevel. We can find out the current groove level, increment it by one, and then set the groove level to the resulting value.

All of these "global" functions are technically operating on a DirectMusic Performance object, so in the documentation, they can be found under Performance.[Function]. But since most implementations only involve a single Performance object, you don't typically need to use one in your scripting calls. Remember that multiple performances can be created by a programmer if you need to have multiple tempos in use at the same time or multiple primary Segments; each performance is effectively its own instance of the DirectMusic playback engine.

One note with using the global functions is that you probably want to create a function that resets all of the global DirectMusic settings just so that you know you're starting off from a known state. Otherwise, after running the above script routines, we'd be playing at twice the authored tempo and at a higher groove level without having any way to get back to a regular tempo and groove level!

 Sub ResetSettings    SetMasterTempo (100)    SetMasterGrooveLevel (0) End Sub 




DirectX 9 Audio Exposed(c) Interactive Audio Development
DirectX 9 Audio Exposed: Interactive Audio Development
ISBN: 1556222882
EAN: 2147483647
Year: 2006
Pages: 170

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net