# NNS_SndArcInitOnMemory

## Syntax

      #include <nnsys/snd.h>

      void NNS_SndArcInitOnMemory( NNSSndArc* arc, void* data );

## Arguments

`arc` | The pointer to the `NNSSndArc` structure that manages the sound archive.
`data` | The pointer to the sound archive data. Must have 32-byte alignment.

## Return Values

None.

## Description

Initializes the sound archive structure using the sound archive data in memory. We recommend that you allocate the sound archive structure statically. If you choose to allocate dynamically, be aware of the cautionary note below.

Use either this function or the `NNS_SndArcInit` function to initialize the sound archive. If this function initializes the sound archive, there is no need for memory management or loading of the sound data. Also, there is no need for the file system to be valid. However, more memory is required.

The initialized sound archive is automatically configured as the current sound archive. Use `NNS_SndArcSetCurrent` to modify the current sound archive.

### Note

The sound archive structure can be discarded after the sound archive is no longer necessary. However, be aware that the pointer to the discarded sound archive structure may still be set as the current sound archive.

Also, if you intend to destroy a sound archive and then expand a different Sound archive in the same address, before you destroy the first sound archive, be sure to invalidate the data by doing something like the following.

    SND_InvalidateSeqData(data, (u8*)data + dataSize);
    SND_InvalidateBankData(data, (u8*)data + dataSize);
    SND_InvalidateWaveData(data, (u8*)data + dataSize);
    u32 tag = SND_GetCurrentCommandTag();
    (void)SND_FlushCommand( SND_COMMAND_BLOCK );
    SND_WaitForCommandProc(tag);

That invalidates the different data types used.

## See Also

`NNS_SndArcInit`
`NNS_SndArcSetCurrent`

## Revision History

2009/02/19 Added note about using the same address for a different sound archive.
2005/10/18 Corrected the alignment value.
2004/09/06 Added a note about dynamically allocating the `NNS_SndArc` structure.
2004/06/01 Initial version.

CONFIDENTIAL