Share via


IXAudio2::Initialize Method

Sets XAudio2 parameters and prepares XAudio2 for use.

Syntax

HRESULT Initialize(
         UINT32 Flags = 0,
         XAUDIO2_PROCESSOR XAudio2Processor = XAUDIO2_DEFAULT_PROCESSOR
)

Parameters

  • Flags
    [in] Flags that specify the behavior of the XAudio2 object. This value must be 0.

  • XAudio2Processor
    [in] An enumeration value that specifies which CPU to use. The values have different meanings on different platforms:

    Ee418618.note(en-us,VS.85).gifWindows

    See the XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER enumerator for details.

    Ee418618.note(en-us,VS.85).gifNote
    Specifying a processor should generally be avoided because it can interfere with the scheduler's ability to schedule threads effectively across processors. Instead, pass the XAUDIO2_DEFAULT_PROCESSOR value.
    Ee418618.note(en-us,VS.85).gifXbox 360

    See the XAUDIO2_XBOX_HWTHREAD_SPECIFIER enumerator for details.

    Specifying the value XAUDIO2_DEFAULT_PROCESSOR causes XAudio2 to use its default processor on each platform.

    Note that Xaudio2 only supports a single thread at a time and only one processor may be specified.

Return Value

Returns S_OK if successful, an error code otherwise.

Remarks

Initialize configures several settings for the XAudio2 object. If Initialize succeeds, these settings are fixed for the lifetime of the object. Any further calls to this function have no effect and will return XAUDIO2_E_ALREADY_INITIALIZED.

Initialize should not be called if the XAudio2 object was created using the XAudio2Create function.

This method can be called only once. It must be called before any other method, with the exception of IXAudio2::GetDeviceCount or IXAudio2::GetDeviceDetails.

Requirements

Header: Declared in xaudio2.h.

See Also

IXAudio2