Wwise Version
arrow_right Table of Contents
Wwise SDK 2019.2.14

◆ ReplaceOutput()

AKSOUNDENGINE_API AKRESULT AK::SoundEngine::ReplaceOutput ( const AkOutputSettings in_Settings,
AkOutputDeviceID  in_outputDeviceId,
AkOutputDeviceID out_pOutputDeviceId = NULL 
)

Replaces an output device previously created during engine initialization or from AddOutput, with a new output device. In addition to simply removing one output device and adding a new one, the new output device will also be used on all of the master buses that the old output device was associated with, and preserve all listeners that were attached to the old output device.

Like most functions of AK::SoundEngine, AddOutput is asynchronous. A successful return code merely indicates that the request is properly queued. Error codes returned by this function indicate various invalid parameters. To know if this function succeeds or not, and the failure code, register an AkDeviceStatusCallbackFunc callback with RegisterAudioDeviceStatusCallback.

See also
AK::SoundEngine::AddOutput
AK::SoundEngine::RegisterAudioDeviceStatusCallback
AK::AkDeviceStatusCallbackFunc
Returns
  • AK_InvalidID: The audioDeviceShareset on in_settings was not valid.
  • AK_IDNotFound: The audioDeviceShareset on in_settings doesn't exist. Possibly, the Init bank isn't loaded yet or was not updated with latest changes.
  • AK_DeviceNotReady: The idDevice on in_settings doesn't match with a valid hardware device. Either the device doesn't exist or is disabled. Disconnected devices (headphones) are not considered "not ready" therefore won't cause this error.
  • AK_DeviceNotFound: The in_outputDeviceId provided does not match with any of the output devices that the sound engine is currently using.
  • AK_InvalidParameter: Out of range parameters or unsupported parameter combinations on in_settings
  • AK_Success: parameters were valid, and the remove and add will occur.
Parameters
in_Settings Creation parameters for this output. AkOutputSettings
in_outputDeviceId AkOutputDeviceID of the output to replace. Use 0 to target the current main output, regardless of its id. Otherwise, use the AkOuptutDeviceID returned from AddOutput() or ReplaceOutput(), or generated by GetOutputID()
out_pOutputDeviceId (Optional) Pointer into which the method writes the AkOutputDeviceID of the new output device. If the call fails, the value pointed to will not be modified.