IVoiceCapture.Start() crashes without any Mic

I’ve been playing around with the IVoiceCapture interface lately to do some audio-related gameplay features. I’ve noticed that the following lines totally freeze the engine when being executed without any connected device to record audio (such as a microphone):

	// Get capture object
	voiceCapture = FVoiceModule::Get().CreateVoiceCapture();

	// This freezes the engine, when no mic is connected
	if (voiceCapture->Start())  GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, TEXT("It worked!"));
	else  GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("It didn't...!"));

So, With a connected microphone to record sound: Zero problems. But if nothing’s connected the engine freezes. Is there a reliable way to detect if there are more than 0 recording devices connected?

Thank you for your help :slight_smile:

You should check the voice capture object:

if (VoiceCapture.IsValid())
{
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, TEXT("It worked!"));
}
else
{
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("It didn't...!"))
}

Also, by looking at the source it looks like it’s supported on Windows platform only.