> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GetXmaFrameLengthInBits

> GetXmaFrameLengthInBits

# GetXmaFrameLengthInBits

Lê o campo `LengthInBits` de um quadro especificado.

## Sintaxe

```cpp theme={null}
DWORD GetXmaFrameLengthInBits(  
         const BYTE* pPacket,  
         DWORD nBitPosition  
)  
```

### Parâmetros

*pPacket*   \_In\_\
Tipo: BYTE\*

Ponteiro para os pacotes XMA que contêm o quadro.

*nBitPosition*   \
Tipo: DWORD

Deslocamento de bits do quadro dentro deste pacote.

### Valor retornado

Tipo: DWORD

Comprimento, em bits.

## Comentários

Conforme mostrado no exemplo de código abaixo, essa função lê o campo `LengthInBits` de um quadro especificado.

```cpp theme={null}

__inline DWORD GetXmaFrameLengthInBits
(
    __in_bcount(nBitPosition / 8 + 3)
    __in const BYTE* pPacket,  // Pointer to XMA packet[s] containing the frame
    DWORD nBitPosition         // Bit offset of the frame within this packet
)
{
    DWORD nRegion;
    DWORD nBytePosition = nBitPosition / 8;
    DWORD nBitOffset = nBitPosition % 8;

    if (nBitOffset < 2) // Only need to read 2 bytes (and might not be safe to read more)
    {
        nRegion = (DWORD)(pPacket[nBytePosition+0]) << 8 |
                  (DWORD)(pPacket[nBytePosition+1]);
        return (nRegion >> (1 - nBitOffset)) & 0x7FFF;  // Last 15 bits
    }
    else // Need to read 3 bytes
    {
        nRegion = (DWORD)(pPacket[nBytePosition+0]) << 16 |
                  (DWORD)(pPacket[nBytePosition+1]) << 8 |
                  (DWORD)(pPacket[nBytePosition+2]);
        return (nRegion >> (9 - nBitOffset)) & 0x7FFF;  // Last 15 bits
    }
}
```

Para obter mais informações sobre o XMA2, consulte [Visão geral do XMA2](/pt-BR/build/console-features/audio/overviews/xma2-overview). Para obter uma visão geral da arquitetura de áudio do XBOX One, consulte **O som do futuro**: [A arquitetura de áudio no XBOX One](/pt-BR/build/console-features/audio/overviews/xbox-one-audio-architecture).

## Requisitos

**Cabeçalho:** xma2defs.h

**Plataformas com suporte:** consoles da família XBOX One e consoles XBOX Series

## Confira também

[xma2defs](/pt-BR/reference/audio/xma2defs/xma2defs_members)


## Related topics

- [XMA2Defs](/pt-BR/reference/audio/xma2defs/xma2defs_members.md)
- [GetXmaFrameBitPosition](/pt-BR/reference/audio/xma2defs/functions/getxmaframebitposition.md)
- [GetLastXmaFrameBitPosition](/pt-BR/reference/audio/xma2defs/functions/getlastxmaframebitposition.md)
- [GetXmaPacketFirstFrameOffsetInBits](/pt-BR/reference/audio/xma2defs/functions/getxmapacketfirstframeoffsetinbits.md)
- [GetShapePcmBufferLength](/pt-BR/reference/audio/shapepcmcontext/functions/getshapepcmbufferlength.md)
