IDirectMusicLoader::EnableCache

The IDirectMusicLoader::EnableCache method tells the loader to enable or disable automatic caching of all objects it loads. By default, caching is enabled for all classes.

HRESULT EnableCache(
  REFGUID rguidClass,
  BOOL fEnable
);
 

Parameters

rguidClass
Address of (C) or reference to (C++) the identifier of the class of objects to cache. Optionally, GUID_DirectMusicAllTypes specifies all types.
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

To clear the cache without disabling caching, call the IDirectMusicLoader::ClearCache method.

The following example disables caching just for segment objects, so they don't stay in memory after the application releases them. Other objects that should be shared, like styles, chordmaps and DLS collections, continue to be cached. Note that the first call to EnableCache would normally be unnecessary, because caching is enabled for all objects by default.

void myPrepareLoader(IDirectMusicLoader *pILoader)
 
{
    pILoader->EnableCache(GUID_DirectMusicAllTypes, TRUE);
    pILoader->EnableCache(CLSID_DirectMusicSegment, FALSE);
}
 

QuickInfo

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dmusici.h.

See Also

IDirectMusicLoader::CacheObject, IDirectMusicLoader::ClearCache, Caching Objects