openharmony 鸿蒙 capi-native-audio-suite-engine-h

2026-08-25 浏览 (1)

native_audio_suite_engine.h

Overview

The file declares the functions related to audio creation, including the engine, pipeline, and node.

File to include: <ohaudiosuite/native_audio_suite_engine.h>

Library: libohaudiosuite.so

System capability: SystemCapability.Multimedia.Audio.SuiteEngine

Since: 22

Related module: OHAudioSuite

Summary

Functions

Nametypedef KeywordDescription
OH_AudioSuite_Result OH_AudioSuiteEngine_Create(OH_AudioSuiteEngine** audioSuiteEngine)-Creates an audio creation engine.
OH_AudioSuite_Result OH_AudioSuiteEngine_Destroy(OH_AudioSuiteEngine* audioSuiteEngine)-Destroys the handle to an audio creation engine.
OH_AudioSuite_Result OH_AudioSuiteEngine_CreatePipeline(OH_AudioSuiteEngine* audioSuiteEngine, OH_AudioSuitePipeline** audioSuitePipeline, OH_AudioSuite_PipelineWorkMode workMode)-Creates a pipeline within the current audio creation engine. A pipeline is the execution unit within the engine responsible for audio creation, and multiple pipelines can be created within a single engine.
Up to 10 pipelines can be created, with a maximum of one real-time rendering pipeline.
Each pipeline must have at least one input node and exactly one output node.
When the pipeline operations in OH_AudioSuite_PipelineWorkMode.AUDIOSUITE_PIPELINE_EDIT_MODE mode, all effect nodes are supported.
When the pipeline operations in OH_AudioSuite_PipelineWorkMode.AUDIOSUITE_PIPELINE_REALTIME_MODE mode, only the OH_AudioNode_Type.EFFECT_NODE_TYPE_EQUALIZER effect node is supported.
OH_AudioSuite_Result OH_AudioSuiteEngine_DestroyPipeline(OH_AudioSuitePipeline* audioSuitePipeline)-Destroys the handle to an audio creation pipeline.
OH_AudioSuite_Result OH_AudioSuiteEngine_StartPipeline(OH_AudioSuitePipeline* audioSuitePipeline)-Starts the pipeline. The pipeline will enter the OH_AudioSuite_PipelineState.AUDIOSUITE_PIPELINE_RUNNING state.
OH_AudioSuite_Result OH_AudioSuiteEngine_StopPipeline(OH_AudioSuitePipeline* audioSuitePipeline)-Stops the pipeline. The pipeline will enter the OH_AudioSuite_PipelineState.AUDIOSUITE_PIPELINE_STOPPED state. This function does not change the connections between nodes within the pipeline. Once the pipeline is stopped, OH_AudioSuiteEngine_RenderFrame can no longer perform audio processing.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetPipelineState(OH_AudioSuitePipeline* audioSuitePipeline, OH_AudioSuite_PipelineState* pipelineState)-Retrieves the state of the pipeline.
OH_AudioSuite_Result OH_AudioSuiteEngine_RenderFrame(OH_AudioSuitePipeline* audioSuitePipeline, void* audioData, int32_t requestFrameSize, int32_t* responseSize, bool* finishedFlag)-Obtains the processed audio data from the pipeline (for single-output effect nodes).
OH_AudioSuite_Result OH_AudioSuiteEngine_MultiRenderFrame(OH_AudioSuitePipeline* audioSuitePipeline, OH_AudioDataArray* audioDataArray, int32_t* responseSize, bool* finishedFlag)-Renders the pipeline and obtains the processed audio data. For pipelines with multiple output effect nodes (for example, those containing audio separation nodes), the size of audioDataArray must correspond one-to-one with the number of outputs from the effect nodes. (For example, audio separation nodes require two outputs: the first for vocals and the second for background sound.)
OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_Create(OH_AudioNodeBuilder** builder)-Obtains an audio creation node builder, which is used to configure and create audio nodes. The builder can be reused. However, if the attributes of the new node are different from those of the previous node, you must use OH_AudioSuiteNodeBuilder_Reset to reset the builder.
OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_Destroy(OH_AudioNodeBuilder* builder)-Destroys an audio creation node builder. This function must be called after the builder is no longer required.
OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_Reset(OH_AudioNodeBuilder* builder)-Resets an audio creation node builder, clearing all previously set parameters. If you want to reuse the builder to create a node with different properties, this function must be called to clear all properties (for example, node type).
OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_SetNodeType(OH_AudioNodeBuilder* builder, OH_AudioNode_Type type)-Sets the type of node to be constructed by the current node builder. During node creation, other parameters are verified based on the node type. This property must be set for all node types.
OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_SetFormat(OH_AudioNodeBuilder* builder, OH_AudioFormat audioFormat)-Configures the audio format for input or output nodes. This function can only be used before node creation. For input nodes, it allows the application to specify the audio format for writing data.
For output nodes, it allows the application to specify the desired audio format for obtaining data.
This function is not supported for other node types.
typedef int32_t (*OH_InputNode_RequestDataCallback)(OH_AudioNode* audioNode, void* userData, void* audioData, int32_t audioDataSize, bool* finished)OH_InputNode_RequestDataCallbackSets a callback function for the input node to request data.
OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_SetRequestDataCallback(OH_AudioNodeBuilder* builder, OH_InputNode_RequestDataCallback callback, void* userData)-Sets a callback function for writing audio data for the current input node builder.
OH_AudioSuite_Result OH_AudioSuiteEngine_CreateNode(OH_AudioSuitePipeline* audioSuitePipeline, OH_AudioNodeBuilder* builder, OH_AudioNode** audioNode)-Creates an audio node within the audio pipeline based on the audio creation builder. When this function is executed, the system checks the validity of the parameters based on the node type set in the builder.
Applications can determine the cause of errors based on the return value.
OH_AudioSuite_Result OH_AudioSuiteEngine_DestroyNode(OH_AudioNode* audioNode)-Destroys an audio creation node. Whether a node can be destroyed depends on the state of its associated pipeline. If the pipeline is not in the OH_AudioSuite_PipelineState.AUDIOSUITE_PIPELINE_STOPPED state and the node is in the pipeline processing path, the destruction fails.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetNodeBypassStatus(OH_AudioNode* audioNode, bool* bypassStatus)-Obtains the effect bypass status of the current node. This function can be used only on effect nodes.
If it is called on an input or output node, the AUDIOSUITE_ERROR_INVALID_PARAM error code is returned.
OH_AudioSuite_Result OH_AudioSuiteEngine_BypassEffectNode(OH_AudioNode* audioNode, bool bypass)-Sets the effect bypass status of the current node (supported only on effect nodes). When bypass is set to true, the effect node passes data through without any processing.
When bypass is set to false, the effect node performs the corresponding effect processing.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetAudioFormat(OH_AudioNode* audioNode, OH_AudioFormat *audioFormat)-Sets the audio format for input or output nodes after creation. This function is supported only for input and output nodes. The input node specifies the audio source format, and the output node specifies the target format.
OH_AudioSuite_Result OH_AudioSuiteEngine_ConnectNodes(OH_AudioNode* sourceAudioNode, OH_AudioNode* destAudioNode)-Connects two nodes, with data flowing from sourceAudioNode to destAudioNode. Connecting nodes will change the pipeline topology and may cause data loss. You are advised to perform this operation when the engine is stopped.
The connection order of nodes in a pipeline is as follows: input node -> effect node -> output node.
OH_AudioSuite_Result OH_AudioSuiteEngine_DisconnectNodes(OH_AudioNode* sourceAudioNode, OH_AudioNode* destAudioNode)-Disconnect two nodes. This operation will change the pipeline topology and may cause data loss. You are advised to perform this operation when the engine is stopped.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetEqualizerFrequencyBandGains(OH_AudioNode* audioNode, OH_EqualizerFrequencyBandGains frequencyBandGains)-Sets the band gain effect for the current equalizer node.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetEqualizerFrequencyBandGains(OH_AudioNode* audioNode, OH_EqualizerFrequencyBandGains* frequencyBandGains)-Obtains the band gain effect of the current equalizer node.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetSoundFieldType(OH_AudioNode* audioNode, OH_SoundFieldType soundFieldType)-Sets the configuration parameters for the sound field effect node.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetSoundFieldType(OH_AudioNode* audioNode, OH_SoundFieldType* soundFieldType)-Obtains the configuration parameters of the sound field effect node.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetEnvironmentType(OH_AudioNode* audioNode, OH_EnvironmentType environmentType)-Sets the configuration parameters for the environment effect node.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetEnvironmentType(OH_AudioNode* audioNode, OH_EnvironmentType* environmentType)-Obtains the configuration parameters of the environment effect node.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetVoiceBeautifierType(OH_AudioNode* audioNode, OH_VoiceBeautifierType voiceBeautifierType)-Sets the configuration parameters for the voice beautifier effect node.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetVoiceBeautifierType(OH_AudioNode* audioNode, OH_VoiceBeautifierType* voiceBeautifierType)-Obtains the configuration parameters of the voice beautifier effect node.
OH_AudioSuite_Result OH_AudioSuiteEngine_IsNodeTypeSupported(OH_AudioNode_Type nodeType, bool* isSupported)-Checks whether the system supports the creation of a specified node type to avoid node creation failure. This function is called independently of engine and pipeline states and is only related to the system, without the need to create an engine or pipeline.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetSpaceRenderPositionParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderPositionParams position)-Sets the configuration parameters of the spatial rendering effect node in fixed placement mode.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetSpaceRenderPositionParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderPositionParams* position)-Obtains the configuration parameters of the rendering effect node in fixed placement mode.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetSpaceRenderRotationParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderRotationParams rotation)-Sets the configuration parameters of the rendering effect node in rotation mode.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetSpaceRenderRotationParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderRotationParams* rotation)-Obtains the configuration parameters of the spatial rendering effect node in rotation mode.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetSpaceRenderExtensionParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderExtensionParams extension)-Sets the configuration parameters of the spatial rendering effect node in extension mode.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetSpaceRenderExtensionParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderExtensionParams* extension)-Obtains the configuration parameters of the spatial rendering effect node in extension mode.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetTempoAndPitch(OH_AudioNode* audioNode, float speed, float pitch)-Sets the configuration parameters of the tempo and pitch shifting effect node.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetTempoAndPitch(OH_AudioNode* audioNode, float* speed, float* pitch)-Obtains the configuration parameters of the tempo and pitch shifting effect node.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetPureVoiceChangeOption(OH_AudioNode* audioNode, OH_AudioSuite_PureVoiceChangeOption option)-Sets the configuration parameters of the pure voice change node.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetPureVoiceChangeOption(OH_AudioNode* audioNode, OH_AudioSuite_PureVoiceChangeOption* option)-Obtains the configuration parameters of the pure voice change node.
OH_AudioSuite_Result OH_AudioSuiteEngine_SetGeneralVoiceChangeType(OH_AudioNode* audioNode, OH_AudioSuite_GeneralVoiceChangeType type)-Sets the configuration parameters of the general voice change node.
OH_AudioSuite_Result OH_AudioSuiteEngine_GetGeneralVoiceChangeType(OH_AudioNode* audioNode, OH_AudioSuite_GeneralVoiceChangeType* type)-Obtains the configuration parameters of the general voice change node.

