Platform SDK: DirectX |
This topic pertains only to application development in C and C++. See DirectMusic Visual Basic Samples.
The 3DMusic sample shows how to play a MIDI file into a custom DirectSound 3-D buffer.
Source: (SDK root)\Samples\Multimedia\Dmusic\Src\3DMusic
Executable: (SDK root)\Samples\Multimedia\DMusic\Bin\3DMusic.exe
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.
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.