Creates the APU heap storage for a title’s wave files.
HRESULT ApuCreateHeap(
UINT32 cachedSizeInBytes,
UINT32 nonCachedSizeInBytes
)
cachedSizeInBytes
Type: UINT32
[in] The heap is used for all calls to ApuAlloc, and its size should be based on the wave assets the title expects to use.
nonCachedSizeInBytes
Type: UINT32
[in, optional] Optional size of non-cached allocation in bytes. If this is set to 0 (the default), the default allocation of approximately 1MB is used. If this is set to a non-zero value, the function will allocate the requested amount (plus the additional size needed for the non-cached internal data structures). Use of this parameter allows a title to specify how much memory to set aside for SHAPE/XMA contexts and notifications (for SubmitCommand).
Type: HRESULT
This method can return one of the values shown in the following table (in addition to other error codes).
| Return code | Description |
|---|---|
| S_OK | Success. |
| E_INVALIDARG | The requested size is zero. |
| E_OUTOFMEMORY | There has been a memory allocation failure. |
| APU_E_HEAP_ALREADY_ALLOCATED | The heap has already been allocated. |
Only a single APU heap can be created that will persist over the life of the process. It will only be released when the process terminates.
If any ACP or APU methods are called before this method is called, a cached heap of 64MB, and a non-cached heap of approximately 1MB will be allocated and subsequent calls to this method will fail with APU_E_HEAP_ALREADY_ALLOCATED. To ensure that a heap is allocated to your specific requirements, call this method before any other ACP or APU methods.
Cached memory is used for all wave assets and command and message queues. Non-cached memory is used for SHAPE contexts and notifications.
The maximum heap size that can be created is 500 MB.
Header: Declared in apu.h.
Library: Use acphal.lib.