Platform SDK: DirectX |
ここでは、C++ でのアプリケーション開発について説明する。Visual Basic については、「DirectMusic Visual Basic チュートリアル」を参照すること。
DirectMusic を閉じるには、COM の参照を解除し (CoInitialize の呼び出し 1 つにつき、CoUninitialize の呼び出し 1 つを対応させなければならない点に注意すること)、ローダー キャッシュを消去し、パフォーマンスを停止し、作成したすべてのオブジェクトを解放する。
Donuts.cpp ファイルでは、次の関数が必要なクリーンアップ作業を実行する。
void CleanUpDMusic() { if (gpLoader) { gpLoader->ClearCache(GUID_DirectMusicAllTypes); gpLoader->Release(); } if (gpComposer) { gpComposer->Release(); } if (gpIntroTemplate) { gpIntroTemplate->Release(); } if (gpGameTemplate) { gpGameTemplate->Release(); } for (short n = 0; n < NUM_STYLES; n++) { if (gapShieldBand[n]) { gapShieldBand[n]->Unload(gpPerformance); gapShieldBand[n]->Release(); } if (gapDefaultBand[n]) { gapDefaultBand[n]->Unload(gpPerformance); gapDefaultBand[n]->Release(); } if (gapShieldSegment[n]) { gapShieldSegment[n]->Release(); } if (gapDefaultSegment[n]) { gapDefaultSegment[n]->Release(); } if (gapStyle[n]) { gapStyle[n]->Release(); } for (short m = 0; m < NUM_CHORDMAP; m++) { if (gapChordMap[n][m]) { gapChordMap[n][m]->Release(); } } for (m = 0; m < NUM_MOTIFS; m++) { if (gapMotif[n][m]) { gapMotif[n][m]->Release(); } } } if (gpPerformance) { gpPerformance->Stop( NULL, NULL, 0, 0 ); gpPerformance->CloseDown(); gpPerformance->Release(); } for (n = 0; n < NUM_SEGMENTS; n++) { if (gapSegment[n]) { gapSegment[n]->Release(); } } if (gpDirectMusic) { gpDirectMusic->Release(); } CoUninitialize(); }