gtreshchev / RuntimeAudioImporter

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

UCapturableSoundWave::StartCapture(int32 DeviceId) takes index in array to identify device, making the blueprint misleading and complicated #33

Closed jkwp closed 8 months ago

jkwp commented 1 year ago

https://github.com/gtreshchev/RuntimeAudioImporter/blob/2c49ef9f6b4f7c19e1dadb49f95cea5a891d1811/Source/RuntimeAudioImporter/Private/Sound/CapturableSoundWave.cpp#L82

The device ID provided when retrieving input devices is a UUID or GUID and converting to array index is not straight forward. The simple fix would be to correct the variable name, however the best solution would be to refer to the device by UUID/GUID and handle look up within the function so that it can handle the reordering of input devices at run time.

gtreshchev commented 1 year ago

Thanks for the suggestion! Agree, it's not quite intuitive.

I should also mention that I'm quite limited in terms of the engine. The process for capturing audio involves using two different structures - FCaptureDeviceInfo for retrieving the available devices, which uses FString to store the device ID, which could potentially be empty. And when starting the capture, FAudioCaptureDeviceParams is used and requires an int32 device ID, which is based on the device order within the platform-dependent implementation.

Anyway, feel free to share more suggestions or create a pull request if you'd like.