AgoraAudioParams

  • iOS

更新时间不可用

设置音频数据格式。

Objective-C
@interface AgoraAudioParams : NSObject
@property (assign, nonatomic) NSInteger sampleRate;
@property (assign, nonatomic) NSInteger channel;
@property (assign, nonatomic) AgoraAudioRawFrameOperationMode mode;
@property (assign, nonatomic) NSInteger samplesPerCall;
@end

你可以在以下 API 中传入 AgoraAudioParams 对象,以设置对应回调的音频数据格式:

注: SDK 会通过 AgoraAudioParams 中的 samplesPerCall、sampleRate 和 channel 参数计算采样间隔,并根据采样间隔触发 onRecordAudioFrame:channelId:、onPlaybackAudioFrame:、onMixedAudioFrame:channelId: 和 onEarMonitoringAudioFrame: 回调。 采样间隔(秒) = samplesPerCall / (sampleRate × channel)。 请确保采样间隔 ≥ 0.01 秒。

属性

参数名描述
sampleRate

音频采样率(Hz),可设置为以下值之一:

  • 8000。
  • (默认)16000。
  • 32000。
  • 44100。
  • 48000。
channel

音频声道数,可设置为以下值之一:

  • 1:(默认)单声道。
  • 2:立体声。
mode

音频数据的使用模式。详见 AgoraAudioRawFrameOperationMode。

samplesPerCall

每次回调的采样点数量,例如媒体推流时为 1024。

表格内容超出当前宽度,可横向滚动查看更多列。

这个页面有帮助吗?