Platform SDK: DirectX

DMDonuts Sample

[Visual Basic]

This topic pertains only to application development in C and C++. See DirectMusic Visual Basic Samples.

[C++]

Description

DM Donuts is a variation of the Space Donuts sample with the addition of music that responds to game events.

Path

Source: (SDK root)\Samples\Multimedia\Dmusic\Src\DMDonuts

Executable: (SDK root)\Samples\Multimedia\DMusic\Bin\Dmdonuts.exe

User's Guide

While the donut floats in space, notice that the music is subtle and spacey. Press the arrow keys to move the ship. Bounce around and see how the music and rhythm respond.

Shoot the donut by firing with the space bar. Immediately there is an explosion of music and the background music grows in intensity.

Press the 7 key on the numeric keypad. This turns on the shields. Notice how the music becomes muted as if you were listening from inside the shield.

When all the donut fragments are destroyed, notice that the music immediately transitions into an ending, then starts the next level on the start of the next musical theme.

Notice that the music is never the same.

You can control the ship with the joystick if you prefer, by changing the input device under the Game menu.

The following is a complete list of game commands. All numbers must be entered from the numeric keypad. "Joy" refers to a joystick button.

Key Command
ESC, F12 Quit
4 Turn left
6 Turn right
5 (Joy 3) Stop
8 Accelerate forward
2 Accelerate backward
7 (Joy 2) Shields
SPACEBAR (Joy 1) Fire
ENTER Start game
F1 Toggle trailing afterimage effect on/off
F5 Toggle frame rate display on/off
F7 Turn music on/off
F10 Main menu

The display defaults to 640x480 at 256 colors. You can specify a different resolution and pixel depth on the command line.

The game uses the following command line switches, which are case-sensitive:

e Use software emulation, not hardware acceleration
t Test mode, no input required
x Stress mode. Never halt if you can help it

These switches may be followed by three option numbers representing x-resolution, y-resolution, and bits per pixel. For example:

donuts -t 800 600 16
 

Programming Notes

Techniques illustrated include the following:

By default, this sample runs on the software synthesizer. On versions of the operating system that support DLS synthesis in hardware, undefine the _SOFTWARE_SYNTH_ compile flag and recompile the sample.