Skip to content

#485 Implement voice chat capture, playback and spatialization#242

Draft
adrielgro wants to merge 1 commit into
BeamMP:masterfrom
adrielgro:485-implement-voice-chat
Draft

#485 Implement voice chat capture, playback and spatialization#242
adrielgro wants to merge 1 commit into
BeamMP:masterfrom
adrielgro:485-implement-voice-chat

Conversation

@adrielgro
Copy link
Copy Markdown

Voice Chat — Client-side capture, playback and spatialization

Launcher-side implementation of native voice chat (see issue BeamMP/BeamMP-Server#485).

Changes

  • VoiceChat class (include/Audio/VoiceChat.h, src/Audio/VoiceChat.cpp): PortAudio microphone capture (mono 48 kHz, 20 ms Opus frames), Opus encoding/decoding, stereo playback with equal-power panning, jitter buffer (60 ms), distance attenuation, music stream injection, mic gain (0-800%), master volume, and device hot-swap.
  • Core.cpp: handles 'F' subcommands from the game — PTT start/stop, listener position/orientation, volume, device selection, mic gain, music volume.
  • GlobalHandler.cpp: forwards incoming 'F' UDP packets to VoiceChat::ProcessIncomingVoice.

Dependencies

Two new vcpkg dependencies (no system-level requirements):

  • opus: IETF RFC 6716, MIT-compatible license, used by Discord/WebRTC/Zoom.
  • portaudio: MIT license, wraps WASAPI on Windows, PulseAudio/ALSA on Linux, CoreAudio on macOS.

By creating this pull request, I understand that code that is AI generated or otherwise automatically generated may be rejected without further discussion.
I declare that I fully understand all code I pushed into this PR, and wrote all this code myself and own the rights to this code.

Note: Claude was used as a code review and documentation aid. All code was written, tested, and validated by me.

- Add VoiceChat class with PortAudio capture (20ms Opus frames), stereo playback with equal-power panning, jitter buffer, distance attenuation, mic gain, music injection, and device hot-swap.

- Handle 'F' subcommands in Core.cpp and route incoming voice packets to VoiceChat in GlobalHandler.cpp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant