PCM 資料處理
在音波播放時獲取 PCM 資料
您可以使用 OnGeneratePCMData 委派來在音波播放時獲取 PCM 資料。這在處理或分析 PCM 音訊資料時非常有用。
- Blueprint
- C++

// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object (or its derived type, such as UStreamingSoundWave, UCapturableSoundWave, etc.)
ImportedSoundWave->OnGeneratePCMDataNative.AddWeakLambda(this, [this](const TArray<float>& PCMData)
{
// Handle the result
});
獲取新填充的 PCM 資料
OnPopulateAudioData 委派可用於獲取新填充的 PCM 資料,這對於串流音波特別有用,並可簡化音訊分析流程。
- Blueprint
- C++

// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object (or its derived type, such as UStreamingSoundWave, UCapturableSoundWave, etc.)
ImportedSoundWave->OnPopulateAudioDataNative.AddWeakLambda(this, [this](const TArray<float>& PopulatedAudioData)
{
// Handle the result
});
將 PCM 資料轉換為位元組
從這些委派取得的 PCM 資料為 32 位元浮點 PCM 格式。如果您需要將 PCM 資料轉換為位元組,請參閱 Transcode Audio。