GetShapeDmaMixBufferPeakMagnitude
Gets the peak magnitude of the Direct Memory Access (DMA) mix buffer.Syntax
Parameters
context _In_Type: SHAPE_DMA_CONTEXT* Pointer to a SHAPE_DMA_CONTEXT structure.
Return value
Type: float The peak magnitude.Remarks
In a title audio engine, managing headroom can be very difficult. For this reason, each SHAPE block maintains state associated with signal overhead and gain. Each block (except the Sample Rate Convertor [SRC] blocks) records whether internal saturation occurred during processing. In addition to the internal saturation flag, each hardware block also maintains two 4-bit numbers representing the magnitude of the output of the hardware block. The magnitude is calculated by determining the peak output during the audio frame, and counting the leading zeros of the absolute value of the peak. One 4-bit number is maintained with the persistent peak magnitude; the other is reset by the hardware each audio frame. In addition to monitoring the peak magnitude of each individual hardware block, the peak magnitude of the mix buffers is also maintained. As the output of a hardware block is added to a mix buffer, the peak magnitude is calculated in the same manner (counting leading zeros). Each hardware block state maintains an additional pair of 4-bit peak magnitude values. These values represent the peak magnitude of the mix buffer after the output of the hardware block is accumulated into the mix buffer. One 4-bit number represents the ongoing, persistent peak magnitude; the other is updated every audio frame. The peak magnitude values are saved in the context of the SHAPE blocks, even though the mix-buffer state is actually being represented. Peak magnitude is encoded according to the following table.
To help manage overhead and avoid overflow and saturation, in addition to fine grain gain settings, a 0 to 7-bit right shift can be performed on the output of a hardware block prior to accumulation into the output mix buffer. This is designated in the context of each SHAPE hardware block.
Requirements
Header: shapedmacontext.h Supported platforms: XBOX One family consoles and XBOX Series consolesSee also
Overview of SHAPEShapeDmaContext
