I’m trying to implement voice chat on Windows and the following code (copied from TestVoice.cpp) results in VoiceCapture, VoiceEncoder and VoiceDecoder being Null, making the IsValid call return false:
#include "OnlineSubsystemUtils.h"
#include "VoiceController.h"
#include "Engine.h"
#include "Voice.h"
...
bool AVoiceController::Init()
{
UE_LOG(LogTemp, Warning, TEXT("VoiceController Init"));
VoiceCapture = FVoiceModule::Get().CreateVoiceCapture();
VoiceEncoder = FVoiceModule::Get().CreateVoiceEncoder();
VoiceDecoder = FVoiceModule::Get().CreateVoiceDecoder();
if (VoiceCapture.IsValid())
{
UE_LOG(LogTemp, Warning, TEXT("VoiceController Init is valid"));
VoiceCapture->Start();
}
return true;
}
...
Does anybody have any ideas why this may be happening?
Edit: I’m calling Init on event begin play.