alHeapInit (function)

Initializes an audio heap for use with the Nintendo 64 Audio Library

Syntax

#include <libaudio.h>     /* libaudio.h */
void alHeapInit(ALHeap *hp, u8 *base, s32 len);

Arguments

hp
Pointer to the ALHeap heap structure to initialize

base
Pointer to the start of the DRAM heap

len
Length, in bytes, of the DRAM heap

Description

The audio heap functionality provides a way for the application to provide memory to the audio library.

At initialization time, the application passes a pointer to the heap when it calls such functions as alInit, alSeqpNew, alCSPNew, and alSndpNew. When these calls return, they have completed all the memory allocation that they will need. In addition to using the audio heap for library initialization routines, typical applications use the heap for dynamical allocation of application controlled buffers.

The audio heap functionality provides a convenient way to ensure that buffers are aligned to 16-byte boundaries. This is highly recommended for any buffer that is shared between the reality serial processor (RSP) and the central processing unit (CPU).

After the audio library is initialized and the application has allocated all the buffers that it needs, the heap structure can be examined to see if the amount of space originally allocated for the heap was of the appropriate size.

Note

Memory allocated from audio heaps cannot be freed.

See Also

alHeapAlloc, alHeapCheck, alInit, alSeqpNew, alCSPNew, alSndpNew

Revision History

1999/04/30 Changed Format