Voice Chat

From PSwiki
Jump to navigation Jump to search

Unreal default voice chat

As soon as the second player join the session, this happens:

APlayerState::RegisterPlayerWithSession()

FOnlineSessionNull::RegisterPlayers()

FOnlineSessionNull::RegisterVoice()

prints "StartRemoteVoiceProcessing(%s) returned 0x%08X"

Execute ToggleSpeak console command
    APlayerController::ToggleSpeaking()
      C:\UnrealEngine\Engine\Plugins\Online\OnlineSubsystemUtils\Source\OnlineSubsystemUtils\Private\VoiceInterfaceImpl.cpp
        ??? FOnlineVoiceImpl::RegisterRemoteTalker() ???
        UOnlineEngineInterfaceImpl::StartNetworkedVoice()
        FOnlineVoiceImpl::StartNetworkedVoice()              
          FVoiceEngineImpl::StartLocalVoiceProcessing()
            FVoiceCaptureWindows::Start()
 Inside FVoiceCaptureWindows::Tick()
   FVoiceCaptureWindows::ProcessData()
 Inside FOnlineVoiceImpl::Tick()
      // Queue local packets for sending via the network
      ProcessLocalVoicePackets();
      // Submit queued packets to audio system
      ProcessRemoteVoicePackets();
 Determines which other connections should receive the voice packet
   UNetDriver::ReplicateVoicePacket()
      UNetConnection::ShouldReplicateVoicePacketFrom()
 Client receives the data through
    UNetConnection::ReceivedPacket()
      ...
       UVoiceChannel::ReceivedBunch()
          

Unreal default voice properties

MaxLocalTalkers: Maximum permitted local talkers, default 1 MaxRemoteTalkers: Maximum permitted remote talkers, default 16 VoiceNotificationDelta: Time to wait for new data before triggering "not talking", default 0.2 seconds


Mumble

1) Install CMake

2) Install vcpkg https://vcpkg.io/en/getting-started.html

3) vcpkg --triplet x64-windows-static-md install opus

4) cmake -G "Visual Studio 17 2022" . -DCMAKE_GENERATOR_PLATFORM=x64 -DOpus_DIR:PATH="F:\My Programs\Develop\CMake\share\cmake-3.25\Modules\Opus"


cmake -G "Visual Studio 17 2022" . -DCMAKE_GENERATOR_PLATFORM=x64 -DOpus_DIR:PATH="F:\My Programs\Develop\CMake\share\cmake-3.25\Modules\Opus" -DCMAKE_TOOLCHAIN_FILE="F:\My Programs\Develop\vcpkg\vcpkg\scripts\buildsystems\vcpkg.cmake"

My vcvars: E:\VisualStudio2022\VC\Auxiliary\Build\vcvars64.bat

Resources

https://forums.unrealengine.com/t/voice-chat-in-multiplayer/425089


https://couchlearn.com/positional-voice-chat-using-blueprints-in-ue4/


https://www.youtube.com/watch?v=07hi0B7Dnwo

https://docs.unrealengine.com/5.0/en-US/voice-chat-interface-in-unreal-engine/


C:\UnrealEngine\Engine\Source\Runtime\Online\Voice\Private\VoiceModule.cpp

C:\UnrealEngine\Engine\Source\Runtime\Online\Voice\Private\VoiceCodecOpus.h

void APlayerController::ToggleSpeaking

Capture volume: https://www.youtube.com/watch?v=nMNou_FEBx0