Function Description

OH_AudioSuiteEngine_Create()

OH_AudioSuite_Result OH_AudioSuiteEngine_Create(OH_AudioSuiteEngine** audioSuiteEngine)

Description

Creates an audio creation engine.

Since: 22

Parameters

NameDescription
OH_AudioSuiteEngine** audioSuiteEngineDouble pointer used to receive the handle to the newly created audio creation engine.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The audioSuiteEngine parameter is nullptr.
AUDIOSUITE_ERROR_INVALID_STATE: The engine has been initialized.
AUDIOSUITE_ERROR_MEMORY_ALLOC_FAILED: Memory allocation fails.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_Destroy()

OH_AudioSuite_Result OH_AudioSuiteEngine_Destroy(OH_AudioSuiteEngine* audioSuiteEngine)

Description

Destroys the handle to an audio creation engine.

NOTE When an engine is destroyed, all pipelines under the engine are destroyed.

Since: 22

Parameters

NameDescription
OH_AudioSuiteEngine* audioSuiteEngineAudio creation engine handle, which is obtained by calling OH_AudioSuiteEngine_Create.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The audioSuiteEngine parameter is nullptr.
AUDIOSUITE_ERROR_INVALID_STATE: The engine has been deinitialized, is not created, or is not initialized.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_CreatePipeline()

