Platform SDK: DirectX

3DMusic Sample

[Visual Basic]

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

[C++]

Description

The 3DMusic sample shows how to play a MIDI file into a custom DirectSound 3-D buffer.

Path

Source: (SDK root)\Samples\Multimedia\Dmusic\Src\3DMusic

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

User's Guide

The icons represents a listener and a sound source in a 3-D environment, although movement and orientation are possible in only two dimensions.

Use the arrow keys to move the sound source. Use the numeric keypad to change the orientation of the listener.

Choosing Play Stereo Drip from the File menu causes a dripping sound to play at random pan and volume, illustrating how pseudo–3-D effects can be achieved with a 2-D buffer.

Programming Notes

The program uses the registry key set up by the DirectX SDK setup to find the media file path.

Helper.cpp contains useful functions that set up DirectMusic. These functions are called from Sound.cpp.