native_audio_resource_manager.h
Overview
The file declares the functions related to an audio resource manager.
File to include: <ohaudio/native_audio_resource_manager.h>
Library: libohaudio.so
System capability: SystemCapability.Multimedia.Audio.Core
Since: 20
Related module: OHAudio
Summary
Structs
| Name | typedef Keyword | Description |
|---|---|---|
| OH_AudioResourceManager | OH_AudioResourceManager | Describes an audio resource manager, which is used to manage audio resources. |
| OH_AudioWorkgroup | OH_AudioWorkgroup | Describes an audio group, which is used to group and manage key audio threads. |
Functions
Function Description
OH_AudioManager_GetAudioResourceManager()
OH_AudioCommon_Result OH_AudioManager_GetAudioResourceManager(OH_AudioResourceManager **resourceManager)
Description
Obtains an audio resource manager.
Before using the features related to the audio resource manager, you must obtain an audio resource manager instance.
Since: 20
Parameters
| Name | Description |
|---|---|
| OH_AudioResourceManager **resourceManager | Double pointer to an OH_AudioResourceManager instance, which is used to receive the created audio resource manager instance. |
Returns
| Type | Description |
|---|---|
| OH_AudioCommon_Result | AUDIOCOMMON_RESULT_SUCCESS: The function is executed successfully. AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM: The resourceManager parameter is nullptr. |
OH_AudioResourceManager_CreateWorkgroup()
OH_AudioCommon_Result OH_AudioResourceManager_CreateWorkgroup(OH_AudioResourceManager *resourceManager,const char *name, OH_AudioWorkgroup **group)
Description
Creates an audio workgroup.
Since: 20
Parameters
| Name | Description |
|---|---|
| OH_AudioResourceManager *resourceManager | Pointer to an OH_AudioResourceManager instance, which is created by calling OH_AudioManager_GetAudioResourceManager. |
| const char *name | Pointer to the name of the audio workgroup. |
| OH_AudioWorkgroup **group | Double pointer to an OH_AudioWorkgroup instance, which is used to receive the created audio workgroup instance. |
Returns
| Type | Description |
|---|---|
| OH_AudioCommon_Result | AUDIOCOMMON_RESULT_SUCCESS: The function is executed successfully. AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM: 1. The resourceManager parameter is nullptr. 2. The name parameter is nullptr. 3. The group parameter is nullptr. AUDIOCOMMON_RESULT_ERROR_NO_MEMORY: The memory is insufficient. AUDIOCOMMON_RESULT_ERROR_SYSTEM: A system processing error occurs. |
OH_AudioResourceManager_ReleaseWorkgroup()
OH_AudioCommon_Result OH_AudioResourceManager_ReleaseWorkgroup(OH_AudioResourceManager *resourceManager,OH_AudioWorkgroup *group)
Description
Releases an audio workgroup.
Since: 20
Parameters
| Name | Description |
|---|---|
| OH_AudioResourceManager *resourceManager | Pointer to an OH_AudioResourceManager instance, which is created by calling OH_AudioManager_GetAudioResourceManager. |
| OH_AudioWorkgroup *group | Pointer to an OH_AudioWorkgroup instance, which is created by calling OH_AudioResourceManager_CreateWorkgroup. |
Returns
| Type | Description |
|---|---|
| OH_AudioCommon_Result | AUDIOCOMMON_RESULT_SUCCESS: The function is executed successfully. AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM: 1. The resourceManager parameter is nullptr. 2. The group parameter is nullptr. AUDIOCOMMON_RESULT_ERROR_SYSTEM: A system processing error occurs. |
OH_AudioWorkgroup_AddCurrentThread()
OH_AudioCommon_Result OH_AudioWorkgroup_AddCurrentThread(OH_AudioWorkgroup *group, int32_t *tokenId)
Description
Adds a thread to an audio workgroup.
Since: 20
Parameters
| Name | Description |
|---|---|
| OH_AudioWorkgroup *group | Pointer to an OH_AudioWorkgroup instance, which is created by calling OH_AudioResourceManager_CreateWorkgroup. |
| int32_t *tokenId | Pointer to the ID of the thread to be added to the audio workgroup. |
Returns
| Type | Description |
|---|---|
| OH_AudioCommon_Result | AUDIOCOMMON_RESULT_SUCCESS: The function is executed successfully. AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM: 1. The group parameter is nullptr. 2. The tokenId parameter is nullptr. AUDIOCOMMON_RESULT_ERROR_NO_MEMORY: The memory is insufficient. AUDIOCOMMON_RESULT_ERROR_SYSTEM: A system processing error occurs. |
OH_AudioWorkgroup_RemoveThread()
OH_AudioCommon_Result OH_AudioWorkgroup_RemoveThread(OH_AudioWorkgroup *group, int32_t tokenId)
Description
Removes a thread from an audio workgroup.
Since: 20
Parameters
| Name | Description |
|---|---|
| OH_AudioWorkgroup *group | Pointer to an OH_AudioWorkgroup instance, which is created by calling OH_AudioResourceManager_CreateWorkgroup. |
| int32_t tokenId | ID of the thread to be removed from the audio workgroup. |
Returns
| Type | Description |
|---|---|
| OH_AudioCommon_Result | AUDIOCOMMON_RESULT_SUCCESS: The function is executed successfully. AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM: 1. The group parameter is nullptr. 2. The tokenId parameter is set to an invalid value. AUDIOCOMMON_RESULT_ERROR_SYSTEM: A system processing error occurs. |
OH_AudioWorkgroup_Start()
OH_AudioCommon_Result OH_AudioWorkgroup_Start(OH_AudioWorkgroup *group, uint64_t startTime, uint64_t deadlineTime)
Description
Notifies the system that an audio workgroup starts working and provides the expected end time of the workgroup.
Since: 20
Parameters
| Name | Description |
|---|---|
| OH_AudioWorkgroup *group | Pointer to an OH_AudioWorkgroup instance, which is created by calling OH_AudioResourceManager_CreateWorkgroup. |
| uint64_t startTime | Time when the audio workgroup starts working. |
| uint64_t deadlineTime | Expected end time of the audio workgroup. |
Returns
| Type | Description |
|---|---|
| OH_AudioCommon_Result | AUDIOCOMMON_RESULT_SUCCESS: The function is executed successfully. AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM: 1. The group parameter is nullptr. 2. The startTime parameter is set to an invalid value. 3. The deadlineTime parameter is set to an invalid value. AUDIOCOMMON_RESULT_ERROR_SYSTEM: A system processing error occurs. |
OH_AudioWorkgroup_Stop()
OH_AudioCommon_Result OH_AudioWorkgroup_Stop(OH_AudioWorkgroup *group)
Description
Notifies the system that an audio workgroup finishes working.
Since: 20
Parameters
| Name | Description |
|---|---|
| OH_AudioWorkgroup *group | Pointer to an OH_AudioWorkgroup instance, which is created by calling OH_AudioResourceManager_CreateWorkgroup. |
Returns
| Type | Description |
|---|---|
| OH_AudioCommon_Result | AUDIOCOMMON_RESULT_SUCCESS: The function is executed successfully. AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM: The group parameter is nullptr. AUDIOCOMMON_RESULT_ERROR_SYSTEM: A system processing error occurs. |
你可能感兴趣的鸿蒙文章
openharmony 鸿蒙 capi-native-audiostreambuilder-h
openharmony 鸿蒙 capi-ohaudiosuite
openharmony 鸿蒙 js-apis-inner-multimedia-systemSoundPlayer
openharmony 鸿蒙 arkts-apis-audio-i
openharmony 鸿蒙 arkts-apis-audio-AudioManager
openharmony 鸿蒙 capi-ohaudiosuite-oh-audiosuite-spacerenderpositionparams