#pragma once

#include "ApplicationData.h"

enum class AudioProcessingState
{
	Enabled,
	Disabled,
	Unknown
};

void initAudio(ApplicationData& appData);
void loadAudioDevices(AudioData& audioData, std::vector<AudioDevice>& deviceList, EDataFlow deviceType);
void reloadDeviceLists(AudioData& audioData);

HRESULT getDeviceProperty(IPropertyStore* propertyStore, const PROPERTYKEY propertyKey, PROPVARIANT* outData);
HRESULT getDevicePropertyString(IPropertyStore* propertyStore, const PROPERTYKEY propertyKey, PROPVARIANT* outData, const wchar_t*& outString, const wchar_t* defaultStr = L"Unknown");
void setDefaultAudioDevice(AudioData& audioData, const wchar_t* deviceId, ERole role);

float getVolume(IAudioEndpointVolume* volumeInterface);
void setVolume(IAudioEndpointVolume* volumeInterface, float newVolume);
UINT getMeterValues(IAudioMeterInformation* meterInterface, std::array<float, 2>& levels);
void getVolumeLimit(IAudioEndpointVolume* volumeInterface, float* outMin, float* outMax);
bool isMuted(IAudioEndpointVolume* volumeInterface);
void setMuted(IAudioEndpointVolume* volumeInterface, bool newState);
AudioProcessingState getAudioProcessing(AudioDevice& device);
void setAudioProcessing(AudioDevice& device, bool newVal);