OH_AudioSuite_Result OH_AudioSuiteEngine_CreatePipeline(OH_AudioSuiteEngine* audioSuiteEngine, OH_AudioSuitePipeline** audioSuitePipeline, OH_AudioSuite_PipelineWorkMode workMode)

Description

Creates a pipeline within the current audio creation engine. A pipeline is the execution unit within the engine responsible for audio creation, and multiple pipelines can be created within a single engine.
Up to 10 pipelines can be created, with a maximum of one real-time rendering pipeline.
Each pipeline must have at least one input node and exactly one output node.
When the pipeline operations in OH_AudioSuite_PipelineWorkMode.AUDIOSUITE_PIPELINE_EDIT_MODE mode, all effect nodes are supported.
When the pipeline operations in OH_AudioSuite_PipelineWorkMode.AUDIOSUITE_PIPELINE_REALTIME_MODE mode, only the OH_AudioNode_Type.EFFECT_NODE_TYPE_EQUALIZER effect node is supported.

Since: 22

Parameters

NameDescription
OH_AudioSuiteEngine* audioSuiteEngineAudio creation engine handle, which is obtained by calling OH_AudioSuiteEngine_Create.
OH_AudioSuitePipeline** audioSuitePipelineDouble pointer used to receive the handle to the newly created audio creation pipeline.
OH_AudioSuite_PipelineWorkMode workModeWorking mode of the pipeline.
1. AUDIOSUITE_PIPELINE_EDIT_MODE: All effect nodes are supported.
2. AUDIOSUITE_PIPELINE_REALTIME_MODE: Equalizer effect nodes are supported.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The audioSuiteEngine or audioSuitePipeline parameter is nullptr.
AUDIOSUITE_ERROR_ENGINE_NOT_EXIST: The engine is not initialized.
AUDIOSUITE_ERROR_CREATED_EXCEED_SYSTEM_LIMITS: The number of pipelines created already reaches the upper limit. (An engine can create a maximum of 10 pipelines.)
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_MEMORY_ALLOC_FAILED: Memory allocation fails.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_DestroyPipeline()

OH_AudioSuite_Result OH_AudioSuiteEngine_DestroyPipeline(OH_AudioSuitePipeline* audioSuitePipeline)

Description

Destroys the handle to an audio creation pipeline.

NOTE When a pipeline is destroyed, all nodes under the pipeline are destroyed.

Since: 22

Parameters

NameDescription
OH_AudioSuitePipeline* audioSuitePipelineAudio creation pipeline handle, which is obtained by calling OH_AudioSuiteEngine_CreatePipeline.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The audioSuitePipeline parameter is nullptr.
AUDIOSUITE_ERROR_PIPELINE_NOT_EXIST: The pipeline does not exist or has been destroyed.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_StartPipeline()

OH_AudioSuite_Result OH_AudioSuiteEngine_StartPipeline(OH_AudioSuitePipeline* audioSuitePipeline)

Description

Starts the pipeline. The pipeline will enter the OH_AudioSuite_PipelineState.AUDIOSUITE_PIPELINE_RUNNING state.

Since: 22

Parameters

