NNS_SndHeapAlloc

Syntax

#include <nnsys/snd.h>
typedef void (*NNSSndHeapDisposeCallback)( void* mem, u32 size, u32 data1, u32 data2 );
void* NNS_SndHeapAlloc(
        NNSSndHeapHandle heap,
        u32 size,
        NNSSndHeapDisposeCallback callback,
        u32 data1,
        u32 data2 );

Arguments

heap Sound heap handle.
size Memory size to be allocated.
callback The callback function called when the memory block is de-allocated.
data1, data2 User data for the callback function arguments.

Return Values

Returns the starting address of the allocated memory block. Returns a NULL if the allocation fails.

Description

Allocates memory from the sound heap. The start address of the allocated memory block will be 32-byte aligned.

A management region is needed in each memory block. In actuality, a space slightly larger than size, the memory size to be allocated, is necessary. The function will fail if there is not enough space.

The callback function callback is called when the memory block is de-allocated through the NNS_SndHeapClear or NNS_SndHeapLoadState function. The memory block starting address mem, the memory block size size, and the user data data1 and data2 are passed as arguments to the callback function. When the callback function is not needed, enter NULL into callback.

See Also

NNS_SndHeapClear, NNS_SndHeapLoadState

Revision History

2007/04/24 Added a description related to alignment.
2004/06/01 Initial version.


CONFIDENTIAL