DirectX SDK |
This tutorial pertains only to applications written in C++. See DirectMusic Visual Basic Tutorials.
Besides its inherited IUnknown and IDirectMusicTool methods, the sample CEchoTool class has a constructor and destructor as well as two public methods for setting the parameters of the echo. The definition of these methods is somewhat peripheral to this tutorial, but is included here for completeness.
CEchoTool::CEchoTool() { m_cRef = 1; // So one Release() will free this m_dwEchoNum = 3; // Default to 3 echoes per note m_mtDelay = DMUSPPQ / 2; // Default to 8th-note echoes InitializeCriticalSection(&m_CrSec); } CEchoTool::~CEchoTool() { DeleteCriticalSection(&m_CrSec); } void CEchoTool::SetEchoNum(DWORD dwEchoNum) { // ProcessPMsg() uses m_dwEchoNum, so use a critical // section to make it thread-safe. if( dwEchoNum <= MAX_ECHOES ) { EnterCriticalSection(&m_CrSec); m_dwEchoNum = dwEchoNum; LeaveCriticalSection(&m_CrSec); } } void CEchoTool::SetDelay(MUSIC_TIME mtDelay) { // ProcessPMsg() uses m_mtDelay, so use a critical // section to make it thread-safe. EnterCriticalSection(&m_CrSec); m_mtDelay = mtDelay; LeaveCriticalSection(&m_CrSec); }