NameDescription
OH_AudioSuitePipeline* audioSuitePipelineAudio creation pipeline handle, which is obtained by calling OH_AudioSuiteEngine_CreatePipeline.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The audioSuitePipeline parameter is nullptr.
AUDIOSUITE_ERROR_PIPELINE_NOT_EXIST: The pipeline does not exist or has been destroyed.
AUDIOSUITE_ERROR_INVALID_STATE: The pipeline is running or the node connection is abnormal.
Possible causes are as follows:
1. The pipeline is already running.
2. The pipeline does not contain any output node.
3. The first node is not an input node.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_StopPipeline()

OH_AudioSuite_Result OH_AudioSuiteEngine_StopPipeline(OH_AudioSuitePipeline* audioSuitePipeline)

Description

Stops the pipeline. The pipeline will enter the OH_AudioSuite_PipelineState.AUDIOSUITE_PIPELINE_STOPPED state. This function does not change the connections between nodes within the pipeline. Once the pipeline is stopped, OH_AudioSuiteEngine_RenderFrame can no longer perform audio processing.

Since: 22

Parameters

NameDescription
OH_AudioSuitePipeline* audioSuitePipelineAudio creation pipeline handle, which is obtained by calling OH_AudioSuiteEngine_CreatePipeline.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The audioSuitePipeline parameter is nullptr.
AUDIOSUITE_ERROR_PIPELINE_NOT_EXIST: The pipeline does not exist or has been destroyed.
AUDIOSUITE_ERROR_INVALID_STATE: The pipeline is already stopped.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetPipelineState()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetPipelineState(OH_AudioSuitePipeline* audioSuitePipeline, OH_AudioSuite_PipelineState* pipelineState)

Description

Retrieves the state of the pipeline.

Since: 22

Parameters

NameDescription
OH_AudioSuitePipeline* audioSuitePipelineAudio creation pipeline handle, which is obtained by calling OH_AudioSuiteEngine_CreatePipeline.
OH_AudioSuite_PipelineState* pipelineStatePointer to the pipeline state.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioSuitePipeline is nullptr.
AUDIOSUITE_ERROR_PIPELINE_NOT_EXIST: The pipeline does not exist or has been destroyed.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_RenderFrame()

OH_AudioSuite_Result OH_AudioSuiteEngine_RenderFrame(OH_AudioSuitePipeline* audioSuitePipeline, void* audioData, int32_t requestFrameSize, int32_t* responseSize, bool* finishedFlag)

Description

Obtains the processed audio data from the pipeline (for single-output effect nodes).

NOTE

Applications need to call this function to obtain audio data that has been processed by effects.

  • When this function is called, the pipeline pulls data backward from the output node, apply effect processing,
  • and fill the processed data into the audioData pointer provided by the application.
  • The system attempts to fill the data based on the size specified by requestFrameSize, and the actual size of the processed data is returned to the application via responseSize.
  • When the application has prepared data for all input nodes and submits the last data through a callback, it should set the finish flag in the callback.
  • Once all inputs in the pipeline have passed the finish flag, the pipeline notifies the application through finishedFlag after processing is complete.
  • If finishedFlag is true, the application should not call this function again.

Since: 22

Parameters

NameDescription
OH_AudioSuitePipeline* audioSuitePipelineAudio creation pipeline handle, which is obtained by calling OH_AudioSuiteEngine_CreatePipeline.
void* audioDataPointer to the address for writing the obtained audio data.
int32_t requestFrameSizeByte size of the memory allocated for audioData. The value must be greater than 0.
int32_t* responseSizePointer to the size of the audio data written to audioData by the pipeline. The value cannot be greater than requestFrameSize. The unit is bytes.
bool* finishedFlagPointer to the flag indicating whether the current pipeline has completed rendering.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: A parameter is nullptr or has an invalid value.
Possible causes are as follows:
1. The audioSuitePipeline parameter is nullptr.
2. The audioData parameter is nullptr.
3. The value of requestFrameSize is less than or equal to 0.
4. The responseSize parameter is nullptr.
5. The finishedFlag parameter is nullptr.
AUDIOSUITE_ERROR_PIPELINE_NOT_EXIST: The pipeline does not exist or has been destroyed.
AUDIOSUITE_ERROR_INVALID_STATE: The pipeline is not running.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The pipeline rendering is complete. (finishedFlag is written as true when this function is called.)
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_MultiRenderFrame()

OH_AudioSuite_Result OH_AudioSuiteEngine_MultiRenderFrame(OH_AudioSuitePipeline* audioSuitePipeline, OH_AudioDataArray* audioDataArray, int32_t* responseSize, bool* finishedFlag)

Description

Renders the pipeline and obtains the processed audio data. For pipelines with multiple output effect nodes (for example, those containing audio separation nodes), the size of audioDataArray must correspond one-to-one with the number of outputs from the effect nodes. (For example, audio separation nodes require two outputs: the first for vocals and the second for background sound.)

Since: 22

Parameters

