> ## 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

Lee el campo `LengthInBits` de un fotograma especificado.

## Sintaxis

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

### Parámetros

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

Puntero a los paquetes de XMA que contienen el fotograma.

*nBitPosition*   \
Tipo: DWORD

Desplazamiento de bits del fotograma dentro de este paquete.

### Valor devuelto

Tipo: DWORD

Longitud, en bits.

## Comentarios

Como se muestra en el ejemplo de código siguiente, esta función lee el campo `LengthInBits` de un fotograma 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 obtener más información sobre XMA2, consulte [Información general de XMA2](/build/console-features/audio/overviews/xma2-overview). Para obtener información general de la arquitectura de audio de XBOX One, consulte **El sonido del futuro**: [La arquitectura de audio en XBOX One](/build/console-features/audio/overviews/xbox-one-audio-architecture).

## Requisitos

**Encabezado:** xma2defs.h

**Plataformas compatibles:** consolas de la familia XBOX One y consolas XBOX Series

## Consulte también

[xma2defs](/reference/audio/xma2defs/xma2defs_members)


## Related topics

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