# NNS_SndArcStrmPrepare

## Syntax

      #include <nnsys/snd.h>

      BOOL NNS_SndArcStrmPrepare(
              NNSSndStrmHandle* handle,
              int strmNo,
              u32 offset );

## Arguments

`handle` | Pointer to a stream handle.
`strmNo` | Stream number.
`offset` | Starting offset position. Units are milliseconds.

## Return Values

Returns TRUE when successful. if it fails, `FALSE`.

## Description

Prepares the stream. Use the `NNS_SndArcStrmPrepareEx` function or the `NNS_SndArcStrmPrepareEx2` function to specify the player number or similar parameters from the program.

The sound archive stream library must be initialized in advance using the `NNS_SndArcStrmInit` function.

The stream handle `handle` needs to be initialized only once in advance using the `NNS_SndStrmHandleInit` function. Calling this function releases the stream already attached to the stream handle (this does not mean it is stopped). If the function is successful, the stream is attached to the stream handle.

If a non-zero value is set for the start offset position `offset`, it is possible to play from the middle of the stream data.

You can check whether the preparations are completed with the `NNS_SndArcStrmIsPrepared` function. Call the `NNS_SndArcStrmStartPrepared` function to play back streams for which preparations are completed.

The channels used for stream playback are allocated internally by this function. If the allocated channels were being used by sequence playback, the audio being produced is forcibly stopped. To control the timing of when channels are allocated, call the `NNS_SndArcStrmAllocChannel` function in advance.

If the stream data is in stereo, channel 0 is output from the left and channel 1 from the right. These settings can be changed with the ``NNS_SndArcStrmSetChannelPan`` function.

The following are possible causes for this function to fail.

- The stream number is invalid.
- The priority is lower than the stream already being played.
- The channels used by the stream player are already being used for another purpose.

## See Also

`NNS_SndArcStrmPrepareEx`, `NNS_SndArcStrmPrepareEx2`, `NNS_SndArcStrmInit`, `NNS_SndStrmHandleInit`, `NNS_SndArcStrmIsPrepared`, `NNS_SndArcStrmStartPrepared`, `NNS_SndArcStrmAllocChannel`, `NNS_SndArcStrmSetChannelPan`

## Revision History

2004/11/26 Separated out the explanation for `NNS_SndArcStrmPrepareEx` function
2004/10/05 Added the `NNS_SndArcStrmPrepareEx` function.
2004/08/10 Initial version.

CONFIDENTIAL