Added: Support for having individual configurations for multiple devices. This is possible via the new command "Device" that allows to select the output devices to which the following commands (filters etc.) should be applied. The Configurator got a new button to generate a Device command for the selected connection(s).
This commit is contained in:
1 parent
7758366b58
commit
ef61580c19
17 files changed
+290
-92
No files matched your search
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
This file is part of EqualizerAPO, a system-wide equalizer.
|
||||
Copyright (C) 2012 Jonas Thedering
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "DeviceAPOInfo.h"
|
||||
|
||||
#include "EqualizerAPO.h"
|
||||
#include "ParametricEQ.h"
|
||||
#include "StringHelper.h"
|
||||
#include "RegistryHelper.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define renderKeyPath L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\MMDevices\\Audio\\Render"
|
||||
static const wchar_t* connectionValueName = L"{a45c254e-df1c-4efd-8020-67d146a850e0},2";
|
||||
static const wchar_t* deviceValueName = L"{b3f8fa53-0004-438e-9003-51a46e139bfc},6";
|
||||
static const wchar_t* apoGuidValueName = L"{d04e05a6-594b-4fb6-a80d-01af5eed7d1d},1";
|
||||
|
||||
vector<DeviceAPOInfo> DeviceAPOInfo::loadAllInfos()
|
||||
{
|
||||
vector<DeviceAPOInfo> result;
|
||||
vector<wstring> deviceGuidStrings = RegistryHelper::enumSubKeys(renderKeyPath);
|
||||
for(vector<wstring>::iterator it = deviceGuidStrings.begin(); it != deviceGuidStrings.end(); it++)
|
||||
{
|
||||
wstring deviceGuidString = *it;
|
||||
|
||||
DeviceAPOInfo info;
|
||||
if(info.load(deviceGuidString))
|
||||
result.push_back(info);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool DeviceAPOInfo::load(const wstring& deviceGuid)
|
||||
{
|
||||
if(!RegistryHelper::keyExists(renderKeyPath L"\\" + deviceGuid + L"\\FxProperties"))
|
||||
return false;
|
||||
|
||||
this->deviceGuid = deviceGuid;
|
||||
connectionName = RegistryHelper::readValue(renderKeyPath L"\\" + deviceGuid + L"\\Properties", connectionValueName);
|
||||
deviceName = RegistryHelper::readValue(renderKeyPath L"\\" + deviceGuid + L"\\Properties", deviceValueName);
|
||||
originalApoGuid = RegistryHelper::readValue(renderKeyPath L"\\" + deviceGuid + L"\\FxProperties", apoGuidValueName);
|
||||
|
||||
GUID apoGuid;
|
||||
if(!SUCCEEDED(CLSIDFromString(originalApoGuid.c_str(), &apoGuid)))
|
||||
return false;
|
||||
|
||||
isInstalled = false;
|
||||
if(apoGuid == __uuidof(EqualizerAPO))
|
||||
isInstalled = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeviceAPOInfo::install()
|
||||
{
|
||||
RegistryHelper::createKey(APP_REGPATH L"\\Child APOs");
|
||||
|
||||
RegistryHelper::writeValue(APP_REGPATH L"\\Child APOs", deviceGuid, originalApoGuid);
|
||||
|
||||
RegistryHelper::saveToFile(renderKeyPath L"\\" + deviceGuid + L"\\FxProperties", apoGuidValueName,
|
||||
L"backup_" + StringHelper::replaceIllegalCharacters(deviceName) + L"_" + StringHelper::replaceIllegalCharacters(connectionName) + L".reg");
|
||||
|
||||
RegistryHelper::writeValue(renderKeyPath L"\\" + deviceGuid + L"\\FxProperties", apoGuidValueName, RegistryHelper::getGuidString(__uuidof(EqualizerAPO)));
|
||||
}
|
||||
|
||||
void DeviceAPOInfo::uninstall()
|
||||
{
|
||||
wstring originalChildApoGuid = RegistryHelper::readValue(APP_REGPATH L"\\Child APOs", deviceGuid);
|
||||
|
||||
RegistryHelper::writeValue(renderKeyPath L"\\" + deviceGuid + L"\\FxProperties", apoGuidValueName, originalChildApoGuid);
|
||||
|
||||
RegistryHelper::deleteValue(APP_REGPATH L"\\Child APOs", deviceGuid);
|
||||
|
||||
if(RegistryHelper::valueCount(APP_REGPATH L"\\Child APOs") == 0)
|
||||
RegistryHelper::deleteKey(APP_REGPATH L"\\Child APOs");
|
||||
}
|
||||
Reference in new issue
Block a user