Skip to main content
Encodes an input buffer into xWMA data.

Syntax

Parameters

pInputBuffer Type: BYTE * Pointer to the input buffer containing PCM data, must contain at least one frame. inputBufferSize Type: DWORD Input buffer size, in bytes. pInputFormat Type: WAVEFORMATEX * Input buffer format. outputBitrate Type: DWORD Specifies requested bit rate, must be one of 20000, 32000, 48000, 64000, 96000, 160000 or 192000. ppEncodedBuffer Type: BYTE ** Pointer to a pointer to the encoded data. pEncodedBufferSize Type: DWORD * Pointer to a DWORD containing the encoded data size, in bytes. ppEncodedBufferFormat Type: WAVEFORMATEX ** Pointer to a pointer to the output format structure. pEncodedBufferFormatSize Type: DWORD * Pointer to a DWORD containing the output format structure size. ppDecodedPacketCumulativeBytes Type: DWORD ** Decoded packet cumulative data size array (use free [] to release). Each element is the number of bytes accumulated when the corresponding WMA packet is decoded in order, must have PacketCount elements. PacketCount is set in the XAUDIO2_BUFFER_WMA structure. pDecodedPacketCumulativeBytesSize Type: DWORD * Size of decoded packet cumulative data (in bytes). The number of packets = *pDecodedPacketCumulativeBytesSize / sizeof(DWORD);

Return value

Type: HRESULT Returns S_OK if successful; otherwise, returns an error code from the following table.

Remarks

The following table shows natively supported bit rates per sample rate and channel count. | Input| Output options| | --- | --- | --- | --- | | 22050 Hz mono| 20000| | 22050 Hz stereo| 32000| | 32000 Hz mono| 20000| | 32000 Hz stereo| 32000, 48000| | 44100 Hz mono| 32000, 48000| | 44100 Hz stereo| 32000, 48000, 96000, 192000| | 44100 Hz 5.1| 96000, 192000| | 48000 Hz stereo| 48000, 64000, 96000, 160000, 192000| | 48000 Hz 5.1| 48000, 192000|

Requirements

Header: xwmaencoder.h Library: xwmaencoder.lib

See also

xWMA command-line encoder
Last modified on August 4, 2026