XAudio2XMAEncoder

Encodes the input streams into XMA format.

Syntax

HRESULT XAudio2XMAEncoder(
         DWORD InputStreamCount,
         const XMAENCODERSTREAM *pStreams,
         DWORD Compression,
         DWORD Flags,
         DWORD BlockSizeInKbytes,
         VOID **ppEncodedBuffer,
         DWORD *pEncodedBufferSize,
         XMA2WAVEFORMATEX **ppEncodedBufferFormat,
         DWORD *pEncodedBufferFormatSize,
         DWORD **ppSeekTable,
         DWORD *pSeekTableSize)  

Parameters

InputStreamCount
Type: DWORD 

Number of input streams.

pStreams
Type: XMAENCODERSTREAM *

Pointer to the input streams.

Compression
Type: DWORD 

XMA2 compression quality level to use (1 to 100).

Flags
Type: DWORD 

Zero, or one or more of the following flags:

Flag Value Description-
XMAENCODER_LOOP 0x00000001 Use loop points if present, resampling the wave to make the loop points align to 128 sample boundaries.   If loop points aren’t present, loop the wave from start to finish and resample the wave so that the loop end [full length] of the wave aligns to a 128 sample boundary.
XMAENCODER_NOFILTER 0x00000002 Set no filtering
XMAENCODER_DECODEFROMXMA 0x00000004 Not supported for in-memory encoder
XMAENCODER_VERBOSE 0x00000008 Enable debug output
XMAENCODER_PACKSTREAMS 0x00000010 Pack channels into fewest streams possible

BlockSizeInKbytes
Type: DWORD 

XMA2 compression block size to use in Kb (2 to 8190). This cannot be zero.

ppEncodedBuffer
Type: VOID **

Pointer to a pointer to the buffer to contain the encoded data.

pEncodedBufferSize
Type: DWORD *

Pointer to a DWORD to contain the encoded buffer size.

ppEncodedBufferFormat
Type: XMA2WAVEFORMATEX **

Pointer to a pointer to a structure to contain the format details of the encoded streams.

pEncodedBufferFormatSize
Type: DWORD *

Pointer to a DWORD to contain the size of the format structure.

ppSeekTable
Type: DWORD **

Pointer to a pointer to contain the seek table.

pSeekTableSize
Type: DWORD *

Pointer to a DWORD to contain the seek table size.

Return value

Type: HRESULT 

Success (S_OK), or an error code from the following table.

Error code Implementation Description
XMAENCODER_E_OUTOFMEMORY E_OUTOFMEMORY Out of memory
XMAENCODER_E_INVALIDARG E_INVALIDARG Invalid arg
XMAENCODER_E_NOTIMPL E_NOTIMPL Not implemented
XMAENCODER_E_FAIL E_FAIL Unknown error
XMAENCODER_E_INVALIDLOOP XMAENCODERERROR(0x001) The loop points are invalid
XMAENCODER_E_UNSUPPORTEDFORMAT XMAENCODERERROR(0x002) Format is invalid
XMAENCODER_E_OUTOFRANGE XMAENCODERERROR(0x003) Parameter is out of valid range
XMAENCODER_E_READFAILED XMAENCODERERROR(0x004) Read operation failed
XMAENCODER_E_INVALIDFRAME XMAENCODERERROR(0x005) Invalid XMA frame
XMAENCODER_E_INCOMPLETEFRAME XMAENCODERERROR(0x006) Incomplete XMA frame
XMAENCODER_E_ZEROSTUFFINGBIT XMAENCODERERROR(0x007) Stuffing bit is zero
XMAENCODER_E_GETDATAFAILED XMAENCODERERROR(0x008) Data fetch failed.

Requirements

Header: Declared in xmaencoder.h.

Library: Use xmaencoder.lib.