gtreshchev / RuntimeAudioImporter

Runtime Audio Importer plugin for Unreal Engine. Importing audio of various formats at runtime.
MIT License
336 stars 69 forks source link

PCMdata #41

Closed tbehrang closed 1 year ago

tbehrang commented 1 year ago

Hi.when I am recieving PCMdata they are in array of floats is it possible to implement PCDMdata as array of bytes. there are plugins that will not read this and when I convert it back to bytes myself there were problems always. is it possible to add this feature also?tnx

gtreshchev commented 1 year ago

Hi. Regarding the input for RAW (PCM) data in the plugin, it currently expects an array of bytes, even if the PCM data is in floating point format. This design choice was made to ensure compatibility with the reflection system (Blueprints) and to avoid delving into the K2Nodes.

If you're working with C++, you can convert an array of floats (TArray<float>) to an array of bytes (TArray<uint8>) using the following code snippet:

TArray<float> FloatArray; // Your initial PCM array with floating point data
TArray<uint8> ByteArray(reinterpret_cast<uint8*>(FloatArray.GetData()), FloatArray.Num() * sizeof(float)); // The converted PCM array of bytes for use with RuntimeAudioImporter functions