RealtimeStyleTransferRuntime/Source/LyraGame/Settings/CustomSettings/LyraSettingValueDiscreteDyn...

54 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "AudioMixer.h"
#include "AudioMixerBlueprintLibrary.h"
#include "GameSettingValueDiscreteDynamic.h"
#include "LyraSettingValueDiscreteDynamic_AudioOutputDevice.generated.h"
enum class EAudioDeviceChangedRole : uint8;
UCLASS()
class ULyraSettingValueDiscreteDynamic_AudioOutputDevice : public UGameSettingValueDiscreteDynamic
{
GENERATED_BODY()
public:
virtual ~ULyraSettingValueDiscreteDynamic_AudioOutputDevice() = default;
/** UGameSettingValueDiscrete */
virtual void SetDiscreteOptionByIndex(int32 Index) override;
protected:
virtual void OnInitialized() override;
public:
UFUNCTION()
void OnAudioOutputDevicesObtained(const TArray<FAudioOutputDeviceInfo>& AvailableDevices);
UFUNCTION()
void OnCompletedDeviceSwap(const FSwapAudioOutputResult& SwapResult);
UFUNCTION()
void DeviceAddedOrRemoved(FString DeviceId);
UFUNCTION()
void DefaultDeviceChanged(EAudioDeviceChangedRole InRole, FString DeviceId);
protected:
TArray<FAudioOutputDeviceInfo> OutputDevices;
FString CurrentDeviceId;
FString SystemDefaultDeviceId;
int32 LastKnownGoodIndex = 0;
bool bRequestDefault = false;
FOnAudioOutputDevicesObtained DevicesObtainedCallback;
FOnCompletedDeviceSwap DevicesSwappedCallback;
};