IDirectMusicLoader8::EnableCache
The EnableCache method enables or disables automatic caching of all objects it loads. By default, caching is enabled for all classes.
Syntax
HRESULT EnableCache(
REFGUID rguidClass,
BOOL fEnable
);
Parameters
rguidClass
Reference to (C++) or address of (C) the identifier of the class of objects to cache or stop caching, or GUID_DirectMusicAllTypes for all types. For a list of standard loadable classes, see IDirectMusicLoader8.
fEnable
TRUE to enable caching; FALSE to clear and disable.
Return Values
The method returns S_OK if the cache state is changed, or S_FALSE if the cache is already in the desired state.
Remarks
When you disable caching for a class, all objects of that class that have already been cached are released.
To clear the cache without disabling caching, call the IDirectMusicLoader8::ClearCache method.
The following code example disables caching only for segment objects so that they do not stay in memory after the application releases them. Other objects that should be shared, such as styles , chordmaps , and DLS collections, continue to be cached. The first call to EnableCache would normally be unnecessary, because caching is enabled for all objects by default.
void PrepareLoader(IDirectMusicLoader8 *pILoader)
{
pILoader->EnableCache(GUID_DirectMusicAllTypes, TRUE);
pILoader->EnableCache(CLSID_DirectMusicSegment, FALSE);
}
Requirements
** Header:** Dmusici.h
Library: Dmloader.dll, Dmloaded.dll
See Also