gtreshchev / RuntimeAudioImporter

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

Fixed runtime audio compression #24

Closed Caffiendish closed 2 years ago

Caffiendish commented 2 years ago

Unfortunately, compressed audio has to be axed for now; I just don't know where to put a decoder, to make it function (and avoid the exception).

Using EDecompressionType::DTYPE_Setup; and filling the raw buffer works in editor, but not in a runtime build.

gtreshchev commented 2 years ago

I agree with setting the type of decompression depending on the buffer to fill, thanks!

As for deleting the compressed buffer, in 5.0.0 and previous versions it works fine. The reason this doesn't work on 5.0.2 is because the sound wave changes frequently in the engine and there is no exact way to dynamically fill the compressed buffer that will work in the future.

My thoughts are to completely remove the compression functionality, at least because there is no way to clean up the audio data, whatever it is. In a procedural sound wave, at least this is possible.

While the procedural sound wave is not yet dynamically garbage collected if it has been played, I suggest leaving this functionality.

Caffiendish commented 2 years ago

My thoughts are to completely remove the compression functionality, at least because there is no way to clean up the audio data, whatever it is. In a procedural sound wave, at least this is possible.

Doesn't the engine automatically clean these up when they're no longer required, since they're just normal SoundWaves? The issue with ProceduralSoundWaves is that they never end, there's some logic there that they're weirdly excepted from, and even if you terminate the ProceduralSoundWave playing, and get it to the "NotPlaying" status, the engine still never cleans it up.

I'd actually planned to make a branch of this plugin that is only the compression portion, and optionally build the FFT data on importing the sound data.

Caffiendish commented 2 years ago

Unless you mean the bit of the compression functionality that I commented out, in which case, I just don't know how to get that to work right now.

gtreshchev commented 2 years ago

Sorry, but I think the next step would be to completely remove the compression functionality as it doesn't make sense from a garbage collection and maintainability points of view.