NameDescription
OH_AudioSuitePipeline* audioSuitePipelineAudio creation pipeline handle, which is obtained by calling OH_AudioSuiteEngine_CreatePipeline.
OH_AudioDataArray* audioDataArrayPointer to the array used by the user to read audio data. Each element of the array must be of the same size.
int32_t* responseSizePointer to the size of the audio data written into each element of audioDataArray by the pipeline. The system ensures consistent data size across all elements. The unit is bytes.
bool* finishedFlagPointer to the flag indicating whether the current pipeline has completed rendering.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: A parameter is nullptr or has an invalid value.
Possible causes are as follows:
1. The audioSuitePipeline parameter is nullptr.
2. The audioDataArray parameter is nullptr.
3. A member of the audioDataArray parameter is nullptr.
4. The value of requestFrameSize in audioDataArray is less than or equal to 0.
5. The responseSize parameter is nullptr.
6. The finishedFlag parameter is nullptr.
AUDIOSUITE_ERROR_PIPELINE_NOT_EXIST: The pipeline does not exist or has been destroyed.
AUDIOSUITE_ERROR_INVALID_STATE: The pipeline is not running.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The pipeline rendering is complete. (finishedFlag is written as true when this function is called.)
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteNodeBuilder_Create()

OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_Create(OH_AudioNodeBuilder** builder)

Description

Obtains an audio creation node builder, which is used to configure and create audio nodes. The builder can be reused. However, if the attributes of the new node are different from those of the previous node, you must use OH_AudioSuiteNodeBuilder_Reset to reset the builder.

Since: 22

Parameters

NameDescription
OH_AudioNodeBuilder** builderDouble pointer used to receive the handle to the audio creation node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, builder is nullptr.
AUDIOSUITE_ERROR_MEMORY_ALLOC_FAILED: Memory allocation fails.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteNodeBuilder_Destroy()

OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_Destroy(OH_AudioNodeBuilder* builder)

Description

Destroys an audio creation node builder. This function must be called after the builder is no longer required.

Since: 22

Parameters

NameDescription
OH_AudioNodeBuilder* builderAudio creation node handle, which is obtained by calling OH_AudioSuiteNodeBuilder_Create.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, builder is nullptr.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteNodeBuilder_Reset()

OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_Reset(OH_AudioNodeBuilder* builder)

Description

Resets an audio creation node builder, clearing all previously set parameters. If you want to reuse the builder to create a node with different properties, this function must be called to clear all properties (for example, node type).

Since: 22

Parameters

NameDescription
OH_AudioNodeBuilder* builderAudio creation node handle, which is obtained by calling OH_AudioSuiteNodeBuilder_Create.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, builder is nullptr.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteNodeBuilder_SetNodeType()

OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_SetNodeType(OH_AudioNodeBuilder* builder, OH_AudioNode_Type type)

Description

Sets the type of node to be constructed by the current node builder. During node creation, other parameters are verified based on the node type. This property must be set for all node types.

Since: 22

Parameters

NameDescription
OH_AudioNodeBuilder* builderAudio creation node handle, which is obtained by calling OH_AudioSuiteNodeBuilder_Create.
OH_AudioNode_Type typeNode type.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The node type is set successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: A parameter is invalid. For example, builder is a null pointer.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteNodeBuilder_SetFormat()

OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_SetFormat(OH_AudioNodeBuilder* builder, OH_AudioFormat audioFormat)

Description

Configures the audio format for input or output nodes. This function can only be used before node creation. For input nodes, it allows the application to specify the audio format for writing data.
For output nodes, it allows the application to specify the desired audio format for obtaining data.
This function is not supported for other node types.

Since: 22

Parameters

NameDescription
OH_AudioNodeBuilder* builderAudio creation node handle, which is obtained by calling OH_AudioSuiteNodeBuilder_Create.
OH_AudioFormat audioFormatAudio stream format.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: A parameter is invalid. For example, builder is a null pointer.
AUDIOSUITE_ERROR_UNSUPPORTED_FORMAT: The value of channelCount in audioFormat is not supported.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_InputNode_RequestDataCallback()

typedef int32_t (*OH_InputNode_RequestDataCallback)(OH_AudioNode* audioNode, void* userData, void* audioData, int32_t audioDataSize, bool* finished)

Description

Sets a callback function for the input node to request data.

NOTE

Applications should write the PCM audio data to be processed to audioData, from which OHAudioSuite obtains the data for audio creation.

  • Applications should write data to audioData that does not exceed the size specified by audioDataSize.
  • Once all data has been passed to the pipeline through this callback, the application should set finished to true in the last callback. After this, the pipeline will no longer call this function.
  • Only input nodes require this configuration; other nodes do not.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
void* userDataPointer to user-specific data. When the system calls this callback function, userData passed by calling OH_AudioSuiteNodeBuilder_SetRequestDataCallback is used.
void* audioDataPointer to the memory address provided by the system, where the application should write the audio data stream to be processed (to be filled by the user).
int32_t audioDataSizeByte size of the memory address allocated for audioData.
bool* finishedPointer to the flag indicating whether the audio data stream for the node specified by audioNode has been fully written. true if fully written, false otherwise.

Returns

TypeDescription
int32_tEffective length of the data written into the audioData buffer (in bytes).
The return value must be in the range of [0, audioDataSize]. If the return value is less than 0, the system changes the return value to 0.
If the return value is greater than audioDataSize, the system changes the return value to audioDataSize.

OH_AudioSuiteNodeBuilder_SetRequestDataCallback()

OH_AudioSuite_Result OH_AudioSuiteNodeBuilder_SetRequestDataCallback(OH_AudioNodeBuilder* builder, OH_InputNode_RequestDataCallback callback, void* userData)

Description

Sets a callback function for writing audio data for the current input node builder.

Since: 22

Parameters

