openharmony 鸿蒙 capi-native-audio-stream-manager-h

2026-08-25 浏览 (1)

native_audio_stream_manager.h

Overview

The file declares the functions related to an audio stream manager.

You can call the functions to create an audio stream manager and set and manage audio streams.

File to include: <ohaudio/native_audio_stream_manager.h>

Library: libohaudio.so

System capability: SystemCapability.Multimedia.Audio.Core

Since: 19

Related module: OHAudio

Summary

Structs

Nametypedef KeywordDescription
OH_AudioStreamManagerOH_AudioStreamManagerDescribes an audio stream manager, which is used for audio stream management.

Functions

NameDescription
OH_AudioCommon_Result OH_AudioManager_GetAudioStreamManager(OH_AudioStreamManager **streamManager)Obtains the handle to the audio stream manager.
OH_AudioCommon_Result OH_AudioStreamManager_GetDirectPlaybackSupport(OH_AudioStreamManager *audioStreamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_Usage usage, OH_AudioStream_DirectPlaybackMode *directPlaybackMode)Obtains the direct playback mode supported by an audio stream.
OH_AudioCommon_Result OH_AudioStreamManager_IsAcousticEchoCancelerSupported(OH_AudioStreamManager *streamManager, OH_AudioStream_SourceType sourceType, bool *supported)Checks whether the audio stream of the specified source type supports acoustic echo cancellation.
bool OH_AudioStreamManager_IsFastPlaybackSupported(OH_AudioStreamManager *streamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_Usage usage)Checks whether the current device supports low-latency playback for the specified audio stream information and usage scenario.
bool OH_AudioStreamManager_IsFastRecordingSupported(OH_AudioStreamManager *streamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_SourceType source)Checks whether the current device supports low-latency recording for the specified audio stream information and usage scenario.
bool OH_AudioStreamManager_IsIntelligentNoiseReductionEnabledForCurrentDevice(OH_AudioStreamManager *streamManager, OH_AudioStream_SourceType source)Checks whether the intelligent noise reduction feature is enabled for the audio stream of the specified source type.

Function Description

OH_AudioManager_GetAudioStreamManager()

OH_AudioCommon_Result OH_AudioManager_GetAudioStreamManager(OH_AudioStreamManager **streamManager)

Description

Obtains the handle to the audio stream manager.

Since: 19

Parameters

NameDescription
OH_AudioStreamManager **streamManagerDouble pointer to the audio stream manager.

Returns

TypeDescription
OH_AudioCommon_ResultAUDIOCOMMON_RESULT_SUCCESS = 0: The function is executed successfully.
AUDIOCOMMON_RESULT_ERROR_SYSTEM = 6800301: The system status is incorrect.

OH_AudioStreamManager_GetDirectPlaybackSupport()

OH_AudioCommon_Result OH_AudioStreamManager_GetDirectPlaybackSupport(OH_AudioStreamManager *audioStreamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_Usage usage, OH_AudioStream_DirectPlaybackMode *directPlaybackMode)

Description

Obtains the direct playback mode supported by an audio stream.

Since: 19

Parameters

NameDescription
OH_AudioStreamManager *audioStreamManagerHandle to the audio stream manager. The handle is obtained by calling OH_AudioManager_GetAudioStreamManager.
OH_AudioStreamInfo *streamInfoPointer to the audio stream information.
OH_AudioStream_Usage usageUsage scenario of the audio stream.
OH_AudioStream_DirectPlaybackMode *directPlaybackModePointer to OH_AudioStream_DirectPlaybackMode, which is used to receive the direct playback mode supported.

Returns

TypeDescription
OH_AudioCommon_ResultAUDIOCOMMON_RESULT_SUCCESS = 0: The function is executed successfully.
AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM = 6800101:
1. The audioStreamManager parameter is nullptr.
2. The streamInfo parameter is nullptr.
3. The usage parameter is invalid.
4. The directPlaybackMode parameter is nullptr.

OH_AudioStreamManager_IsAcousticEchoCancelerSupported()

OH_AudioCommon_Result OH_AudioStreamManager_IsAcousticEchoCancelerSupported(OH_AudioStreamManager *streamManager, OH_AudioStream_SourceType sourceType, bool *supported)

Description

Checks whether the audio stream of the specified source type supports acoustic echo cancellation.

Since: 20

Parameters

NameDescription
OH_AudioStreamManager *streamManagerHandle to the audio stream manager. The handle is obtained by calling OH_AudioManager_GetAudioStreamManager.
OH_AudioStream_SourceType sourceTypeUsage scenario (OH_AudioStream_SourceType) of the audio input stream.
bool *supportedPointer to the result for the support of acoustic echo cancellation. true if supported, false otherwise.

Returns

TypeDescription
OH_AudioCommon_ResultAUDIOCOMMON_RESULT_SUCCESS = 0: The function is executed successfully.
AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM = 6800101:
1. The audioStreamManager parameter is nullptr.
2. The sourceType parameter is invalid.
3. The supported parameter is nullptr.

OH_AudioStreamManager_IsFastPlaybackSupported()

bool OH_AudioStreamManager_IsFastPlaybackSupported(OH_AudioStreamManager *streamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_Usage usage)

Description

Checks whether the current device supports low-latency playback for the specified audio stream information and usage scenario.

Since: 20

Parameters

NameDescription
OH_AudioStreamManager *streamManagerHandle to the audio stream manager. The handle is obtained by calling OH_AudioManager_GetAudioStreamManager.
OH_AudioStreamInfo *streamInfoPointer to the audio stream information.
OH_AudioStream_Usage usageUsage scenario of the audio stream.

Returns

TypeDescription
boolCheck result for the support of low-latency playback. true if supported, false otherwise.

OH_AudioStreamManager_IsFastRecordingSupported()

bool OH_AudioStreamManager_IsFastRecordingSupported(OH_AudioStreamManager *streamManager, OH_AudioStreamInfo *streamInfo, OH_AudioStream_SourceType source)

Description

Checks whether the current device supports low-latency recording for the specified audio stream information and usage scenario.

Since: 20

Parameters

NameDescription
OH_AudioStreamManager *streamManagerHandle to the audio stream manager. The handle is obtained by calling OH_AudioManager_GetAudioStreamManager.
OH_AudioStreamInfo *streamInfoPointer to the audio stream information.
OH_AudioStream_SourceType sourceUsage scenario of the audio stream.

Returns

TypeDescription
boolCheck result for the support of low-latency recording. true if supported, false otherwise.

OH_AudioStreamManager_IsIntelligentNoiseReductionEnabledForCurrentDevice()

bool OH_AudioStreamManager_IsIntelligentNoiseReductionEnabledForCurrentDevice(OH_AudioStreamManager *streamManager, OH_AudioStream_SourceType source)

Description

Checks whether the intelligent noise reduction feature is enabled for the audio stream of the specified source type.

Since: 21

Parameters

NameDescription
OH_AudioStreamManager *streamManagerHandle to the audio stream manager. which is obtained by calling OH_AudioManager_GetAudioStreamManager.
OH_AudioStream_SourceType sourceAudio stream usage scenario determined based on the audio device and pipe type.

Returns

TypeDescription
boolCheck result for whether the intelligent noise reduction feature is enabled. true if enabled, and false otherwise.

你可能感兴趣的鸿蒙文章

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/cHAVQjcz