FNetAudioEventRelay
Carries replicated audio events over the RPC channel. On the server it takes a client's ServerRequestAudioEvent after the replication layer has accepted it (the client-callable flag, the owner check and the packet rate limit), runs it through the audio event gate, and sends what passes to every other peer within earshot. On a client it plays what the server sent, picking the variant from the event's seed so all peers hear the same take.
- Module
- Game
- Header
#include "Game/NetAudioEventRelay.h"- Namespace
Mowo
Type aliases
| Alias | Description |
|---|---|
using FSendFn = std::function<void(uint32_t peerId, uint16_t methodIndex, const std::vector<uint8_t>& args)> | |
using FPositionFn = std::function<bool(uint32_t peerId, Vec3& out)> | |
using FPlayFn = std::function<void(const FNetAudioEvent& event, const std::string& clip)> |
Constructors
| Signature | Name | Description |
|---|---|---|
~FNetAudioEventRelay() | ~FNetAudioEventRelay |
Public functions
| Returns | Name | Description |
|---|---|---|
bool | Install | |
void | Remove | |
void | SetPositionProvider | Where a peer's pawn is, for the claim-distance check (sender) and for relevancy (listener). |
void | SetSender | Replaces the default send through the replication manager. |
void | SetPlayer | Replaces the default one-shot through the audio engine. |
bool | Request | Client: ask the server to play an event at its position, on nid. |
void | PlayPayload | The client half: decodes a MulticastPlayAudioEvent payload and plays the variant its seed names. |
const FStats& | GetStats |
Function details
~FNetAudioEventRelay
~FNetAudioEventRelay()Install
bool Install(ReplicationManager& rm, FNetAudioEventGate& gate)Remove
void Remove()SetPositionProvider
void SetPositionProvider(FPositionFn provider)Where a peer's pawn is, for the claim-distance check (sender) and for relevancy (listener). A peer with no position is not sent events.
SetSender
void SetSender(FSendFn send)Replaces the default send through the replication manager.
SetPlayer
void SetPlayer(FPlayFn play)Replaces the default one-shot through the audio engine.
Request
bool Request(NetworkId nid, const FNetAudioEvent& event)Client: ask the server to play an event at its position, on nid.
PlayPayload
void PlayPayload(const uint8_t* args, size_t argLen)The client half: decodes a MulticastPlayAudioEvent payload and plays the variant its seed names. Also what an arriving RPC runs.
GetStats
const FStats& GetStats() const