# NNSSndArcStrmCallback

## Syntax

      #include <nnsys/snd.h>

      typedef struct NNSSndArcStrmCallbackInfo
      {
          int playerNo;
          int strmNo;
      } NNSSndArcStrmCallbackInfo;

      typedef struct NNSSndArcStrmCallbackParam
      {
          int strmNo;
          u32 offset;
      } NNSSndArcStrmCallbackParam;

      typedef BOOL (*NNSSndArcStrmCallback)(
              NNSSndArcStrmCallbackStatus status,
              const NNSSndArcStrmCallbackInfo* info,
              NNSSndArcStrmCallbackParam* param,
              void* arg );

## Arguments

``status`` | The callback state.
`info` | This is the callback information structure pointer.
`param` | This is the callback parameter structure pointer.
``arg`` | The user argument.

## Return Values

The meaning of the return values varies depending on the callback state, `status`. FALSE is returned to carry out default processing. Refer to the description above for information about the individual types of `status`.

## Description

This callback function is called at a specified time during stream playback.

It is registered in the `NNS_SndArcStrmStartEx2` function and the `NNS_SndArcStrmPrepareEx2` function.

The callback function is called at the specified time. The timing it was called with can be determined with the callback state, `status`. The callback state `status` takes the following values.

Table 1. NNSSndArcStrmCallbackStatus

Label | Description
--- | ---
NNS_SND_ARC_STRM_CALLBACK_DATA_END | Data supply of stream without a loop has reached the end of the data.

The callback information structure `info` stores additional information for the callback. The meaning of the structure members is as follows.

Table 2. NNSSndArcStrmCallbackInfo

Member | Description
--- | ---
playerNo | The number of the stream player used in the current playback.
strmNo | The number of the stream currently being played.

The meaning of the settings for the callback parameter structure `param` and the function's return values varies with each callback state `status`. Refer to the explanation below for information about the processing for each `status`.

### Note

In the future, new types of `status` callback states may be added. Always check values for `status` and return FALSE if they are ignored.

## Processing for Each `status`

### NNS_SND_ARC_STRM_CALLBACK_DATA_END

If you enter the stream number of the stream data to be played next in the member `strmNo` of the callback parameter structure `param`, and return TRUE, the stream data specified will be played in continuation. At this time, you can specify the playback start offset position in units of msec in the `offset` member of the `param` callback parameter structure.

If FALSE is returned, the data supply is stopped and the stream stops after the remaining buffer playback.

If you want to have continuous playback, the formats of the previous stream data and the data to be played next need to fulfill the following requirements or continuous playback will fail.

- The sampling rate is the same.
- Both of the sample formats are 8-bit PCM, or both are not 8-bit PCM.

## See Also

`NNS_SndArcStrmStartEx2, NNS_SndArcStrmPrepareEx2`

## Revision History

2004/11/26 Initial version.

CONFIDENTIAL