SHAPE_SRC_COMMAND_TYPE Enumeration

SHAPE SRC command type.

Syntax

enum SHAPE_SRC_COMMAND_TYPE
{
    SHAPE_SRC_COMMAND_TYPE_STOP_IMMEDIATE,
    SHAPE_SRC_COMMAND_TYPE_START,
    SHAPE_SRC_COMMAND_TYPE_STOP_END
};  

Constants

Constant Description
SHAPE_SRC_COMMAND_TYPE_STOP_IMMEDIATE The SRC stops sending processed input samples to the mix Buffer and just outputs zeros. It stops reading source data. This mode is used to immediately stop processing of the source data (XMA or PCM). The actual input source is ignored, and zeros are output by the SRC for this frame.
SHAPE_SRC_COMMAND_TYPE_START The SRC will play the data from Buffer Start, looping as necessary. It will continue to loop until told to stop. If looping is not set (see Loop End definitions for when looping is set or not), it will try to play from the beginning of the buffer to the end of the buffer, ignoring the loop end points. In the event the end of the buffer is reached prior to the end of the audio frame, the SRC will output 0’s for the remainder of the audio frame and the SRC will transition to STOP_IMMEDIATE mode for the next audio frame. This is the mode used for almost all SRC commands submitted in a flowgraph. It instructs the SRC block to process normally, and to expect more data to follow the current flowgraph. In other words, there will be at least one more SRC command submitted for the given source data (XMA or PCM) in a subsequent flowgraph.
SHAPE_SRC_COMMAND_TYPE_STOP_END The SRC reads data from the buffer from its current point. Upon reaching the loop point, it will continue to play until the end of the buffer. Once the end of the buffer is reached, it will output 0’s if needed to finish out the current audio frame. The SRC will then transition to the STOP_IMMEDIATE mode for the next audio frame. This means that hardware sets the command field to STOP_IMMEDIATE before writing the SRC context back to main memory once it has completed the current context. Note there is a special case when an SRC context finishes right before the loop end. If the ReadPtr finishes less than 8 samples before loop end then the SRC used some of the samples from the loop start for the final output samples of that context. Therefore if by the next time the context is called SW has changed the context CMD to STOP_END, the SRC must do one more round of the loop even though the ReadPtr is positioned before the loop end. This is because it will have already started to use samples from the loop start. If the flowgraph is not to stop the voice suddenly (via the SHAPE_SRC_COMMAND_TYPE_STOP_IMMEDIATE command), you must submit this command for the last packet of data the voice will consume. If this is not done there is a risk of the flowgraph hanging on the last packet of audio for the voice: a persistent flowgraph will be terminated at the end of the audio frame, a non-persistent flowgraph may hang indefinitely.

Requirements

Header: Declared in shapesrccontext.h.

Library: Use acphal.lib.