NameDescription
OH_AudioNodeBuilder* builderAudio creation node handle, which is obtained by calling OH_AudioSuiteNodeBuilder_Create.
OH_InputNode_RequestDataCallback callbackCallback for writing audio data.
void* userDataPointer to user-specific data. The address is passed to the user within the callback function. If it is not used, nullptr can be provided.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM:
Possible causes are as follows:
1. The builder parameter is nullptr.
2. The callback parameter is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_CreateNode()

OH_AudioSuite_Result OH_AudioSuiteEngine_CreateNode(OH_AudioSuitePipeline* audioSuitePipeline, OH_AudioNodeBuilder* builder, OH_AudioNode** audioNode)

Description

Creates an audio node within the audio pipeline based on the audio creation builder. When this function is executed, the system checks the validity of the parameters based on the node type set in the builder.
Applications can determine the cause of errors based on the return value.

Since: 22

Parameters

NameDescription
OH_AudioSuitePipeline* audioSuitePipelineAudio creation pipeline handle, which is obtained by calling OH_AudioSuiteEngine_CreatePipeline.
OH_AudioNodeBuilder* builderAudio creation node handle, which is obtained by calling OH_AudioSuiteNodeBuilder_Create.
OH_AudioNode** audioNodeAudio creation node handle,

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: A parameter is nullptr or has an invalid value.
Possible causes are as follows:
1. The audioSuitePipeline parameter is nullptr.
2. The builder parameter is nullptr.
3. The audioNode parameter is nullptr.
AUDIOSUITE_ERROR_CREATED_EXCEED_SYSTEM_LIMITS: The number of nodes of the current type already reaches the upper limit.
For example, attempting to create more than 5 effect nodes.
AUDIOSUITE_ERROR_REQUIRED_PARAMETERS_MISSING: Mandatory parameters are missing when creating a node of the specified type.
For example, the node type is not set in the builder.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: Unsupported operations. For example, setting a callback function for an output node,
or setting an audio format or callback function for an effect node.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_MEMORY_ALLOC_FAILED: Memory allocation fails.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_DestroyNode()

OH_AudioSuite_Result OH_AudioSuiteEngine_DestroyNode(OH_AudioNode* audioNode)

Description

Destroys an audio creation node. Whether a node can be destroyed depends on the state of its associated pipeline. If the pipeline is not in the OH_AudioSuite_PipelineState.AUDIOSUITE_PIPELINE_STOPPED state and the node is in the pipeline processing path, the destruction fails.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The audioNode parameter is nullptr.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_INVALID_STATE: The pipeline is not in the stopped state.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetNodeBypassStatus()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetNodeBypassStatus(OH_AudioNode* audioNode, bool* bypassStatus)

Description

Obtains the effect bypass status of the current node. This function can be used only on effect nodes.
If it is called on an input or output node, the AUDIOSUITE_ERROR_INVALID_PARAM error code is returned.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
bool* bypassStatusPointer to the effect bypass status of the current node. true means that node processing is bypassed, and false means the opposite.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM:
The audioNode or bypassStatus parameter is nullptr.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to an effect node.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_BypassEffectNode()

OH_AudioSuite_Result OH_AudioSuiteEngine_BypassEffectNode(OH_AudioNode* audioNode, bool bypass)

Description

Sets the effect bypass status of the current node (supported only on effect nodes). When bypass is set to true, the effect node passes data through without any processing.
When bypass is set to false, the effect node performs the corresponding effect processing.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
bool bypassEffect bypass status of the current node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The audioNode parameter is nullptr.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to an effect node.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetAudioFormat()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetAudioFormat(OH_AudioNode* audioNode, OH_AudioFormat *audioFormat)

Description

Sets the audio format for input or output nodes after creation. This function is supported only for input and output nodes. The input node specifies the audio source format, and the output node specifies the target format.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioFormat *audioFormatAudio stream format.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The audioNode parameter or audioFormat is nullptr.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to an effect node.
AUDIOSUITE_ERROR_INVALID_STATE: The pipeline is not in the stopped state.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_ConnectNodes()

OH_AudioSuite_Result OH_AudioSuiteEngine_ConnectNodes(OH_AudioNode* sourceAudioNode, OH_AudioNode* destAudioNode)

Description

Connects two nodes, with data flowing from sourceAudioNode to destAudioNode. Connecting nodes will change the pipeline topology and may cause data loss. You are advised to perform this operation when the engine is stopped.
The connection order of nodes in a pipeline is as follows: input node -> effect node -> output node.

Since: 22

Parameters

NameDescription
OH_AudioNode* sourceAudioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioNode* destAudioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The sourceAudioNode parameter or destAudioNode is nullptr.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_CONNECT: Nodes do not support connection.
Possible causes are as follows:
1. The sourceAudioNode parameter points to an output node.
2. The destAudioNode parameter points to an input node.
3. The sourceAudioNode and destAudioNode parameters point to the same node.
4. The sourceAudioNode parameter points to a source separation effect node, but the destAudioNode parameter does not point to an output node.
5. The sourceAudioNode and destAudioNode parameters point to nodes within different pipelines.
6. The pipeline is in the running state, but the destAudioNode parameter does not point to an audio mixer effect node.
7. The pipeline is in the running state, the destAudioNode parameter points to an audio mixer effect node, but the sourceAudioNode parameter does not point to an input node.
AUDIOSUITE_ERROR_INVALID_STATE: The pipeline is in an invalid state. For example, the output node cannot be found.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_DisconnectNodes()

