Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "CoreMinimal.h"
- #include "Net/VoiceConfig.h"
- #include "MiVOIPTalker.generated.h"
- class APlayerController;
- class APlayerState;
- /** Determines how player voice is broadcast to other players */
- UENUM(BlueprintType)
- enum class EMiVoiceChatMode : uint8
- {
- PushToTalk,
- OpenMic,
- };
- /**
- * Voice Over IP talker component with enhanced functionality:
- *
- * - Defaults to a source effect chain with a preset that increases received voice sample amplitudes
- * to work around the issue of other players sounding quiet
- * - Uses the gameplay message system to broadcast start and stop talking events
- * - Updates push-to-talk and mic volume on player setting changes
- */
- UCLASS()
- class UMiVOIPTalker : public UVOIPTalker
- {
- GENERATED_BODY()
- public:
- UMiVOIPTalker(const FObjectInitializer& ObjectInitializer);
- //~ Begin UActorComponent
- virtual void BeginPlay() override;
- virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
- //~ End UActorComponent
- //~ Begin UVOIPTalker
- virtual void OnTalkingBegin(UAudioComponent* AudioComponent) override;
- virtual void OnTalkingEnd() override;
- //~ End UVOIPTalker
- protected:
- void BindEvents();
- void UnbindEvents();
- void HandleLocalPlayerTalkingStateChanged(FUniqueNetIdRef TalkerId, bool bIsTalking);
- void HandleLocalGameSettingsChanged();
- void OnLocalTalkingBegin();
- void OnLocalTalkingEnd();
- void UpdateLocalPlayerForPushToTalk();
- void UpdateLocalPlayerMicSettings();
- /** Returns the player controller for this talker, or null if none or the controller is not on this game instance */
- APlayerController* GetPlayerController() const;
- /** Returns the player state for this talker, or null if it could not be determined */
- APlayerState* GetPlayerState() const;
- float DefaultMicNoiseGateThreshold = 0.01f;
- float DefaultSilenceDetectionThreshold = 0.01f;
- FDelegateHandle LocalPlayerTalkingStateChangedDelegateHandle;
- FDelegateHandle LocalGameSettingsChangedDelegateHandle;
- };
Advertisement
Add Comment
Please, Sign In to add comment