FAudioRecordingConfiguration
录音配置。
C++
USTRUCT(BlueprintType)
struct FAudioRecordingConfiguration
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration")
FString filePath = "";
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration")
bool encode = false;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration")
int sampleRate = 0;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration")
EAUDIO_FILE_RECORDING_TYPE fileRecordingType = EAUDIO_FILE_RECORDING_TYPE::AUDIO_FILE_RECORDING_MIXED;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration")
EAUDIO_RECORDING_QUALITY_TYPE quality = EAUDIO_RECORDING_QUALITY_TYPE::AUDIO_RECORDING_QUALITY_LOW;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration")
int recordingChannel = 0;
FAudioRecordingConfiguration(){}
FAudioRecordingConfiguration(const agora::rtc::AudioRecordingConfiguration & AgoraData){
filePath = UTF8_TO_TCHAR(AgoraData.filePath);
encode = AgoraData.encode;
sampleRate = AgoraData.sampleRate;
fileRecordingType = static_cast<EAUDIO_FILE_RECORDING_TYPE>(AgoraData.fileRecordingType);
quality = static_cast<EAUDIO_RECORDING_QUALITY_TYPE>(AgoraData.quality);
recordingChannel = AgoraData.recordingChannel;
}
agora::rtc::AudioRecordingConfiguration CreateAgoraData() const {
agora::rtc::AudioRecordingConfiguration AgoraData;
SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.filePath, this->filePath)
AgoraData.encode = encode;
AgoraData.sampleRate = sampleRate;
AgoraData.fileRecordingType = static_cast<agora::rtc::AUDIO_FILE_RECORDING_TYPE>(fileRecordingType);
AgoraData.quality = static_cast<agora::rtc::AUDIO_RECORDING_QUALITY_TYPE>(quality);
AgoraData.recordingChannel = recordingChannel;
return AgoraData;
}
void FreeAgoraData(agora::rtc::AudioRecordingConfiguration& AgoraData) const {
SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.filePath)
}
};
filePath
录音文件在本地保存的绝对路径,需精确到文件名及格式。例如:
C:\music\audio.aac
。 注意
请确保你指定的路径存在并且可写。
encode
设置是否编码音频数据:
true
: 将音频数据用 AAC 编码。false
:(默认)不编码音频数据,直接保存录制的音频数据。
sampleRate
录音采样率(Hz)。
- 16000
- 32000 (默认)
- 44100
- 48000
注意
如果把该参数设为 44100 或 48000,为保证录音效果,建议录制 WAV 文件或 quality 为 AUDIO_RECORDING_QUALITY_MEDIUM 或 AUDIO_RECORDING_QUALITY_HIGH 的 AAC 文件。
fileRecordingType
录音内容。详见 EAUDIO_FILE_RECORDING_TYPE。
quality
录音音质。详见 EAUDIO_RECORDING_QUALITY_TYPE。
注意
该参数仅适用于 AAC 文件。
recordingChannel
录制的音频声道。目前支持如下取值:
- 1:(默认)单声道。
- 2: 双声道。
信息
实际录制的音频声道与你采集的音频声道有关:
- 如果采集的音频为单声道,recordingChannel 设为
2
, 则录制的音频为经过单声道数据拷贝后的双声道数据,而不是立体声。 - 如果采集的音频为双声道,recordingChannel 设为
1
,则录制的音频为经过双声道数据混合后的单声道数据。