OH_AudioSuite_Result OH_AudioSuiteEngine_DisconnectNodes(OH_AudioNode* sourceAudioNode, OH_AudioNode* destAudioNode)

Description

Disconnect two nodes. This operation will change the pipeline topology and may cause data loss. You are advised to perform this operation when the engine is stopped.

Since: 22

Parameters

NameDescription
OH_AudioNode* sourceAudioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioNode* destAudioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: The sourceAudioNode parameter or destAudioNode is nullptr.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: Unsupported operation.
Possible causes are as follows:
1. The sourceAudioNode parameter points to an output node.
2. The destAudioNode parameter points to an input node.
3. The sourceAudioNode and destAudioNode parameters point to the same node.
4. The sourceAudioNode and destAudioNode parameters point to nodes within different pipelines.
5. The pipeline is in the running state, but the destAudioNode parameter does not point to an audio mixer effect node.
6. The pipeline is in the running state, the destAudioNode parameter points to an audio mixer effect node, but this mixer node is currently connected to only sourceAudioNode.
AUDIOSUITE_ERROR_INVALID_STATE: The pipeline is in an invalid state. For example, the output node cannot be found.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetEqualizerFrequencyBandGains()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetEqualizerFrequencyBandGains(OH_AudioNode* audioNode, OH_EqualizerFrequencyBandGains frequencyBandGains)

Description

Sets the band gain effect for the current equalizer node.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_EqualizerFrequencyBandGains frequencyBandGainsBand gains of the equalizer node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to an equalizer node.
AUDIOSUITE_ERROR_INVALID_PARAM:
Possible causes are as follows:
1. The audioNode parameter is nullptr.
2. The value of each member in frequencyBandGains is not within the range [–10, 10].
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetEqualizerFrequencyBandGains()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetEqualizerFrequencyBandGains(OH_AudioNode* audioNode, OH_EqualizerFrequencyBandGains* frequencyBandGains)

Description

Obtains the band gain effect of the current equalizer node.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_EqualizerFrequencyBandGains* frequencyBandGainsBand gains of the equalizer node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to an equalizer node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode or frequencyBandGains is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetSoundFieldType()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetSoundFieldType(OH_AudioNode* audioNode, OH_SoundFieldType soundFieldType)

Description

Sets the configuration parameters for the sound field effect node.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_SoundFieldType soundFieldTypeConfiguration parameters of the sound field effect node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to a sound field effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetSoundFieldType()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetSoundFieldType(OH_AudioNode* audioNode, OH_SoundFieldType* soundFieldType)

Description

Obtains the configuration parameters of the sound field effect node.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_SoundFieldType* soundFieldTypeConfiguration parameters of the sound field effect node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to a sound field effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode or soundFieldType is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetEnvironmentType()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetEnvironmentType(OH_AudioNode* audioNode, OH_EnvironmentType environmentType)

Description

Sets the configuration parameters for the environment effect node.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_EnvironmentType environmentTypeConfiguration parameters of the environment effect node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to an environment effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetEnvironmentType()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetEnvironmentType(OH_AudioNode* audioNode, OH_EnvironmentType* environmentType)

Description

Obtains the configuration parameters of the environment effect node.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_EnvironmentType* environmentTypeConfiguration parameters of the environment effect node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to an environment effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode or environmentType is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetVoiceBeautifierType()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetVoiceBeautifierType(OH_AudioNode* audioNode, OH_VoiceBeautifierType voiceBeautifierType)

Description

Sets the configuration parameters for the voice beautifier effect node.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_VoiceBeautifierType voiceBeautifierTypeConfiguration parameters of the voice beautifier effect node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to a voice beautifier effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetVoiceBeautifierType()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetVoiceBeautifierType(OH_AudioNode* audioNode, OH_VoiceBeautifierType* voiceBeautifierType)

Description

Obtains the configuration parameters of the voice beautifier effect node.

Since: 22

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_VoiceBeautifierType* voiceBeautifierTypeConfiguration parameters of the voice beautifier effect node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode parameter does not point to a voice beautifier effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters.
For example, audioNode or voiceBeautifierType is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_IsNodeTypeSupported()

OH_AudioSuite_Result OH_AudioSuiteEngine_IsNodeTypeSupported(OH_AudioNode_Type nodeType, bool* isSupported)

Description

Checks whether the system supports the creation of a specified node type to avoid node creation failure. This function is called independently of engine and pipeline states and is only related to the system, without the need to create an engine or pipeline.

Since: 22

Parameters

NameDescription
OH_AudioNode_Type nodeTypeType of the node.
bool* isSupportedPointer to the variable that specifies the support for node creation. true if supported, false otherwise.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid input parameter.
For example, the input parameter nodeType is not within the range of OH_AudioNode_Type, or isSupported is nullptr.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetSpaceRenderPositionParams()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetSpaceRenderPositionParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderPositionParams position)

Description

Sets the configuration parameters of the spatial rendering effect node in fixed placement mode.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioSuite_SpaceRenderPositionParams positionConfiguration parameters of the spatial rendering effect node in fixed placement mode.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a spatial rendering effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetSpaceRenderPositionParams()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetSpaceRenderPositionParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderPositionParams* position)

Description

