1# native_audiostreambuilder.h 2 3 4## 概述 5 6声明音频流构造器相关接口。 7 8包含构造和销毁构造器,设置音频流属性,回调等相关接口。 9 10**系统能力:** SystemCapability.Multimedia.Audio.Core 11 12**起始版本:** 10 13 14**相关模块:**[OHAudio](_o_h_audio.md) 15 16 17## 汇总 18 19 20### 函数 21 22| 名称 | 描述 | 23| -------- | -------- | 24| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_Create](_o_h_audio.md#oh_audiostreambuilder_create) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*\*builder, [OH_AudioStream_Type](_o_h_audio.md#oh_audiostream_type) type) | 创建一个输入或者输出类型的音频流构造器。 | 25| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_Destroy](_o_h_audio.md#oh_audiostreambuilder_destroy) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder) | 销毁一个音频流构造器。 | 26| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_SetSamplingRate](_o_h_audio.md#oh_audiostreambuilder_setsamplingrate) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, int32_t rate) | 设置音频流的采样率属性。 | 27| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_SetChannelCount](_o_h_audio.md#oh_audiostreambuilder_setchannelcount) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, int32_t channelCount) | 设置音频流的通道数属性。 | 28| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_SetSampleFormat](_o_h_audio.md#oh_audiostreambuilder_setsampleformat) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, [OH_AudioStream_SampleFormat](_o_h_audio.md#oh_audiostream_sampleformat) format) | 设置音频流的采样格式属性。 | 29| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_SetEncodingType](_o_h_audio.md#oh_audiostreambuilder_setencodingtype) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, [OH_AudioStream_EncodingType](_o_h_audio.md#oh_audiostream_encodingtype) encodingType) | 设置音频流的编码类型属性。 | 30| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_SetLatencyMode](_o_h_audio.md#oh_audiostreambuilder_setlatencymode) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, [OH_AudioStream_LatencyMode](_o_h_audio.md#oh_audiostream_latencymode) latencyMode) | 设置音频流的时延模式。 | 31| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_SetRendererInfo](_o_h_audio.md#oh_audiostreambuilder_setrendererinfo) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, [OH_AudioStream_Usage](_o_h_audio.md#oh_audiostream_usage) usage) | 设置输出音频流的工作场景。 | 32| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_SetCapturerInfo](_o_h_audio.md#oh_audiostreambuilder_setcapturerinfo) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, [OH_AudioStream_SourceType](_o_h_audio.md#oh_audiostream_sourcetype) sourceType) | 设置输入音频流的工作场景。 | 33| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_SetRendererCallback](_o_h_audio.md#oh_audiostreambuilder_setrenderercallback) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, [OH_AudioRenderer_Callbacks](_o_h_audio.md#oh_audiorenderer_callbacks) callbacks, void \*userData) | 设置输出音频流的回调。 | 34| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_SetCapturerCallback](_o_h_audio.md#oh_audiostreambuilder_setcapturercallback) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, [OH_AudioCapturer_Callbacks](_o_h_audio.md#oh_audiocapturer_callbacks) callbacks, void \*userData) | 设置输入音频流的回调。 | 35| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_GenerateRenderer](_o_h_audio.md#oh_audiostreambuilder_generaterenderer) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, [OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer) \*\*audioRenderer) | 创建输出音频流实例。 | 36| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_GenerateCapturer](_o_h_audio.md#oh_audiostreambuilder_generatecapturer) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, [OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer) \*\*audioCapturer) | 创建输入音频流实例。 | 37| [OH_AudioStream_Result](_o_h_audio.md#oh_audiostream_result)[OH_AudioStreamBuilder_SetFrameSizeInCallback](_o_h_audio.md#oh_audiostreambuilder_setframesizeincallback) ([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) \*builder, int32_t frameSize) | 设置每次回调的帧长,帧长至少为音频硬件一次处理的数据大小,并且小于内部缓冲容量的一半。 | 38