failed loudness eq experiment
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
#include "AudioApi.h"
|
#include "AudioApi.h"
|
||||||
#include <functiondiscoverykeys.h>
|
#include <functiondiscoverykeys.h>
|
||||||
|
|
||||||
AudioDevice::AudioDevice(IMMDevice* device, LPCWSTR deviceId)
|
AudioDevice::AudioDevice(IMMDevice* device, LPCWSTR deviceId) : device(device)
|
||||||
{
|
{
|
||||||
id = std::wstring(deviceId);
|
id = std::wstring(deviceId);
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
// see https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7Samples/winui/shell/appshellintegration/NotificationIcon/NotificationIcon.cpp
|
// see https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7Samples/winui/shell/appshellintegration/NotificationIcon/NotificationIcon.cpp
|
||||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
#pragma comment(lib, "comctl32.lib")
|
#pragma comment(lib, "comctl32.lib")
|
||||||
|
#pragma comment(lib, "rpcrt4.lib")
|
||||||
|
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "AudioApi.h"
|
#include "AudioApi.h"
|
||||||
@@ -214,6 +215,7 @@ ImVec2 audioDeviceWindow(ApplicationData& appData, std::vector<AudioDevice>& dev
|
|||||||
ImGui::TableSetupColumn("Devices", ImGuiTableColumnFlags_WidthStretch, 3.);
|
ImGui::TableSetupColumn("Devices", ImGuiTableColumnFlags_WidthStretch, 3.);
|
||||||
ImGui::TableSetupColumn("Volume", ImGuiTableColumnFlags_WidthStretch, 1.);
|
ImGui::TableSetupColumn("Volume", ImGuiTableColumnFlags_WidthStretch, 1.);
|
||||||
ImGui::TableSetupColumn("Defaults", ImGuiTableColumnFlags_WidthFixed, 55.);
|
ImGui::TableSetupColumn("Defaults", ImGuiTableColumnFlags_WidthFixed, 55.);
|
||||||
|
//ImGui::TableSetupColumn("Proc", ImGuiTableColumnFlags_WidthFixed, 30.);
|
||||||
ImGui::TableHeadersRow();
|
ImGui::TableHeadersRow();
|
||||||
|
|
||||||
for (auto& dev : deviceList)
|
for (auto& dev : deviceList)
|
||||||
@@ -324,6 +326,21 @@ ImVec2 audioDeviceWindow(ApplicationData& appData, std::vector<AudioDevice>& dev
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Advanced
|
||||||
|
/*ImGui::TableNextColumn();
|
||||||
|
|
||||||
|
AudioProcessingState procState = getAudioProcessing(dev);
|
||||||
|
bool procChecked = procState == AudioProcessingState::Enabled;
|
||||||
|
|
||||||
|
std::string procCbId("cb_proc_");
|
||||||
|
procCbId.append(deviceIdUtf8.c_str());
|
||||||
|
ImGui::PushID(procCbId.c_str());
|
||||||
|
if (ImGui::Checkbox("", &procChecked))
|
||||||
|
{
|
||||||
|
setAudioProcessing(dev, procChecked);
|
||||||
|
}
|
||||||
|
ImGui::PopID();*/
|
||||||
|
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
|
#include "AudioApi.h"
|
||||||
|
#include "Util.h"
|
||||||
|
#include "PolicyConfig.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <functiondiscoverykeys.h>
|
#include <functiondiscoverykeys.h>
|
||||||
#include <endpointvolume.h>
|
#include <endpointvolume.h>
|
||||||
|
|
||||||
|
#include <initguid.h>
|
||||||
|
#include <mmdeviceapi.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <iostream>
|
||||||
#include "Util.h"
|
|
||||||
#include "AudioApi.h"
|
|
||||||
#include "PolicyConfig.h"
|
|
||||||
|
|
||||||
void initAudio(ApplicationData& appData)
|
void initAudio(ApplicationData& appData)
|
||||||
{
|
{
|
||||||
@@ -184,4 +187,58 @@ bool isMuted(IAudioEndpointVolume* volumeInterface)
|
|||||||
void setMuted(IAudioEndpointVolume* volumeInterface, bool newState)
|
void setMuted(IAudioEndpointVolume* volumeInterface, bool newState)
|
||||||
{
|
{
|
||||||
volumeInterface->SetMute(static_cast<BOOL>(newState), NULL);
|
volumeInterface->SetMute(static_cast<BOOL>(newState), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateLoudnessEqualizationKey(PROPERTYKEY& key)
|
||||||
|
{
|
||||||
|
// Realtek: const wchar_t* guid = L"E0A941A0-88A2-4df5-8D6B-DD20BB06E8FB";
|
||||||
|
const wchar_t* guid = L"FC52A749-4BE9-4510-896E-966BA6525980";
|
||||||
|
UuidFromString((RPC_WSTR)guid, &key.fmtid);
|
||||||
|
key.pid = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioProcessingState getAudioProcessing(AudioDevice& device)
|
||||||
|
{
|
||||||
|
return AudioProcessingState::Unknown;
|
||||||
|
|
||||||
|
LPWSTR pwstrEndpointId = NULL;
|
||||||
|
HRESULT hr = device.device->GetId(&pwstrEndpointId);
|
||||||
|
|
||||||
|
IPolicyConfig* pPolicyConfig;
|
||||||
|
hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_ALL, IID_PPV_ARGS(&pPolicyConfig));
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
PROPVARIANT var;
|
||||||
|
PropVariantInit(&var);
|
||||||
|
|
||||||
|
PROPERTYKEY key{};
|
||||||
|
CreateLoudnessEqualizationKey(key);
|
||||||
|
|
||||||
|
hr = pPolicyConfig->GetPropertyValue(pwstrEndpointId, TRUE, key, &var);
|
||||||
|
pPolicyConfig->Release();
|
||||||
|
return var.boolVal ? AudioProcessingState::Disabled : AudioProcessingState::Enabled;
|
||||||
|
}
|
||||||
|
return AudioProcessingState::Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAudioProcessing(AudioDevice& device, bool newVal)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
|
||||||
|
LPWSTR pwstrEndpointId = NULL;
|
||||||
|
HRESULT hr = device.device->GetId(&pwstrEndpointId);
|
||||||
|
|
||||||
|
IPolicyConfig* pPolicyConfig;
|
||||||
|
hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_ALL, IID_PPV_ARGS(&pPolicyConfig));
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
PROPVARIANT var;
|
||||||
|
PropVariantInit(&var);
|
||||||
|
var.vt = VT_UI4;
|
||||||
|
var.uintVal = newVal ? ENDPOINT_SYSFX_ENABLED : ENDPOINT_SYSFX_DISABLED;
|
||||||
|
PROPERTYKEY key{};
|
||||||
|
CreateLoudnessEqualizationKey(key);
|
||||||
|
hr = pPolicyConfig->SetPropertyValue(pwstrEndpointId, TRUE, key, &var);
|
||||||
|
pPolicyConfig->Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <mmdeviceapi.h>
|
|
||||||
|
|
||||||
#include "ApplicationData.h"
|
#include "ApplicationData.h"
|
||||||
|
|
||||||
|
enum class AudioProcessingState
|
||||||
|
{
|
||||||
|
Enabled,
|
||||||
|
Disabled,
|
||||||
|
Unknown
|
||||||
|
};
|
||||||
|
|
||||||
void initAudio(ApplicationData& appData);
|
void initAudio(ApplicationData& appData);
|
||||||
void loadAudioDevices(AudioData& audioData, std::vector<AudioDevice>& deviceList, EDataFlow deviceType);
|
void loadAudioDevices(AudioData& audioData, std::vector<AudioDevice>& deviceList, EDataFlow deviceType);
|
||||||
void reloadDeviceLists(AudioData& audioData);
|
void reloadDeviceLists(AudioData& audioData);
|
||||||
@@ -17,4 +22,6 @@ void setVolume(IAudioEndpointVolume* volumeInterface, float newVolume);
|
|||||||
UINT getMeterValues(IAudioMeterInformation* meterInterface, std::array<float, 2>& levels);
|
UINT getMeterValues(IAudioMeterInformation* meterInterface, std::array<float, 2>& levels);
|
||||||
void getVolumeLimit(IAudioEndpointVolume* volumeInterface, float* outMin, float* outMax);
|
void getVolumeLimit(IAudioEndpointVolume* volumeInterface, float* outMin, float* outMax);
|
||||||
bool isMuted(IAudioEndpointVolume* volumeInterface);
|
bool isMuted(IAudioEndpointVolume* volumeInterface);
|
||||||
void setMuted(IAudioEndpointVolume* volumeInterface, bool newState);
|
void setMuted(IAudioEndpointVolume* volumeInterface, bool newState);
|
||||||
|
AudioProcessingState getAudioProcessing(AudioDevice& device);
|
||||||
|
void setAudioProcessing(AudioDevice& device, bool newVal);
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <initguid.h>
|
||||||
#include <mmdeviceapi.h>
|
#include <mmdeviceapi.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class AudioData;
|
class AudioData;
|
||||||
class ApplicationData;
|
class ApplicationData;
|
||||||
class AudioNotificationListener : public IMMNotificationClient {
|
class AudioNotificationListener : public IMMNotificationClient {
|
||||||
|
|||||||
@@ -115,6 +115,9 @@ public:
|
|||||||
PCWSTR,
|
PCWSTR,
|
||||||
INT
|
INT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE GetPropertyValue(PCWSTR pszDeviceName, BOOL bFxStore, const PROPERTYKEY& pKey, PROPVARIANT* pv) = 0;
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE SetPropertyValue(PCWSTR pszDeviceName, BOOL bFxStore, const PROPERTYKEY& pKey, PROPVARIANT* pv) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface DECLSPEC_UUID("568b9108-44bf-40b4-9006-86afe5b5a620") IPolicyConfigVista;
|
interface DECLSPEC_UUID("568b9108-44bf-40b4-9006-86afe5b5a620") IPolicyConfigVista;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ImguiBase.h"
|
|
||||||
#include <imgui_internal.h>
|
|
||||||
|
|
||||||
#include "ApplicationData.h"
|
#include "ApplicationData.h"
|
||||||
|
#include "ImguiBase.h"
|
||||||
|
|
||||||
|
#include <imgui_internal.h>
|
||||||
|
|
||||||
void initSettings(DrawData& drawData, ApplicationData& appData);
|
void initSettings(DrawData& drawData, ApplicationData& appData);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
bool isError(const HRESULT result, const std::stringstream message);
|
bool isError(const HRESULT result, const std::stringstream message);
|
||||||
|
|||||||
Reference in New Issue
Block a user