Obtains the configuration parameters of the spatial rendering effect node in fixed placement mode.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioSuite_SpaceRenderPositionParams* positionConfiguration parameters of the spatial rendering effect node in fixed placement mode.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a spatial rendering effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetSpaceRenderRotationParams()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetSpaceRenderRotationParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderRotationParams rotation)

Description

Sets the configuration parameters of the spatial rendering effect node in rotation mode.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioSuite_SpaceRenderRotationParams rotationConfiguration parameters of the spatial rendering effect node in rotation mode.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a spatial rendering effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetSpaceRenderRotationParams()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetSpaceRenderRotationParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderRotationParams* rotation)

Description

Obtains the configuration parameters of the spatial rendering effect node in rotation mode.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioSuite_SpaceRenderRotationParams* rotationConfiguration parameters of the spatial rendering effect node in rotation mode.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a spatial rendering effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetSpaceRenderExtensionParams()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetSpaceRenderExtensionParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderExtensionParams extension)

Description

Sets the configuration parameters of the spatial rendering effect node in extension mode.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioSuite_SpaceRenderExtensionParams extensionConfiguration parameters of the spatial rendering effect node in extension mode.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a spatial rendering effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetSpaceRenderExtensionParams()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetSpaceRenderExtensionParams(OH_AudioNode* audioNode, OH_AudioSuite_SpaceRenderExtensionParams* extension)

Description

Obtains the configuration parameters of the spatial rendering effect node in extension mode.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioSuite_SpaceRenderExtensionParams* extensionConfiguration parameters of the spatial rendering effect node in extension mode.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a spatial rendering effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetTempoAndPitch()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetTempoAndPitch(OH_AudioNode* audioNode, float speed, float pitch)

Description

Sets the configuration parameters of the tempo and pitch shifting effect node.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
float speedSpeed change parameter. The value range is [0.5, 10.0].
float pitchPitch change parameter. The value range is [0.1, 5.0].

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a tempo and pitch shifting effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetTempoAndPitch()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetTempoAndPitch(OH_AudioNode* audioNode, float* speed, float* pitch)

Description

Obtains the configuration parameters of the tempo and pitch shifting effect node.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
float* speedSpeed change parameter. The value range is [0.5, 10.0].
float* pitchPitch change parameter. The value range is [0.1, 5.0].

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a tempo and pitch shifting effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetPureVoiceChangeOption()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetPureVoiceChangeOption(OH_AudioNode* audioNode, OH_AudioSuite_PureVoiceChangeOption option)

Description

Sets the configuration parameters of the pure voice change node.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioSuite_PureVoiceChangeOption optionConfiguration parameters of the pure voice change effect node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a pure voice change effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetPureVoiceChangeOption()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetPureVoiceChangeOption(OH_AudioNode* audioNode, OH_AudioSuite_PureVoiceChangeOption* option)

Description

Obtains the configuration parameters of the pure voice change node.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioSuite_PureVoiceChangeOption* optionConfiguration parameters of the pure voice change effect node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a pure voice change effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_SetGeneralVoiceChangeType()

OH_AudioSuite_Result OH_AudioSuiteEngine_SetGeneralVoiceChangeType(OH_AudioNode* audioNode, OH_AudioSuite_GeneralVoiceChangeType type)

Description

Sets the configuration parameters of the general voice change node.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioSuite_GeneralVoiceChangeType typeConfiguration parameters of the general voice change node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a general voice change effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

OH_AudioSuiteEngine_GetGeneralVoiceChangeType()

OH_AudioSuite_Result OH_AudioSuiteEngine_GetGeneralVoiceChangeType(OH_AudioNode* audioNode, OH_AudioSuite_GeneralVoiceChangeType* type)

Description

Obtains the configuration parameters of the general voice change node.

Since: 23

Parameters

NameDescription
OH_AudioNode* audioNodeAudio creation node handle, which is obtained by calling OH_AudioSuiteEngine_CreateNode.
OH_AudioSuite_GeneralVoiceChangeType* typeConfiguration parameters of the general voice change node.

Returns

TypeDescription
OH_AudioSuite_ResultAUDIOSUITE_SUCCESS: The function is executed successfully.
AUDIOSUITE_ERROR_NODE_NOT_EXIST: The node does not exist or has been destroyed.
AUDIOSUITE_ERROR_UNSUPPORTED_OPERATION: The audioNode node type is not a general voice change effect node.
AUDIOSUITE_ERROR_INVALID_PARAM: Invalid parameters. For example, audioNode is nullptr.
AUDIOSUITE_ERROR_TIMEOUT: The operation times out.
AUDIOSUITE_ERROR_SYSTEM: Other system exceptions occur.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-native-audiostreambuilder-h

openharmony 鸿蒙 capi-ohaudiosuite

openharmony 鸿蒙 js-apis-inner-multimedia-systemSoundPlayer

openharmony 鸿蒙 arkts-apis-audio-i

openharmony 鸿蒙 capi-ohaudio

openharmony 鸿蒙 capi-ohmidi

openharmony 鸿蒙 arkts-apis-audio-AudioManager

openharmony 鸿蒙 capi-ohaudiosuite-oh-audiosuite-spacerenderpositionparams

openharmony 鸿蒙 capi-ohaudio-oh-audiostreaminfo

openharmony 鸿蒙 errorcode-ringtone

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/dFMAjslM