The LithTech PlayerTester


The LithTech Player/Tester

Preparing DirectMusic Files for the Game

Run-time files are saved into the project's Runtime folder after the DirectMusic files are created and tested in Producer. Next, I downsample the run-time DLS instrument waves to 22 kHz using Awave Studio (www.fmjsoft.com). Awave is a fantastic utility for sample format conversion and batch processing. There is no other tool that I'm aware of that batch converts and downsamples DLS files. From here, the files are ready for testing within the LithTech player.

click to expand
Figure 16-4: The LithTech DirectMusic test player.

Using the Script

Monolith programmers and I developed a simple scripting system to put more control into the hands of the composer. DirectX 7 did not have the DirectX Audio Scripting now available in DirectX 8 and after. We wanted an easy way for composers to set the basic DirectMusic parameters for a given music set. Scripts are created within a text document. A script template simplifies the task, and the necessary fields are filled in for a given theme.

The script fields begin with the basic setup parameters. NUMINTENSITIES indicates the number of music states to be used. INITIALINTENSITY is the music state that begins playing when the music set is loaded. PCHANNELS sets the number of pchannels used, and VOICES programs the maximum number of synthesizer voices. SYNTHSAMPLERATE sets the sample rate for the DLS synthesizer. REVERB on/off, REVERBGAIN, REVERBMIX, REVERBTIME, and REVERBHIGHFREQRATIO allow the composer to set the reverb parameters.

The next section of the script describes the specific DirectMusic files to load into RAM. DLS banks, Styles, and Bands are listed here, while Segments listed in the music state and transition sections of the script are also loaded into RAM. The script loads all necessary files for a music set at the beginning of a game level. The appropriate script is set within the LithTech level editor for each game level and is called as a level is loaded. Dynamic loading of DirectMusic files, while possible, is more complex to implement and slows the game down during the unload/load cycles, which is why we chose to load everything with the game levels.

Setting Up Music States in the Script

Setting up the music states entails listing the Segment or Segments used for each music state. The format and its variables are INTENSITY "music state number," "times to loop" (–1 for infinite), "music state to switch to when finished looping," and then "Segment(s) to be played." A typical script lists them as such (note that LithTech refers to music states as intensities):

INTENSITY 1

–1 (loop)

0 (go to)

silence.sgt

INTENSITY 2

8

1

subambient.sgt

INTENSITY 3

–1

0

ambienttension.sgt

INTENSITY 4

–1

0

sneak1.sgt

INTENSITY 5

0

6

action1a.sgt

INTENSITY 6

0

5

action1b.sgt

INTENSITY 7

–1

0

action2.sgt

In the example above, Intensity 2 repeats eight times and then transitions to silence. This prevents that music state from repeating too much. Also notice that Intensities 5 and 6 are actually one music state that plays Intensity 5 and then 6 and repeats. It is split into two parts so that different transition Segments can be assigned to each part of that music state, as described earlier in the section titled "Creating Transition Segments."

The Transition Matrix

Each desired transition uses the following variables: "from music state," "to music state," performance boundary, and transition Segment. A typical set of transitions is listed in the script as such:

TRANSITION 2 (from)

1 (to)

BEAT

Sub2Silence.sgt

TRANSITION 2

3

MEASURE

Sub2Amb.sgt

TRANSITION 2

4

MEASURE

Sub2Sneak.sgt

TRANSITION 2

5

MEASURE

Sub2Action1.sgt

TRANSITION 2

6

SEGMENT

Sub2Action2.sgt

Performance boundary can be set to Immediate, Grid, Beat, Measure, Segment, or Default, which uses the Segment's internal performance boundary.

Motifs and Secondary Segments

The final part of the script lists motifs and secondary Segments. The motif format is style name, motif name, and performance boundary, while secondary Segments simply list Segment name and performance boundary.

MOTIF

style1.sty

DirectHit1 (Motif)

MEASURE

MOTIF

style1.sty

DirectHit2

BEAT

SECONDARY-

fly.sgt

MEASURE

SEGMENT

Using the LithTech Test Player

The LithTech DirectMusic test player allows composers to audition their content with the functionality that it will have in the game. The Base Directory field lists the path to the content to be tested. The Rez File refers to the LithTech resource file if the game and music content have been compiled. I avoid this and test the content directly, as run-time files, before checking it into the game. Control File Name names the script created for the content. Once those fields are filled, the Init Level button loads the DirectMusic content. The Intensity scroller plays the scripted music states with the appropriate transitions between them. There are windows for playing and stopping secondary Segments and motifs over the music states. The debug window shows any errors that may arise due to missing content or a typo in the script, etc.

This player is indispensable. I test all the transitions with the LithTech player, make adjustments in Producer as needed, and test them again. This process allows quick iteration between content creation and game environment testing. The player, the script, and the Producer can be open at the same time, making the back and forth process of creating and testing easy. The LithTech player is also a fantastic demo tool for illustrating the content and its functionality to the game team before actual implementation. An adaptive music test environment saves mountains of production time because the composer can debug his/her content thoroughly, giving music creators confidence that their content will work well in the game before the big handoff.




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