# NNS_SndArcStrmStartEx2

## Syntax

      #include <nnsys/snd.h>

      BOOL NNS_SndArcStrmStartEx2(
              NNSSndStrmHandle* handle,
              int playerNo,
              int playerPrio,
              int strmNo,
              u32 offset,
              NNSSndStrmCallback strmCallback,
              void* strmCallbackArg,
              NNSSndArcStrmCallback sndArcStrmCallback,
              void* sndArcStrmCallbackArg );

## Arguments

`handle` | Pointer to the stream handle.
`playerNo` | Player number.
`playerPrio` | Player priority. A greater value denotes a higher priority
`strmNo` | This is the stream number.
`offset` | This is the starting offset position. It's in units of msecs.
`strmCallback` | Pointer to a stream callback function
`strmCallbackArg` | User argument for the stream callback function.
`sndArcStrmCallback` | This is the sound archive stream callback function pointer.
`sndArcStrmCallbackArg` | This is the sound archive stream callback function user argument.

## Return Values

If playback succeeds, returns TRUE. If it fails, FALSE is returned.

## Description

This function registers the callback function and plays back the stream.

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 tied to the stream handle (this does not mean it is stopped). If playback succeeds, the stream is tied to the stream handle.

If -1 is specified for the player number `playerNo` and player priority `playerPrio`, the parameters specified with the sound data are used.

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.

The stream callback function `strmCallback` is periodically called during playback. Playback waveform data can be processed in this callback function. The user argument of the stream callback function, `strmCallbackArg`, is passed without any changes to the argument of the stream callback function, `strmCallback`. If registration of the stream callback function is not required, enter NULL for this. Refer to the description of `NNSSndStrmCallback` for information on the stream callback function.

The sound archive stream callback function `sndArcStrmCallback` is called at a specific time. You can connect multiple stream data in real time and play them. The user argument `sndArcStrmCallbackArg` of the sound archive stream callback function is passed without any changes to the argument of the sound archive stream callback function `sndArcStrmCallback`. If registration of the sound archive stream callback function is not required, enter NULL for this. Refer to the description of `NNSSndArcStrmCallback` for information on the sound archive stream callback function.

Prior to stream playback, the starting data needs to be loaded into the stream buffer so the beginning of the actual sound production is delayed a few frames. If you want to start playback immediately, the data load to the stream buffer needs to be completed in advance. The `NNS_SndArcStrmPrepare` function is used for this.

The channels used for stream playback are reserved in this function. If the reserved channels were being used by sequence playback, the sound being produced is automatically stopped. To control the timing of channel reservation, the `NNS_SndArcStrmAllocChannel` function needs to be called 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.

Playback failure may be the result of the following factors:

- The stream number is invalid.
- The priority is lower than the stream already being played.
- The channel that the stream player is using is already being used for something else

## See Also

`NNS_SndArcStrmInit, NNS_SndStrmHandleInit, NNSSndStrmCallback, NNSSndArcStrmCallback, NNS_SndArcStrmPrepare, NNS_SndArcStrmAllocChannel, NNS_SndArcStrmSetChannelPan`

## Revision History

2004/11/26 Initial version.

CONFIDENTIAL