Music Tool Sample
The Music Tool sample demonstrates how to implement a DirectMusic tool that intercepts messages.
Path
Source: (SDK root)\Samples\C++\DirectMusic\MusicTool
Executable: (SDK root)\Samples\C++\DirectMusic\Bin
User's Guide
Play the default segment, or choose another WAV, MIDI, or DirectMusic segment file by clicking Open File. Select a tool from the drop-down list. The Echo Tool adds an echo to the sound. The Measure Tool causes the square to the right of the drop-down list to flash green on every beat, and red on every measure boundary.
Programming Notes
The tools are implemented in Echotool.cpp and Meastool.cpp. The Echo Tool works by copying messages and sending the copies to a different channel group. The Measure Tool responds to notifications of type GUID_NOTIFICATION_MEASUREANDBEAT. Notifications don't have to be intercepted by tools; they can also be retrieved by using IDirectMusicPerformance8::GetNotificationPMsg, as in the Play Audio Sample.
See Also