FVoiceFragmentBuffer
FVoiceFragmentBuffer — short clips of what other players actually said, for a creature that answers in their voices. It keeps utterances, not a stream: a run of voiced frames becomes one fragment when the talker pauses, a run too short to be a word is thrown away, and each player keeps only their last few.
- Module
- VoiceChat
- Header
#include "VoiceChat/FVoiceFragmentBuffer.h"- Namespace
Mowo
What it promises, because this is the one place voice is kept at all: - memory only: nothing here writes, logs or uploads a sample; - only from a talker whose own client stamped consent on the frame — a frame without it drops everything held for that talker at once; - never from a muted talker, and never while the listener is deafened (FVoiceChatSystem gates both before a frame gets here); - gone with the session: Shutdown, a peer leaving and a mute all forget.
Properties
| Type | Name | Description |
|---|---|---|
static constexpr float | kVoicedRms | A frame quieter than this RMS (of full scale) counts as a pause. Default 0.01f. |
Public functions
| Returns | Name | Description |
|---|---|---|
void | Configure | |
void | PushFrame | One playout frame of a talker. |
void | ForgetPeer | |
void | Clear | |
uint32_t | GetFragmentCount | |
uint32_t | GetTotalFragmentCount | |
uint64_t | GetHeldSamples | |
bool | TakeNewestFragment | Hands the newest finished fragment over and removes it, so the same clip is not replayed until the talker says something new. |
uint32_t | GetSampleRate |
Function details
Configure
void Configure(uint32_t sampleRate, float minFragmentSeconds = 0.4f, float maxFragmentSeconds = 3.0f, uint32_t maxFragmentsPerPeer = 6)PushFrame
void PushFrame(uint32_t peerId, const int16_t* samples, uint32_t count, bool realFrame)One playout frame of a talker. realFrame is false for concealment and silence the jitter buffer made up; those end an utterance.
ForgetPeer
void ForgetPeer(uint32_t peerId)Clear
void Clear()GetFragmentCount
uint32_t GetFragmentCount(uint32_t peerId) constGetTotalFragmentCount
uint32_t GetTotalFragmentCount() constGetHeldSamples
uint64_t GetHeldSamples() constTakeNewestFragment
bool TakeNewestFragment(uint32_t peerId, std::vector<int16_t>& out)Hands the newest finished fragment over and removes it, so the same clip is not replayed until the talker says something new.
GetSampleRate
uint32_t GetSampleRate() const