DirectMusic For The Masses

Segments, Tracks and Tools
By Tom Hays
Gamasutra
November 6, 1998
Vol. 2: Issue 44


Published in Game Developer Magazine, September 1998

Game Developer Magazine
DirectMusic For The Masses
Introduction

History

DirectMusic's Innards

Segments, Tracks and Tools

Programming

The DMS Loader

Output API

Basic Playback

Layers

Composing With Producer

How Deep Do You Want To Go Today?

The Future

Figure 2: DirectMusic Track Segment Layout
Figure 2:
Track Segment Structure

 

DirectMusic's essential playback unit is the track. Tracks are contained inside segments (Figure 2). Typical examples of tracks and segments would include:

  • an imported MIDI file, which the segment object splits into three tracks containing notes, tempo, and time signature information     (Figure 3);
  • a style playback segment that points to one or more styles, which are compositions that have been abstracted to some level and can change based on real-time input;
  • groove, chord map, and signpost segments that the interactive music engine can use to generate style playback segments;
  • special-purpose segments, such as a mute segment, that can automate playback by turning channels on and off.
Figure 3: DirectMusic Midi File Segment Layout
Figure 3:
MIDI Segment Structure

 

For those who wish to do complex things with music that can't be done with the built-in generation system, DirectMusic is built to be extended. For starters, tracks and segments are an extensible data type. Because they are the core playback unit, they will let Microsoft and third-party vendors address any fundamental complaints from developers.

DirectMusic also incorporates objects called Tools, which are intended to be easy for developers or third parties to write. These sit in what's called a tool graph, which makes all tools present cooperate with one another. A tool can operate on just one logical chunk of music (a segment) or can process the entire output. If DirectMusic catches on, expect to see scads of tools written to plug its holes, such as a MIDI channel and note mute mask, a MIDI echo, a velocity modifier, a quantizer/dequantizer, and so on.

For hardware vendors who want to extend the API to include new capabilities, DirectMusic provides a mechanism called the property set. Each of these is tied to a Global Unique ID (GUID), and each gets its own index of individual properties, indexed from 0. A given attribute index for a given GUID is always the same. For example, let's say that a developer has built an interface and drivers to hook a real siren to the parallel port. In order to integrate the device's API into DirectMusic, the developer would publish the GUID of the "DirectSiren," along with its indexed property set. An application supporting DirectSiren could then use DirectMusic's IKsPropertySet interface to see whether or not the DirectSiren's DeafeningAirRaid property is available.

Programming  Next Page