gtreshchev / RuntimeAudioImporter

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

Audio occlusion does not work with imported sounds #68

Closed ko4t53e6 closed 2 weeks ago

ko4t53e6 commented 2 months ago

Great plugin, but I can't get audio occlusion to work with an imported soundwave. Occlusion is working fine for me with a normal soundwave, but not with an imported soundwave.

CheckOcclusion() in ActiveSound.cpp is running on the tick as expected, but the necessary AsyncLineTraceByChannelis no longer called after the first few frames of play, where as with a normal soundwave it gets called each frame.

gtreshchev commented 2 weeks ago

Hi, what's your UE version? Are you using the latest version of the RuntimeAudioImporter plugin? In UE 5.4, the occlusion works correctly for me with the imported sound waves from RuntimeAudioImporter. Here are the steps you can follow to make audio occlusion work:

  1. Create a Sound Attenuation (USoundAttenuation) asset and set bEnableOcclusion to True.
  2. In your audio component (components derived from UAudioComponent), set the AttenuationSettings to the asset created in the previous step.
  3. Place that audio component in your desired actor. When you import the sound within the RuntimeAudioImporter's workflow, call SetSound (and then Play, as needed) from your audio component and specify the imported sound wave in NewSound pin.

If you're using a different method to enable sound attenuation or a different version of the engine that you suspect might be causing the issue, please reopen this issue and provide more details with your steps to reproduce the problem.