1# native_audio_routing_manager.h 2 3## Overview 4 5The file declares the functions related to an audio routing manager. 6 7You can use the functions to create an audio routing manager, register and deregister a callback to listen for device connection status changes, and release devices. 8 9**Library**: libohaudio.so 10 11**File to include**: <ohaudio/native_audio_routing_manager.h> 12 13**System capability**: SystemCapability.Multimedia.Audio.Core 14 15**Since**: 12 16 17**Related module**: [OHAudio](capi-ohaudio.md) 18 19## Summary 20 21### Structs 22 23| Name| typedef Keyword| Description| 24| -- | -- | -- | 25| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) | OH_AudioRoutingManager | Describes an audio routing manager, which is used for routing and device-related functions.| 26 27### Functions 28 29| Name| typedef Keyword| Description| 30| -- | -- | -- | 31| [typedef int32_t (\*OH_AudioRoutingManager_OnDeviceChangedCallback)(OH_AudioDevice_ChangeType type,OH_AudioDeviceDescriptorArray *audioDeviceDescriptorArray)](#oh_audioroutingmanager_ondevicechangedcallback) | OH_AudioRoutingManager_OnDeviceChangedCallback | Defines a pointer to the callback that returns the changed audio device descriptor (possibly multiple descriptors).| 32| [OH_AudioCommon_Result OH_AudioManager_GetAudioRoutingManager(OH_AudioRoutingManager **audioRoutingManager)](#oh_audiomanager_getaudioroutingmanager) | - | Obtains the handle to an audio routing manager. The handle should be set as the first parameter in the routing-related functions.| 33| [OH_AudioCommon_Result OH_AudioRoutingManager_GetDevices(OH_AudioRoutingManager *audioRoutingManager,OH_AudioDevice_Flag deviceFlag,OH_AudioDeviceDescriptorArray **audioDeviceDescriptorArray)](#oh_audioroutingmanager_getdevices) | - | Obtains available devices based on the device flag.| 34| [OH_AudioCommon_Result OH_AudioRoutingManager_GetAvailableDevices(OH_AudioRoutingManager *audioRoutingManager,OH_AudioDevice_Usage deviceUsage, OH_AudioDeviceDescriptorArray **audioDeviceDescriptorArray)](#oh_audioroutingmanager_getavailabledevices) | - | Obtains the available audio devices. | 35| [OH_AudioCommon_Result OH_AudioRoutingManager_GetPreferredOutputDevice(OH_AudioRoutingManager *audioRoutingManager,OH_AudioStream_Usage streamUsage, OH_AudioDeviceDescriptorArray **audioDeviceDescriptorArray)](#oh_audioroutingmanager_getpreferredoutputdevice) | - | Obtains the output device with the highest priority based on the usage scenario of an audio output stream.| 36| [OH_AudioCommon_Result OH_AudioRoutingManager_GetPreferredInputDevice(OH_AudioRoutingManager *audioRoutingManager,OH_AudioStream_SourceType sourceType, OH_AudioDeviceDescriptorArray **audioDeviceDescriptorArray)](#oh_audioroutingmanager_getpreferredinputdevice) | - | Obtains the input device with the highest priority based on the usage scenario of an audio input stream.| 37| [OH_AudioCommon_Result OH_AudioRoutingManager_RegisterDeviceChangeCallback(OH_AudioRoutingManager *audioRoutingManager, OH_AudioDevice_Flag deviceFlag,OH_AudioRoutingManager_OnDeviceChangedCallback callback)](#oh_audioroutingmanager_registerdevicechangecallback) | - | Registers a callback to listen for device changes of an audio routing manager.| 38| [OH_AudioCommon_Result OH_AudioRoutingManager_UnregisterDeviceChangeCallback(OH_AudioRoutingManager *audioRoutingManager,OH_AudioRoutingManager_OnDeviceChangedCallback callback)](#oh_audioroutingmanager_unregisterdevicechangecallback) | - | Unregisters the callback used to listen for device changes of an audio routing manager.| 39| [OH_AudioCommon_Result OH_AudioRoutingManager_ReleaseDevices(OH_AudioRoutingManager *audioRoutingManager,OH_AudioDeviceDescriptorArray *audioDeviceDescriptorArray)](#oh_audioroutingmanager_releasedevices) | - | Releases audio devices available for an audio routing manager.| 40| [typedef void (\*OH_AudioRoutingManager_OnDeviceBlockStatusCallback)(OH_AudioDeviceDescriptorArray *audioDeviceDescriptorArray,OH_AudioDevice_BlockStatus status,void *userData)](#oh_audioroutingmanager_ondeviceblockstatuscallback) | OH_AudioRoutingManager_OnDeviceBlockStatusCallback | Defines a pointer to the callback that returns the blocked status of one or more audio devices.| 41| [OH_AudioCommon_Result OH_AudioRoutingManager_IsMicBlockDetectionSupported(OH_AudioRoutingManager *audioRoutingManager,bool *supported)](#oh_audioroutingmanager_ismicblockdetectionsupported) | - | Checks whether the current device supports microphone blocking detection.| 42| [OH_AudioCommon_Result OH_AudioRoutingManager_SetMicBlockStatusCallback(OH_AudioRoutingManager *audioRoutingManager,OH_AudioRoutingManager_OnDeviceBlockStatusCallback callback,void *userData)](#oh_audioroutingmanager_setmicblockstatuscallback) | - | Sets a callback function to be invoked when the microphone's blocked status is changed.<br>Before using this function, check whether the current device supports microphone blocking detection. The application receives a callback only when the microphone is used for recording and the microphone's blocked status changes. Currently, this function takes effect only for the microphone on the local device.| 43 44## Function Description 45 46### OH_AudioRoutingManager_OnDeviceChangedCallback() 47 48``` 49typedef int32_t (*OH_AudioRoutingManager_OnDeviceChangedCallback)(OH_AudioDevice_ChangeType type,OH_AudioDeviceDescriptorArray *audioDeviceDescriptorArray 50) 51``` 52 53**Description** 54 55Defines a pointer to the callback that returns the changed audio device descriptor (possibly multiple descriptors). 56 57**Since**: 12 58 59**Parameters** 60 61| Name| Description| 62| -- | -- | 63| [OH_AudioDevice_ChangeType](capi-native-audio-device-base-h.md#oh_audiodevice_changetype) type | Device connection status, which is [OH_AudioDevice_ChangeType](capi-native-audio-device-base-h.md#oh_audiodevice_changetype). The status can be either connected or disconnected. | 64| [OH_AudioDeviceDescriptorArray](capi-ohaudio-oh-audiodevicedescriptorarray.md) *audioDeviceDescriptorArray | Pointer to the audio device descriptors in the array. For details, see [OH_AudioDeviceDescriptorArray](capi-ohaudio-oh-audiodevicedescriptorarray.md). Do not release the pointer to the audioDeviceDescriptorArray struct separately. Instead, call [OH_AudioRoutingManager_ReleaseDevices](#oh_audioroutingmanager_releasedevices) to release the DeviceDescriptor array.| 65 66### OH_AudioManager_GetAudioRoutingManager() 67 68``` 69OH_AudioCommon_Result OH_AudioManager_GetAudioRoutingManager(OH_AudioRoutingManager **audioRoutingManager) 70``` 71 72**Description** 73 74Obtains the handle to an audio routing manager. The handle should be set as the first parameter in the routing-related functions. 75 76**Since**: 12 77 78 79**Parameters** 80 81| Name| Description| 82| -- | -- | 83| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) **audioRoutingManager | Handle to the audio routing manager, which is obtained by calling [OH_AudioManager_GetAudioRoutingManager](#oh_audiomanager_getaudioroutingmanager).| 84 85**Returns** 86 87| Type| Description | 88| -- |--------------------------------------------------------| 89| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS**: The function is executed successfully.| 90 91### OH_AudioRoutingManager_GetDevices() 92 93``` 94OH_AudioCommon_Result OH_AudioRoutingManager_GetDevices(OH_AudioRoutingManager *audioRoutingManager,OH_AudioDevice_Flag deviceFlag,OH_AudioDeviceDescriptorArray **audioDeviceDescriptorArray) 95``` 96 97**Description** 98 99Obtains available devices based on the device flag. 100 101**Since**: 12 102 103 104**Parameters** 105 106| Name| Description| 107| -- | -- | 108| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) *audioRoutingManager | Handle to the audio routing manager, which is obtained by calling [OH_AudioManager_GetAudioRoutingManager](#oh_audiomanager_getaudioroutingmanager). | 109| [OH_AudioDevice_Flag](capi-native-audio-device-base-h.md#oh_audiodevice_flag) deviceFlag | Device flag, which is used to filter the target device.| 110| [OH_AudioDeviceDescriptorArray](capi-ohaudio-oh-audiodevicedescriptorarray.md) **audioDeviceDescriptorArray | Double pointer to the audio device descriptors in the array. Do not release the pointer to the audioDeviceDescriptorArray struct separately. Instead, call [OH_AudioRoutingManager_ReleaseDevices](#oh_audioroutingmanager_releasedevices) to release the DeviceDescriptor array.| 111 112**Returns** 113 114| Type| Description| 115| -- | -- | 116| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM**:<br>1. The **audioRoutingManager** parameter is nullptr.<br>2. The **deviceFlag** parameter is set to an invalid value.<br>3. The **audioDeviceDescriptorArray** parameter is nullptr.<br>**AUDIOCOMMON_RESULT_ERROR_NO_MEMORY**: The memory is insufficient. | 117 118### OH_AudioRoutingManager_GetAvailableDevices() 119 120``` 121OH_AudioCommon_Result OH_AudioRoutingManager_GetAvailableDevices(OH_AudioRoutingManager *audioRoutingManager,OH_AudioDevice_Usage deviceUsage, OH_AudioDeviceDescriptorArray **audioDeviceDescriptorArray) 122``` 123 124**Description** 125 126Obtains the available audio devices. 127 128**Since**: 12 129 130 131**Parameters** 132 133| Name| Description| 134| -- | -- | 135| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) *audioRoutingManager | Handle to the audio routing manager, which is obtained by calling [OH_AudioManager_GetAudioRoutingManager](#oh_audiomanager_getaudioroutingmanager).| 136| [OH_AudioDevice_Usage](capi-native-audio-device-base-h.md#oh_audiodevice_usage) deviceUsage | Usage scenario of the audio device. For details about the available options, see [OH_AudioDevice_Usage](capi-native-audio-device-base-h.md#oh_audiodevice_usage).| 137| [OH_AudioDeviceDescriptorArray](capi-ohaudio-oh-audiodevicedescriptorarray.md) **audioDeviceDescriptorArray | Double pointer to the audio device descriptors in the array. Do not release the pointer to the audioDeviceDescriptorArray struct separately. Instead, call [OH_AudioRoutingManager_ReleaseDevices](#oh_audioroutingmanager_releasedevices) to release the DeviceDescriptor array.| 138 139**Returns** 140 141| Type| Description| 142| -- | -- | 143| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM**:<br>1. The **audioRoutingManager** parameter is nullptr.<br>2. The **deviceUsage** parameter is invalid.<br>3. The **audioDeviceDescriptorArray** parameter is nullptr.<br>**AUDIOCOMMON_RESULT_ERROR_NO_MEMORY**: The memory is insufficient. | 144 145### OH_AudioRoutingManager_GetPreferredOutputDevice() 146 147``` 148OH_AudioCommon_Result OH_AudioRoutingManager_GetPreferredOutputDevice(OH_AudioRoutingManager *audioRoutingManager,OH_AudioStream_Usage streamUsage, OH_AudioDeviceDescriptorArray **audioDeviceDescriptorArray) 149``` 150 151**Description** 152 153Obtains the output device with the highest priority based on the usage scenario of an audio output stream. 154 155**Since**: 12 156 157**Parameters** 158 159| Name| Description | 160| -- | -- | 161| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) *audioRoutingManager | Handle to the audio routing manager, which is obtained by calling [OH_AudioManager_GetAudioRoutingManager](#oh_audiomanager_getaudioroutingmanager). | 162| OH_AudioStream_Usage streamUsage | Usage scenario of the audio input stream. For details about the available options, see [OH_AudioStream_Usage](capi-native-audiostream-base-h.md#oh_audiostream_usage). | 163| [OH_AudioDeviceDescriptorArray](capi-ohaudio-oh-audiodevicedescriptorarray.md) **audioDeviceDescriptorArray | Double pointer to the audio device descriptors in the array. Do not release the pointer to the audioDeviceDescriptorArray struct separately. Instead, call [OH_AudioRoutingManager_ReleaseDevices](#oh_audioroutingmanager_releasedevices) to release the DeviceDescriptor array.| 164 165**Returns** 166 167| Type| Description| 168| -- | -- | 169| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM**:<br>1. The **audioRoutingManager** parameter is nullptr.<br>2. The **streamUsage** parameter is invalid.<br>3. The **audioDeviceDescriptorArray** parameter is nullptr.<br>**AUDIOCOMMON_RESULT_ERROR_NO_MEMORY**: The memory is insufficient. | 170 171### OH_AudioRoutingManager_GetPreferredInputDevice() 172 173``` 174OH_AudioCommon_Result OH_AudioRoutingManager_GetPreferredInputDevice(OH_AudioRoutingManager *audioRoutingManager,OH_AudioStream_SourceType sourceType, OH_AudioDeviceDescriptorArray **audioDeviceDescriptorArray) 175``` 176 177**Description** 178 179Obtains the input device with the highest priority based on the usage scenario of an audio input stream. 180 181**Since**: 12 182 183 184**Parameters** 185 186| Name| Description| 187| -- | -- | 188| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) *audioRoutingManager | Handle to the audio routing manager, which is obtained by calling [OH_AudioManager_GetAudioRoutingManager](#oh_audiomanager_getaudioroutingmanager).| 189| OH_AudioStream_SourceType sourceType | Usage scenario of the audio input stream. For details about the available options, see [OH_AudioStream_SourceType](capi-native-audiostream-base-h.md#oh_audiostream_sourcetype). | 190| [OH_AudioDeviceDescriptorArray](capi-ohaudio-oh-audiodevicedescriptorarray.md) **audioDeviceDescriptorArray | Double pointer to the audio device descriptors in the array. Do not release the pointer to the **audioDeviceDescriptorArray** struct separately. Instead, call [OH_AudioRoutingManager_ReleaseDevices](#oh_audioroutingmanager_releasedevices) to release the **DeviceDescriptor** array.| 191 192**Returns** 193 194| Type | Description| 195|--| -- | 196| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM**:<br>1. The **audioRoutingManager** parameter is nullptr.<br>2. The **sourceType** parameter is invalid.<br>3. The **audioDeviceDescriptorArray** parameter is nullptr.<br>**AUDIOCOMMON_RESULT_ERROR_NO_MEMORY**: The memory is insufficient. | 197 198### OH_AudioRoutingManager_RegisterDeviceChangeCallback() 199 200``` 201OH_AudioCommon_Result OH_AudioRoutingManager_RegisterDeviceChangeCallback(OH_AudioRoutingManager *audioRoutingManager, OH_AudioDevice_Flag deviceFlag,OH_AudioRoutingManager_OnDeviceChangedCallback callback) 202``` 203 204**Description** 205 206Registers a callback to listen for device changes of an audio routing manager. 207 208**Since**: 12 209 210**Parameters** 211 212| Name| Description| 213| -- | -- | 214| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) *audioRoutingManager | Handle to the audio routing manager, which is obtained by calling [OH_AudioManager_GetAudioRoutingManager](#oh_audiomanager_getaudioroutingmanager).| 215| [OH_AudioDevice_Flag](capi-native-audio-device-base-h.md#oh_audiodevice_flag) deviceFlag | Device flag.| 216| [OH_AudioRoutingManager_OnDeviceChangedCallback](#oh_audioroutingmanager_ondevicechangedcallback) callback | Callback function used to return the changed audio device descriptor.| 217 218**Returns** 219 220| Type| Description| 221| -- | -- | 222| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM**:<br>1. The **audioRoutingManager** parameter is nullptr.<br>2. The **deviceFlag** parameter is set to an invalid value.<br>3. The **callback** parameter is nullptr. | 223 224### OH_AudioRoutingManager_UnregisterDeviceChangeCallback() 225 226``` 227OH_AudioCommon_Result OH_AudioRoutingManager_UnregisterDeviceChangeCallback(OH_AudioRoutingManager *audioRoutingManager,OH_AudioRoutingManager_OnDeviceChangedCallback callback) 228``` 229 230**Description** 231 232Unregisters the callback used to listen for device changes of an audio routing manager. 233 234**Since**: 12 235 236 237**Parameters** 238 239| Name| Description| 240| -- | -- | 241| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) *audioRoutingManager | Handle to the audio routing manager, which is obtained by calling [OH_AudioManager_GetAudioRoutingManager](#oh_audiomanager_getaudioroutingmanager).| 242| [OH_AudioRoutingManager_OnDeviceChangedCallback](#oh_audioroutingmanager_ondevicechangedcallback) callback | Callback function used to return the changed audio device descriptor.| 243 244**Returns** 245 246| Type| Description| 247| -- | -- | 248| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM**:<br>1. The **audioRoutingManager** parameter is nullptr.<br>2. The **callback** parameter is nullptr. | 249 250### OH_AudioRoutingManager_ReleaseDevices() 251 252``` 253OH_AudioCommon_Result OH_AudioRoutingManager_ReleaseDevices(OH_AudioRoutingManager *audioRoutingManager,OH_AudioDeviceDescriptorArray *audioDeviceDescriptorArray) 254``` 255 256**Description** 257 258Releases audio devices available for an audio routing manager. 259 260**Since**: 12 261 262 263**Parameters** 264 265| Name| Description| 266| -- | -- | 267| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) *audioRoutingManager | Handle to the audio routing manager, which is obtained by calling [OH_AudioManager_GetAudioRoutingManager](#oh_audiomanager_getaudioroutingmanager).| 268| [OH_AudioDeviceDescriptorArray](capi-ohaudio-oh-audiodevicedescriptorarray.md) *audioDeviceDescriptorArray | Pointer to the array of audio devices, which are obtained by calling [OH_AudioRoutingManager_GetDevices](#oh_audioroutingmanager_getdevices).| 269 270**Returns** 271 272| Type| Description| 273| -- | -- | 274| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM**:<br>1. The **audioRoutingManager** parameter is nullptr.<br>2. The **audioDeviceDescriptorArray** parameter is nullptr. | 275 276### OH_AudioRoutingManager_OnDeviceBlockStatusCallback() 277 278``` 279typedef void (*OH_AudioRoutingManager_OnDeviceBlockStatusCallback)(OH_AudioDeviceDescriptorArray *audioDeviceDescriptorArray,OH_AudioDevice_BlockStatus status,void *userData) 280``` 281 282**Description** 283 284Defines a pointer to the callback that returns the blocked status of one or more audio devices. 285 286**Since**: 13 287 288 289**Parameters** 290 291| Name| Description| 292| -- | -- | 293| [OH_AudioDeviceDescriptorArray](capi-ohaudio-oh-audiodevicedescriptorarray.md) *audioDeviceDescriptorArray | Pointer to the array of audio devices, which are obtained by calling [OH_AudioRoutingManager_GetDevices](#oh_audioroutingmanager_getdevices). Do not release the pointer to the **audioDeviceDescriptorArray** struct separately. Instead, call [OH_AudioRoutingManager_ReleaseDevices](#oh_audioroutingmanager_releasedevices) to release the **DeviceDescriptor** array.| 294| [OH_AudioDevice_BlockStatus](capi-native-audio-device-base-h.md#oh_audiodevice_blockstatus) status | Blocked status of the audio device.| 295| void *userData | Pointer to user data.| 296 297### OH_AudioRoutingManager_IsMicBlockDetectionSupported() 298 299``` 300OH_AudioCommon_Result OH_AudioRoutingManager_IsMicBlockDetectionSupported(OH_AudioRoutingManager *audioRoutingManager,bool *supported) 301``` 302 303**Description** 304 305Checks whether the current device supports microphone blocking detection. 306 307**Since**: 13 308 309 310**Parameters** 311 312| Name| Description| 313| -- | -- | 314| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) *audioRoutingManager | Handle to the audio routing manager, which is obtained by calling [OH_AudioManager_GetAudioRoutingManager](#oh_audiomanager_getaudioroutingmanager).| 315| bool *supported | Pointer to the check result.| 316 317**Returns** 318 319| Type| Description| 320| -- | -- | 321| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM**:<br>1. The **audioRoutingManager** parameter is nullptr.<br>2. The **supported** parameter is nullptr. | 322 323### OH_AudioRoutingManager_SetMicBlockStatusCallback() 324 325``` 326OH_AudioCommon_Result OH_AudioRoutingManager_SetMicBlockStatusCallback(OH_AudioRoutingManager *audioRoutingManager,OH_AudioRoutingManager_OnDeviceBlockStatusCallback callback,void *userData) 327``` 328 329**Description** 330 331Sets a callback function to be invoked when the microphone's blocked status is changed. 332 333Before using this function, check whether the current device supports microphone blocking detection. The application receives a callback only when the microphone is used for recording and the microphone's blocked status changes. Currently, this function takes effect only for the microphone on the local device. 334 335**Since**: 13 336 337 338**Parameters** 339 340| Name| Description| 341| -- | -- | 342| [OH_AudioRoutingManager](capi-ohaudio-oh-audioroutingmanager.md) *audioRoutingManager | Handle to the audio routing manager, which is obtained by calling [OH_AudioManager_GetAudioRoutingManager](#oh_audiomanager_getaudioroutingmanager).| 343| [OH_AudioRoutingManager_OnDeviceBlockStatusCallback](#oh_audioroutingmanager_ondeviceblockstatuscallback) callback | Pointer to the [OH_AudioRoutingManager_OnDeviceBlockStatusCallback](#oh_audioroutingmanager_ondeviceblockstatuscallback) callback, which is used to return the blocked status.| 344| void *userData | Pointer to user data.| 345 346**Returns** 347 348| Type| Description| 349| -- | -- | 350| [OH_AudioCommon_Result](capi-native-audio-common-h.md#oh_audiocommon_result) | **AUDIOCOMMON_RESULT_SUCCESS**: The function is executed successfully.<br>**AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM**:<br>1. The **audioRoutingManager** parameter is nullptr.<br>2. The **callback** parameter is nullptr. | 351