# NNS_SndHeapLoadState

## C Specification

      #include <nnsys/snd.h>

      void NNS_SndHeapLoadState( NNSSndHeapHandle heap, int level );

## Arguments

`heap` | The sound heap handle.
`level` | The hierarchical level to recover.

## Return Values

None.

## Description

Returns the state of the sound heap.

This function returns the sound heap to the state it was in immediately after it was saved with the `NNS_SndHeapSaveState` function. All memory blocks allocated from the time the state was saved to the current time are de-allocated. The callback function set with the `NNS_SndHeapAlloc` function is called for each de-allocated memory block.

Assign a value equal to the current hierarchical level (position within the hierarchy) value or smaller for the hierarchical level `level`. If `0` is assigned, it has the same effect as the `NNS_SndHeapClear` function. The heap returns to the state immediately after it is saved, and the current hierarchical level takes the assigned value.

### Note

When the stream buffer (allocated using either `NNS_SndArcStrmInit` or `NNS_SndArcStrmSetupPlayer`) is in the heap, it synchronizes with the stream thread in this function.

## See Also

`NNS_SndHeapSaveState,
NNS_SndHeapAlloc,
NNS_SndHeapClear
NNS_SndArcStrmInit,
NNS_SndArcStrmSetupPlayer`

## Revision History

09/02/2004 Added a Note regarding thread synchronization.

06/01/2004 Initial version.