DirectX SDK

IDirectMusicLoader::CacheObject

The IDirectMusicLoader::CacheObject method tells the loader to keep a reference to the object. This guarantees that the object is not loaded twice.

HRESULT CacheObject(
  IDirectMusicObject * pObject
);

Parameters

pObject
Address of the IDirectMusicObject interface of the object to cache.

Return Values

If the method succeeds, the return value is S_OK, or S_FALSE if the object is already cached.

If it fails, the method can return one of the following error values:

E_POINTER
DMUS_E_LOADER_OBJECTNOTFOUND

Remarks

If you have an object that is accessed in multiple places throughout the life of your application, letting the loader cache the object can significantly speed up performance. For an overview, see Caching Objects.

Requirements

  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::EnableCache, IDirectMusicLoader::ClearCache, IDirectMusicLoader::ReleaseObject