Xử lý Dữ liệu PCM
Lấy Dữ liệu PCM khi sóng âm thanh đang phát
Bạn có thể sử dụng delegate OnGeneratePCMData để lấy dữ liệu PCM khi sóng âm thanh đang phát. Điều này hữu ích khi xử lý hoặc phân tích dữ liệu âm thanh 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
});
Lấy dữ liệu PCM mới được điền
OnPopulateAudioData delegate có thể được sử dụng để lấy dữ liệu PCM mới được điền, điều này đặc biệt hữu ích cho việc streaming các sound wave và có thể đơn giản hóa quá trình phân tích âm thanh.
- 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
});
Chuyển đổi dữ liệu PCM thành byte
Dữ liệu PCM thu được từ các delegate này ở định dạng PCM float 32-bit. Nếu bạn cần chuyển đổi dữ liệu PCM thành byte, hãy xem Transcode Audio.