I wanted record and pass on the audio samples from the microphone to an external system so I created my own SceneComponent that in turns hold an AudioCapture object.
Since this will be push-to-talk I am setting it up first with the intention of starting/stopping the recording with StartCapturingAudio and StopCapturingAudio.
However, when running start after having done StopCapturingAudio I run into the assert here:
I haven’t yet got anything running, but it looks like I am capturing audio in my set up. However, before getting to that I’m seeing an issue with not being able to gracefully handle the shutdown of the audio capture when closing the game.
I’ve tried multiple ways to handle CaptureSynth.StopCapturing(); but without being able to get to FWasapiCaptureThread I can’t block things until it has gracefully terminated, so it’s getting destroyed whilst still active.
This gives access to StartCapturing() StopCapturing() AND AbortCapturing()
I found that just calling StopCapturing() during BeginDestroy wasn’t enough, and just calling AbortCapturing() did work, but CaptureSynth.IsCapturing() would continue to be true. So I tried calling StopCapturing() AND AbortCapturing() in succession and that seemed to handle terminating the thread and shutting down the active capture.
I haven’t gone into the code to see what’s going on further than that, but I no longer get any assert when closing the game and my logs output that IsCapturing() has ended during destroy.