Version 0.9.2

Added: New troubleshooting options have been added to the Configurator that can be tried in case of problems.
Improved: E-APO is now normally always installed as LFX/GFX, also in Windows 8.1 and later, to avoid problems with some applications bypassing SFX/MFX APOs (e.g. Skype).
Fixed: If the input channel count was higher than the output channel count and there was no child APO, Equalizer APO could crash during initialization.
Fixed: If a file in the config path was only renamed (not modified), the configuration was not reloaded.
This commit is contained in:
jthedering committed 2015-04-14 18:44:29 +00:00
1 parent 3d234120f6
commit d81193521b
18 files changed
+708 -298

No files matched your search

+1 -1
View File
@@ -163,7 +163,7 @@ int main(int argc, char** argv)
timer.start();
FilterEngine engine;
engine.setDeviceInfo(false, StringHelper::toWString(devicenameArg.getValue(), CP_ACP),
engine.setDeviceInfo(false, true, StringHelper::toWString(devicenameArg.getValue(), CP_ACP),
StringHelper::toWString(connectionnameArg.getValue(), CP_ACP),
StringHelper::toWString(guidArg.getValue(), CP_ACP));
engine.initialize((float)sampleRate, channelCount, channelCount, channelCount, channelMask, batchsize);
+284 -84
View File
@@ -19,6 +19,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include "helpers/StringHelper.h"
#include "helpers/RegistryHelper.h"
@@ -45,6 +46,17 @@ void Configurator::onInitDialog(HWND hDlg)
cancelButton = GetDlgItem(hDlg, IDCANCEL);
requestLabel = GetDlgItem(hDlg, IDC_REQUEST);
copyDeviceCommandButton = GetDlgItem(hDlg, IDC_COPY_DEVICE_COMMAND);
toggleTroubleShooting = GetDlgItem(hDlg, IDC_TOGGLE_TROUBLESHOOTING);
troubleShootingGroup = GetDlgItem(hDlg, IDC_TROUBLESHOOTING_GROUP);
preMixLabel = GetDlgItem(hDlg, IDC_PRE_MIX_LABEL);
postMixLabel = GetDlgItem(hDlg, IDC_POST_MIX_LABEL);
installPreMix = GetDlgItem(hDlg, IDC_INSTALL_PRE_MIX);
installPostMix = GetDlgItem(hDlg, IDC_INSTALL_POST_MIX);
useOriginalAPOPreMix = GetDlgItem(hDlg, IDC_USE_ORIGINAL_APO_PRE_MIX);
useOriginalAPOPostMix = GetDlgItem(hDlg, IDC_USE_ORIGINAL_APO_POST_MIX);
installModeComboBox = GetDlgItem(hDlg, IDC_INSTALL_MODE_COMBOBOX);
expandTroubleShooting(false);
wchar_t stringBuf[255];
@@ -70,6 +82,42 @@ void Configurator::onInitDialog(HWND hDlg)
LoadStringW(hInstance, IDS_CANCEL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
SetWindowTextW(cancelButton, stringBuf);
LoadStringW(hInstance, IDS_TOGGLE_TROUBLESHOOTING, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
SetWindowTextW(toggleTroubleShooting, stringBuf);
int width = 185;
if(wcsncmp(stringBuf, L"Probleml", 8) == 0)
width = 215;
RECT rect = {0, 0, width, 10};
MapDialogRect(hDlg, &rect);
SetWindowPos(toggleTroubleShooting, NULL, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
LoadStringW(hInstance, IDS_PRE_MIX_LABEL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
SetWindowTextW(preMixLabel, stringBuf);
LoadStringW(hInstance, IDS_POST_MIX_LABEL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
SetWindowTextW(postMixLabel, stringBuf);
LoadStringW(hInstance, IDS_INSTALL_APO, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
SetWindowTextW(installPreMix, stringBuf);
SetWindowTextW(installPostMix, stringBuf);
LoadStringW(hInstance, IDS_USE_ORIGINAL_APO, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
SetWindowTextW(useOriginalAPOPreMix, stringBuf);
SetWindowTextW(useOriginalAPOPostMix, stringBuf);
LoadStringW(hInstance, IDS_INSTALL_MODE_LFX_GFX, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
ComboBox_AddString(installModeComboBox, stringBuf);
if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
{
LoadStringW(hInstance, IDS_INSTALL_MODE_SFX_MFX, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
ComboBox_AddString(installModeComboBox, stringBuf);
LoadStringW(hInstance, IDS_INSTALL_MODE_SFX_EFX, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
ComboBox_AddString(installModeComboBox, stringBuf);
}
ComboBox_SetCurSel(installModeComboBox, 0);
for(int i=0; i<=1; i++)
{
HWND deviceList = deviceLists[i];
@@ -143,112 +191,147 @@ void Configurator::onInitDialog(HWND hDlg)
void Configurator::onLvnItemChanged(unsigned sourceId, LPNMLISTVIEW info)
{
int index = (sourceId == IDC_PLAYBACK_LIST ? 0 : 1);
HWND deviceList = deviceLists[index];
int itemCount = ListView_GetItemCount(deviceList);
if(apoInfos[index].size() == itemCount)
{
DeviceAPOInfo apoInfo = apoInfos[index][info->lParam];
bool checked = ListView_GetCheckState(deviceList,info->iItem) != 0;
wchar_t stringBuf[255];
if(checked && !apoInfo.isInstalled)
LoadStringW(hInstance, IDS_WILL_BE_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(!checked && apoInfo.isInstalled)
LoadStringW(hInstance, IDS_WILL_BE_UNINSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isInstalled && apoInfo.canBeUpgraded())
LoadStringW(hInstance, IDS_WILL_BE_UPGRADED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isInstalled)
LoadStringW(hInstance, IDS_ALREADY_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isExperimental())
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED_EXPERIMENTAL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
ListView_SetItemText(deviceList, info->iItem, 2, stringBuf);
EnableWindow(okButton, isChanged());
EnableWindow(copyDeviceCommandButton, ListView_GetSelectedCount(deviceList) > 0);
}
updateList(index, info->iItem);
updateButtons(index);
}
bool Configurator::onButtonClicked(unsigned sourceId)
{
if(sourceId == IDOK)
switch(sourceId)
{
for(int index = 0; index <= 1; index++)
case IDOK:
{
for(int index = 0; index <= 1; index++)
{
HWND deviceList = deviceLists[index];
for(int i = 0; i < ListView_GetItemCount(deviceList); i++)
{
LVITEM item;
item.iItem = i;
item.iSubItem = 0;
item.mask = LVIF_PARAM;
ListView_GetItem(deviceList, &item);
try
{
DeviceAPOInfo info = apoInfos[index][item.lParam];
if(ListView_GetCheckState(deviceList, i) && !info.isInstalled)
info.install();
else if(!ListView_GetCheckState(deviceList, i) && info.isInstalled)
info.uninstall();
else if(ListView_GetCheckState(deviceList, i) && (info.canBeUpgraded() || info.hasChanges()))
{
info.uninstall();
info.load(info.deviceGuid);
info.install();
}
}
catch(RegistryException e)
{
MessageBoxW(hDlg, e.getMessage().c_str(), L"Error while accessing the registry", MB_ICONERROR | MB_OK);
}
}
}
}
break;
case IDC_COPY_DEVICE_COMMAND:
{
wstring command = L"Device: ";
int index = TabCtrl_GetCurSel(categoryTabCtrl);
HWND deviceList = deviceLists[index];
bool first = true;
for(int i = 0; i < ListView_GetItemCount(deviceList); i++)
{
LVITEM item;
item.iItem = i;
item.iSubItem = 0;
item.mask = LVIF_PARAM;
item.mask = LVIF_PARAM | LVIF_STATE;
item.stateMask = LVIS_SELECTED;
ListView_GetItem(deviceList, &item);
try
if(item.state & LVIS_SELECTED)
{
if(first)
first = false;
else
command += L"; ";
DeviceAPOInfo info = apoInfos[index][item.lParam];
if(ListView_GetCheckState(deviceList, i) && !info.isInstalled)
info.install();
else if(!ListView_GetCheckState(deviceList, i) && info.isInstalled)
info.uninstall();
else if(ListView_GetCheckState(deviceList, i) && info.canBeUpgraded())
{
info.uninstall();
info.load(info.deviceGuid);
info.install();
}
}
catch(RegistryException e)
{
MessageBoxW(hDlg, e.getMessage().c_str(), L"Error while accessing the registry", MB_ICONERROR | MB_OK);
command += StringHelper::replaceCharacters(info.deviceName + L" " + info.connectionName + L" " + info.deviceGuid, L";", L" ");
}
}
OpenClipboard(hDlg);
HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (command.length() + 1) * sizeof(wchar_t));
wchar_t* data = (wchar_t*)GlobalLock(hData);
memcpy(data, command.c_str(), (command.length() + 1) * sizeof(wchar_t));
GlobalUnlock(data);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
}
}
else if(sourceId == IDC_COPY_DEVICE_COMMAND)
{
wstring command = L"Device: ";
int index = TabCtrl_GetCurSel(categoryTabCtrl);
HWND deviceList = deviceLists[index];
bool first = true;
for(int i = 0; i < ListView_GetItemCount(deviceList); i++)
break;
case IDC_TOGGLE_TROUBLESHOOTING:
{
LVITEM item;
item.iItem = i;
item.iSubItem = 0;
item.mask = LVIF_PARAM | LVIF_STATE;
item.stateMask = LVIS_SELECTED;
ListView_GetItem(deviceList, &item);
if(item.state & LVIS_SELECTED)
{
if(first)
first = false;
else
command += L"; ";
DeviceAPOInfo info = apoInfos[index][item.lParam];
command += StringHelper::replaceCharacters(info.deviceName + L" " + info.connectionName + L" " + info.deviceGuid, L";", L" ");
}
bool checked = IsDlgButtonChecked(hDlg, IDC_TOGGLE_TROUBLESHOOTING) == BST_CHECKED;
expandTroubleShooting(checked);
}
break;
case IDC_INSTALL_PRE_MIX:
case IDC_INSTALL_POST_MIX:
case IDC_USE_ORIGINAL_APO_PRE_MIX:
case IDC_USE_ORIGINAL_APO_POST_MIX:
case IDC_INSTALL_MODE_COMBOBOX:
{
int index = TabCtrl_GetCurSel(categoryTabCtrl);
HWND deviceList = deviceLists[index];
OpenClipboard(hDlg);
unsigned selectedCount = ListView_GetSelectedCount(deviceList);
for(int i = 0; i < ListView_GetItemCount(deviceList); i++)
{
LVITEM item;
item.iItem = i;
item.iSubItem = 0;
item.mask = LVIF_PARAM | LVIF_STATE;
item.stateMask = LVIS_SELECTED;
ListView_GetItem(deviceList, &item);
HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (command.length() + 1) * sizeof(wchar_t));
wchar_t* data = (wchar_t*)GlobalLock(hData);
memcpy(data, command.c_str(), (command.length() + 1) * sizeof(wchar_t));
GlobalUnlock(data);
if(item.state & LVIS_SELECTED)
{
DeviceAPOInfo& info = apoInfos[index][item.lParam];
SetClipboardData(CF_UNICODETEXT, hData);
switch(sourceId)
{
case IDC_INSTALL_PRE_MIX:
info.selectedInstallState.installPreMix = Button_GetCheck(installPreMix) == BST_CHECKED;
break;
case IDC_INSTALL_POST_MIX:
info.selectedInstallState.installPostMix = Button_GetCheck(installPostMix) == BST_CHECKED;
break;
case IDC_USE_ORIGINAL_APO_PRE_MIX:
info.selectedInstallState.useOriginalAPOPreMix = Button_GetCheck(useOriginalAPOPreMix) == BST_CHECKED;
break;
case IDC_USE_ORIGINAL_APO_POST_MIX:
info.selectedInstallState.useOriginalAPOPostMix = Button_GetCheck(useOriginalAPOPostMix) == BST_CHECKED;
break;
case IDC_INSTALL_MODE_COMBOBOX:
info.selectedInstallState.installMode = (DeviceAPOInfo::InstallMode)ComboBox_GetCurSel(installModeComboBox);
break;
}
CloseClipboard();
updateList(index, i);
}
}
updateButtons(index);
}
break;
}
if(sourceId == IDCANCEL && hasUpgrades())
@@ -310,9 +393,9 @@ void Configurator::onTcnSelChange(unsigned sourceId)
ShowWindow(deviceLists[index], SW_SHOW);
ShowWindow(deviceLists[1 - index], SW_HIDE);
EnableWindow(copyDeviceCommandButton, ListView_GetSelectedCount(deviceLists[index]) > 0);
SetFocus(deviceLists[index]);
updateButtons(index);
}
bool Configurator::isChanged()
@@ -330,8 +413,9 @@ bool Configurator::isChanged()
item.iSubItem = 0;
item.mask = LVIF_PARAM;
ListView_GetItem(deviceList, &item);
if((ListView_GetCheckState(deviceList, i) != 0) != apoInfos[index][item.lParam].isInstalled
|| ListView_GetCheckState(deviceList, i) && apoInfos[index][item.lParam].isInstalled && apoInfos[index][item.lParam].canBeUpgraded())
DeviceAPOInfo apoInfo = apoInfos[index][item.lParam];
if((ListView_GetCheckState(deviceList, i) != 0) != apoInfo.isInstalled
|| ListView_GetCheckState(deviceList, i) && apoInfo.isInstalled && (apoInfo.canBeUpgraded() || apoInfo.hasChanges()))
{
changed = true;
break;
@@ -357,7 +441,8 @@ bool Configurator::hasUpgrades()
item.iSubItem = 0;
item.mask = LVIF_PARAM;
ListView_GetItem(deviceList, &item);
if(ListView_GetCheckState(deviceList, i) && apoInfos[index][item.lParam].isInstalled && apoInfos[index][item.lParam].canBeUpgraded())
DeviceAPOInfo apoInfo = apoInfos[index][item.lParam];
if(ListView_GetCheckState(deviceList, i) && apoInfo.isInstalled && apoInfo.canBeUpgraded())
{
hasUpgrades = true;
break;
@@ -368,6 +453,121 @@ bool Configurator::hasUpgrades()
return hasUpgrades;
}
void Configurator::expandTroubleShooting(bool expand)
{
int showCmd = expand ? SW_SHOW : SW_HIDE;
ShowWindow(troubleShootingGroup, showCmd);
ShowWindow(preMixLabel, showCmd);
ShowWindow(postMixLabel, showCmd);
ShowWindow(postMixLabel, showCmd);
ShowWindow(installPreMix, showCmd);
ShowWindow(installPostMix, showCmd);
ShowWindow(useOriginalAPOPreMix, showCmd);
ShowWindow(useOriginalAPOPostMix, showCmd);
ShowWindow(installModeComboBox, showCmd);
int y = expand ? 229 : 188;
HDWP hdwp = BeginDeferWindowPos(3);
hdwp = moveWindow(hdwp, copyDeviceCommandButton, 7, y);
hdwp = moveWindow(hdwp, okButton, 285, y);
hdwp = moveWindow(hdwp, cancelButton, 343, y);
EndDeferWindowPos(hdwp);
WINDOWINFO windowInfo;
GetWindowInfo(hDlg, &windowInfo);
int height = expand ? 250 : 209;
RECT rect={0, 0, 401, height};
MapDialogRect(hDlg, &rect);
AdjustWindowRect(&rect, windowInfo.dwStyle, false);
SetWindowPos(hDlg, NULL, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
}
HDWP Configurator::moveWindow(HDWP hdwp, HWND hWnd, int x, int y)
{
RECT rect={x, y, 0, 0};
MapDialogRect(hDlg, &rect);
return DeferWindowPos(hdwp, hWnd, NULL, rect.left, rect.top, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
}
void Configurator::updateList(int listIndex, int itemIndex)
{
HWND deviceList = deviceLists[listIndex];
int itemCount = ListView_GetItemCount(deviceList);
if(apoInfos[listIndex].size() == itemCount)
{
DeviceAPOInfo apoInfo = apoInfos[listIndex][itemIndex];
bool checked = ListView_GetCheckState(deviceList, itemIndex) != 0;
wchar_t stringBuf[255];
if(checked && !apoInfo.isInstalled)
LoadStringW(hInstance, IDS_WILL_BE_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(!checked && apoInfo.isInstalled)
LoadStringW(hInstance, IDS_WILL_BE_UNINSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isInstalled && apoInfo.canBeUpgraded())
LoadStringW(hInstance, IDS_WILL_BE_UPGRADED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isInstalled && apoInfo.hasChanges())
LoadStringW(hInstance, IDS_WILL_BE_CHANGED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isInstalled)
LoadStringW(hInstance, IDS_ALREADY_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isExperimental())
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED_EXPERIMENTAL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
ListView_SetItemText(deviceList, itemIndex, 2, stringBuf);
ListView_SetColumnWidth(deviceList, 2, LVSCW_AUTOSIZE);
}
}
void Configurator::updateButtons(int listIndex)
{
HWND deviceList = deviceLists[listIndex];
EnableWindow(okButton, isChanged());
unsigned selectedCount = ListView_GetSelectedCount(deviceList);
EnableWindow(copyDeviceCommandButton, selectedCount > 0);
bool enable = false;
bool isInput = false;
bool hasOriginalAPOPreMix = true;
bool hasOriginalAPOPostMix = true;
DeviceAPOInfo::InstallState installState;
if(selectedCount == 1)
{
int selectedIndex = ListView_GetNextItem(deviceList, -1, LVNI_SELECTED);
if(selectedIndex != -1)
{
enable = ListView_GetCheckState(deviceList, selectedIndex) != 0;
DeviceAPOInfo apoInfo = apoInfos[listIndex][selectedIndex];
isInput = apoInfo.isInput;
hasOriginalAPOPreMix = apoInfo.getOriginalAPOPreMix() != L"";
hasOriginalAPOPostMix = apoInfo.getOriginalAPOPostMix() != L"";
installState = apoInfo.selectedInstallState;
}
}
EnableWindow(preMixLabel, enable);
EnableWindow(postMixLabel, enable && !isInput);
EnableWindow(installPreMix, enable);
EnableWindow(installPostMix, enable && !isInput);
EnableWindow(useOriginalAPOPreMix, enable && hasOriginalAPOPreMix && installState.installPreMix);
EnableWindow(useOriginalAPOPostMix, enable && !isInput && hasOriginalAPOPostMix && installState.installPostMix);
EnableWindow(installModeComboBox, enable);
Button_SetCheck(installPreMix, installState.installPreMix);
Button_SetCheck(installPostMix, installState.installPostMix);
Button_SetCheck(useOriginalAPOPreMix, installState.useOriginalAPOPreMix && hasOriginalAPOPreMix);
Button_SetCheck(useOriginalAPOPostMix, installState.useOriginalAPOPostMix && hasOriginalAPOPostMix);
if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
ComboBox_SetCurSel(installModeComboBox, installState.installMode);
}
INT_PTR CALLBACK dlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
int APIENTRY wWinMain(HINSTANCE hInstance,
+14
View File
@@ -44,7 +44,21 @@ private:
HWND cancelButton;
HWND copyDeviceCommandButton;
HWND requestLabel;
HWND toggleTroubleShooting;
HWND troubleShootingGroup;
HWND preMixLabel;
HWND postMixLabel;
HWND installPreMix;
HWND installPostMix;
HWND useOriginalAPOPreMix;
HWND useOriginalAPOPostMix;
HWND installModeComboBox;
std::wstring cmdLine;
void expandTroubleShooting(bool expand);
HDWP moveWindow(HDWP hdwp, HWND hWnd, int x, int y);
void updateList(int listIndex, int itemIndex);
void updateButtons(int listIndex);
std::vector<DeviceAPOInfo> apoInfos[2];
};
Binary file not shown.
Binary file not shown.
+301 -153
View File
@@ -30,16 +30,33 @@ using namespace std;
#define commonKeyPath L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\MMDevices\\Audio"
#define renderKeyPath commonKeyPath L"\\Render"
#define captureKeyPath commonKeyPath L"\\Capture"
#define childApoPath APP_REGPATH L"\\Child APOs"
static const wchar_t* preMixChildGuidValueName = L"PreMixChild";
static const wchar_t* postMixChildGuidValueName = L"PostMixChild";
static const wchar_t* versionValueName = L"Version";
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* lfxGuidValueName = L"{d04e05a6-594b-4fb6-a80d-01af5eed7d1d},1";
static const wchar_t* gfxGuidValueName = L"{d04e05a6-594b-4fb6-a80d-01af5eed7d1d},2";
static const wchar_t* lfxGuidValueName2 = L"{d04e05a6-594b-4fb6-a80d-01af5eed7d1d},5";
static const wchar_t* gfxGuidValueName2 = L"{d04e05a6-594b-4fb6-a80d-01af5eed7d1d},6";
static const wchar_t* sfxGuidValueName = L"{d04e05a6-594b-4fb6-a80d-01af5eed7d1d},5";
static const wchar_t* mfxGuidValueName = L"{d04e05a6-594b-4fb6-a80d-01af5eed7d1d},6";
static const wchar_t* efxGuidValueName = L"{d04e05a6-594b-4fb6-a80d-01af5eed7d1d},7";
static const unsigned allGuidValueNameCount = 5;
static const wchar_t* allGuidValueNames[] = {lfxGuidValueName, gfxGuidValueName, sfxGuidValueName, mfxGuidValueName, efxGuidValueName};
static enum GuidValueIndices
{
LFX_INDEX = 0,
GFX_INDEX = 1,
SFX_INDEX = 2,
MFX_INDEX = 3,
EFX_INDEX = 4
};
static const wchar_t* fxTitleValueName = L"{b725f130-47ef-101a-a5f1-02608c9eebac},10";
static const wchar_t* sfxProcessingModesValueName = L"{d3993a3f-99c2-4402-b5ec-a92a0367664b},5";
static const wchar_t* mfxProcessingModesValueName = L"{d3993a3f-99c2-4402-b5ec-a92a0367664b},6";
static const wchar_t* efxProcessingModesValueName = L"{d3993a3f-99c2-4402-b5ec-a92a0367664b},7";
static const wchar_t* defaultProcessingModeValue = L"{C18E2F7E-933D-4965-B7D1-1EEF228D2AF3}";
static const wchar_t* installVersion = L"2";
vector<DeviceAPOInfo> DeviceAPOInfo::loadAllInfos(bool input)
{
@@ -51,7 +68,10 @@ vector<DeviceAPOInfo> DeviceAPOInfo::loadAllInfos(bool input)
DeviceAPOInfo info;
if(info.load(deviceGuidString))
{
info.selectedInstallState = info.currentInstallState;
result.push_back(info);
}
}
return result;
@@ -81,89 +101,126 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid)
deviceName = RegistryHelper::readValue(keyPath + L"\\Properties", deviceValueName);
isInstalled = false;
isLFX = false;
isAPO2 = false;
installAsAPO2 = false;
currentInstallState.installMode = INSTALL_LFX_GFX;
version = L"0";
preMixChildGuid = L"";
postMixChildGuid = L"";
currentInstallState.installPreMix = true;
currentInstallState.installPostMix = !isInput;
currentInstallState.useOriginalAPOPreMix = true;
currentInstallState.useOriginalAPOPostMix = !isInput;
if(!RegistryHelper::keyExists(keyPath + L"\\FxProperties"))
{
originalLfxGuid = APOGUID_NOKEY;
originalGfxGuid = APOGUID_NOKEY;
for(int i=0; i < allGuidValueNameCount; i++)
originalApoGuids[i] = APOGUID_NOKEY;
}
else
{
originalLfxGuid = APOGUID_NOVALUE;
originalGfxGuid = APOGUID_NOVALUE;
installAsAPO2 = RegistryHelper::isWindowsVersionAtLeast(6, 3) // Windows 8.1
&& (RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName2)
|| RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName2));
wstring lfxValueName;
wstring gfxValueName;
if(installAsAPO2)
for(int i=0; i < allGuidValueNameCount; i++)
{
lfxValueName = lfxGuidValueName2;
gfxValueName = gfxGuidValueName2;
}
else
{
lfxValueName = lfxGuidValueName;
gfxValueName = gfxGuidValueName;
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
originalApoGuids[i] = RegistryHelper::readValue(keyPath + L"\\FxProperties", allGuidValueNames[i]);
else
originalApoGuids[i] = APOGUID_NOVALUE;
}
bool found = false;
if(isInput)
found = tryAPOGuid(keyPath, lfxValueName, EQUALIZERAPO_LFX_GUID, true, installAsAPO2);
else
found = tryAPOGuid(keyPath, lfxValueName, EQUALIZERAPO_LFX_GUID, true, installAsAPO2) && tryAPOGuid(keyPath, gfxValueName, EQUALIZERAPO_GFX_GUID, false, installAsAPO2);
isDual = found;
if(!found)
found = tryAPOGuid(keyPath, lfxGuidValueName, EQUALIZERAPO_GFX_GUID, true, false);
if(!found)
found = tryAPOGuid(keyPath, gfxGuidValueName, EQUALIZERAPO_GFX_GUID, false, false);
if(!found)
found = tryAPOGuid(keyPath, lfxGuidValueName2, EQUALIZERAPO_GFX_GUID, true, true);
if(!found)
found = tryAPOGuid(keyPath, gfxGuidValueName2, EQUALIZERAPO_GFX_GUID, false, true);
isInstalled = found;
if(found)
bool foundAt[allGuidValueNameCount];
for(int i=0; i < allGuidValueNameCount; i++)
{
if(RegistryHelper::keyExists(APP_REGPATH L"\\Child APOs\\" + deviceGuid))
foundAt[i] = false;
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
{
if(isAPO2)
wstring apoGuidString = RegistryHelper::readValue(keyPath + L"\\FxProperties", allGuidValueNames[i]);
GUID apoGuid;
if(SUCCEEDED(CLSIDFromString(apoGuidString.c_str(), &apoGuid)))
{
originalLfxGuid = RegistryHelper::readValue(APP_REGPATH L"\\Child APOs\\" + deviceGuid, lfxGuidValueName2);
originalGfxGuid = RegistryHelper::readValue(APP_REGPATH L"\\Child APOs\\" + deviceGuid, gfxGuidValueName2);
}
else
{
originalLfxGuid = RegistryHelper::readValue(APP_REGPATH L"\\Child APOs\\" + deviceGuid, lfxGuidValueName);
originalGfxGuid = RegistryHelper::readValue(APP_REGPATH L"\\Child APOs\\" + deviceGuid, gfxGuidValueName);
}
}
else if(RegistryHelper::valueExists(APP_REGPATH L"\\Child APOs", deviceGuid))
{
if(isLFX)
{
originalLfxGuid = RegistryHelper::readValue(APP_REGPATH L"\\Child APOs", deviceGuid);
originalGfxGuid = L"";
}
else
{
originalLfxGuid = L"";
originalGfxGuid = RegistryHelper::readValue(APP_REGPATH L"\\Child APOs", deviceGuid);
if(apoGuid == EQUALIZERAPO_PRE_MIX_GUID || apoGuid == EQUALIZERAPO_POST_MIX_GUID)
{
foundAt[i] = true;
found = true;
}
}
}
}
else
if(found)
{
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxValueName))
originalLfxGuid = RegistryHelper::readValue(keyPath + L"\\FxProperties", lfxValueName);
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxValueName))
originalGfxGuid = RegistryHelper::readValue(keyPath + L"\\FxProperties", gfxValueName);
isInstalled = true;
if(RegistryHelper::keyExists(childApoPath L"\\" + deviceGuid))
{
if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, versionValueName))
{
version = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, versionValueName);
if(version != installVersion)
throw RegistryException(L"Unsupported version of APO installation detected! Please uninstall newer Equalizer APO before using this version of Configurator.");
}
else
{
version = L"1";
}
for(int i=0; i < allGuidValueNameCount; i++)
{
if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, allGuidValueNames[i]))
originalApoGuids[i] = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, allGuidValueNames[i]);
}
if(version == installVersion)
{
if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName))
preMixChildGuid = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName);
if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, postMixChildGuidValueName))
postMixChildGuid = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, postMixChildGuidValueName);
currentInstallState.installPreMix = foundAt[LFX_INDEX] || foundAt[SFX_INDEX];
currentInstallState.installPostMix = foundAt[GFX_INDEX] || foundAt[MFX_INDEX] || foundAt[EFX_INDEX];
if(preMixChildGuid == L"")
currentInstallState.useOriginalAPOPreMix = false;
if(postMixChildGuid == L"")
currentInstallState.useOriginalAPOPostMix = false;
if(foundAt[LFX_INDEX] || foundAt[GFX_INDEX])
currentInstallState.installMode = INSTALL_LFX_GFX;
else if(foundAt[EFX_INDEX])
currentInstallState.installMode = INSTALL_SFX_EFX;
else if(foundAt[SFX_INDEX] || foundAt[MFX_INDEX])
currentInstallState.installMode = INSTALL_SFX_MFX;
}
else
{
if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, lfxGuidValueName))
{
preMixChildGuid = originalApoGuids[0];
postMixChildGuid = originalApoGuids[1];
}
else
{
preMixChildGuid = originalApoGuids[2];
postMixChildGuid = originalApoGuids[3];
}
}
}
else if(RegistryHelper::valueExists(childApoPath, deviceGuid))
{
for(int i=0; i < allGuidValueNameCount; i++)
{
if(foundAt[i])
{
originalApoGuids[i] = RegistryHelper::readValue(childApoPath, deviceGuid);
if(i == LFX_INDEX || i == SFX_INDEX)
preMixChildGuid = originalApoGuids[i];
else
postMixChildGuid = originalApoGuids[i];
break;
}
}
}
}
}
@@ -172,45 +229,96 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid)
bool DeviceAPOInfo::canBeUpgraded()
{
return isInstalled && !isDual;
return isInstalled && version != installVersion;
}
bool DeviceAPOInfo::hasChanges()
{
return isInstalled && selectedInstallState != currentInstallState;
}
bool DeviceAPOInfo::isExperimental()
{
return !isInstalled && originalGfxGuid == APOGUID_NOKEY;
return !isInstalled && originalApoGuids[0] == APOGUID_NOKEY;
}
wstring DeviceAPOInfo::getOriginalAPOPreMix()
{
wstring guid;
switch(selectedInstallState.installMode)
{
case INSTALL_LFX_GFX:
guid = originalApoGuids[LFX_INDEX];
if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
{
if(originalApoGuids[LFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[GFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[SFX_INDEX];
}
break;
case INSTALL_SFX_MFX:
guid = originalApoGuids[SFX_INDEX];
if(originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[MFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[LFX_INDEX];
break;
case INSTALL_SFX_EFX:
guid = originalApoGuids[SFX_INDEX];
if(originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[EFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[LFX_INDEX];
break;
}
if(guid == APOGUID_NOKEY || guid == APOGUID_NOVALUE)
guid = L"";
return guid;
}
wstring DeviceAPOInfo::getOriginalAPOPostMix()
{
wstring guid;
switch(selectedInstallState.installMode)
{
case INSTALL_LFX_GFX:
guid = originalApoGuids[GFX_INDEX];
if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
{
if(originalApoGuids[LFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[GFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[MFX_INDEX];
}
break;
case INSTALL_SFX_MFX:
guid = originalApoGuids[MFX_INDEX];
if(originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[MFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[GFX_INDEX];
break;
case INSTALL_SFX_EFX:
guid = originalApoGuids[EFX_INDEX];
if(originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[EFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[GFX_INDEX];
break;
}
if(guid == APOGUID_NOKEY || guid == APOGUID_NOVALUE)
guid = L"";
return guid;
}
void DeviceAPOInfo::install()
{
RegistryHelper::createKey(APP_REGPATH L"\\Child APOs");
RegistryHelper::createKey(APP_REGPATH L"\\Child APOs\\" + deviceGuid);
if(!selectedInstallState.installPreMix && !selectedInstallState.installPostMix)
return;
wstring lfxValueName;
wstring gfxValueName;
if(installAsAPO2)
{
lfxValueName = lfxGuidValueName2;
gfxValueName = gfxGuidValueName2;
}
else
{
lfxValueName = lfxGuidValueName;
gfxValueName = gfxGuidValueName;
}
RegistryHelper::writeValue(APP_REGPATH L"\\Child APOs\\" + deviceGuid, lfxValueName, originalLfxGuid);
if(isInput)
RegistryHelper::writeValue(APP_REGPATH L"\\Child APOs\\" + deviceGuid, gfxValueName, L"");
else
RegistryHelper::writeValue(APP_REGPATH L"\\Child APOs\\" + deviceGuid, gfxValueName, originalGfxGuid);
RegistryHelper::createKey(childApoPath);
RegistryHelper::createKey(childApoPath L"\\" + deviceGuid);
wstring keyPath;
if(isInput)
keyPath = captureKeyPath L"\\" + deviceGuid;
else
if(!isInput)
keyPath = renderKeyPath L"\\" + deviceGuid;
else
keyPath = captureKeyPath L"\\" + deviceGuid;
if(originalGfxGuid == APOGUID_NOKEY)
if(!RegistryHelper::keyExists(keyPath + L"\\FxProperties"))
{
try
{
@@ -226,25 +334,97 @@ void DeviceAPOInfo::install()
}
RegistryHelper::writeValue(keyPath + L"\\FxProperties", fxTitleValueName, L"Equalizer APO");
RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", sfxProcessingModesValueName, defaultProcessingModeValue);
RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", mfxProcessingModesValueName, defaultProcessingModeValue);
for(int i=0; i < allGuidValueNameCount; i++)
{
RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, allGuidValueNames[i], APOGUID_NOKEY);
}
}
else
{
vector<wstring> valuenames;
if(originalLfxGuid != APOGUID_NOVALUE)
valuenames.push_back(lfxValueName);
if(!isInput && originalGfxGuid != APOGUID_NOVALUE)
valuenames.push_back(gfxValueName);
for(int i=0; i < allGuidValueNameCount; i++)
{
wstring apoGuidString = APOGUID_NOVALUE;
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
{
apoGuidString = RegistryHelper::readValue(keyPath + L"\\FxProperties", allGuidValueNames[i]);
valuenames.push_back(allGuidValueNames[i]);
}
RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, allGuidValueNames[i], apoGuidString);
}
if(!valuenames.empty())
RegistryHelper::saveToFile(keyPath + L"\\FxProperties", valuenames,
L"backup_" + StringHelper::replaceIllegalCharacters(deviceName) + L"_" + StringHelper::replaceIllegalCharacters(connectionName) + L".reg");
}
RegistryHelper::writeValue(keyPath + L"\\FxProperties", lfxValueName, RegistryHelper::getGuidString(EQUALIZERAPO_LFX_GUID));
if(!isInput)
RegistryHelper::writeValue(keyPath + L"\\FxProperties", gfxValueName, RegistryHelper::getGuidString(EQUALIZERAPO_GFX_GUID));
wstring preMixValue;
wstring postMixValue;
if(selectedInstallState.useOriginalAPOPreMix)
preMixValue = getOriginalAPOPreMix();
if(selectedInstallState.useOriginalAPOPostMix)
postMixValue = getOriginalAPOPostMix();
RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName, preMixValue);
RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, postMixChildGuidValueName, postMixValue);
RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, versionValueName, installVersion);
if(selectedInstallState.installMode == INSTALL_LFX_GFX)
{
if(selectedInstallState.installPreMix)
RegistryHelper::writeValue(keyPath + L"\\FxProperties", lfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID));
if(selectedInstallState.installPostMix && !isInput)
RegistryHelper::writeValue(keyPath + L"\\FxProperties", gfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID));
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", sfxGuidValueName);
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", mfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", mfxGuidValueName);
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", efxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", efxGuidValueName);
}
else if(selectedInstallState.installMode == INSTALL_SFX_MFX)
{
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", lfxGuidValueName);
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", gfxGuidValueName);
if(selectedInstallState.installPreMix)
{
RegistryHelper::writeValue(keyPath + L"\\FxProperties", sfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID));
if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxProcessingModesValueName))
RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", sfxProcessingModesValueName, defaultProcessingModeValue);
}
if(selectedInstallState.installPostMix && !isInput)
{
RegistryHelper::writeValue(keyPath + L"\\FxProperties", mfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID));
if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", mfxProcessingModesValueName))
RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", mfxProcessingModesValueName, defaultProcessingModeValue);
}
// don't change efx
}
else if(selectedInstallState.installMode == INSTALL_SFX_EFX)
{
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", lfxGuidValueName);
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", gfxGuidValueName);
if(selectedInstallState.installPreMix)
{
RegistryHelper::writeValue(keyPath + L"\\FxProperties", sfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID));
if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxProcessingModesValueName))
RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", sfxProcessingModesValueName, defaultProcessingModeValue);
}
// don't change mfx
if(selectedInstallState.installPostMix && !isInput)
{
RegistryHelper::writeValue(keyPath + L"\\FxProperties", efxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID));
if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", efxProcessingModesValueName))
RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", efxProcessingModesValueName, defaultProcessingModeValue);
}
}
}
void DeviceAPOInfo::uninstall()
@@ -255,64 +435,32 @@ void DeviceAPOInfo::uninstall()
else
keyPath = captureKeyPath L"\\" + deviceGuid;
if(originalLfxGuid == APOGUID_NOKEY || originalGfxGuid == APOGUID_NOKEY)
if(originalApoGuids[0] == APOGUID_NOKEY)
{
RegistryHelper::deleteKey(keyPath + L"\\FxProperties");
}
else
{
wstring lfxValueName;
wstring gfxValueName;
if(isAPO2)
for(int i=0; i < allGuidValueNameCount; i++)
{
lfxValueName = lfxGuidValueName2;
gfxValueName = gfxGuidValueName2;
}
else
{
lfxValueName = lfxGuidValueName;
gfxValueName = gfxGuidValueName;
}
if(originalLfxGuid == APOGUID_NOVALUE)
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", lfxValueName);
else if(originalLfxGuid != L"")
RegistryHelper::writeValue(keyPath + L"\\FxProperties", lfxValueName, originalLfxGuid);
if(originalGfxGuid == APOGUID_NOVALUE)
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", gfxValueName);
else if(originalGfxGuid != L"")
RegistryHelper::writeValue(keyPath + L"\\FxProperties", gfxValueName, originalGfxGuid);
}
if(RegistryHelper::valueExists(APP_REGPATH L"\\Child APOs", deviceGuid))
RegistryHelper::deleteValue(APP_REGPATH L"\\Child APOs", deviceGuid);
if(RegistryHelper::keyExists(APP_REGPATH L"\\Child APOs\\" + deviceGuid))
RegistryHelper::deleteKey(APP_REGPATH L"\\Child APOs\\" + deviceGuid);
if(RegistryHelper::keyEmpty(APP_REGPATH L"\\Child APOs"))
RegistryHelper::deleteKey(APP_REGPATH L"\\Child APOs");
}
bool DeviceAPOInfo::tryAPOGuid(const wstring& keyPath, const wstring& valueName, GUID guid, bool lfx, bool apo2)
{
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", valueName))
{
wstring apoGuidString = RegistryHelper::readValue(keyPath + L"\\FxProperties", valueName);
GUID apoGuid;
if(SUCCEEDED(CLSIDFromString(apoGuidString.c_str(), &apoGuid)))
{
if(apoGuid == guid)
if(originalApoGuids[i] == APOGUID_NOVALUE)
{
isLFX = lfx;
isAPO2 = apo2;
return true;
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", allGuidValueNames[i]);
}
else if(originalApoGuids[i] != L"")
{
RegistryHelper::writeValue(keyPath + L"\\FxProperties", allGuidValueNames[i], originalApoGuids[i]);
}
}
}
return false;
}
if(RegistryHelper::valueExists(childApoPath, deviceGuid))
RegistryHelper::deleteValue(childApoPath, deviceGuid);
if(RegistryHelper::keyExists(childApoPath L"\\" + deviceGuid))
RegistryHelper::deleteKey(childApoPath L"\\" + deviceGuid);
if(RegistryHelper::keyEmpty(childApoPath))
RegistryHelper::deleteKey(childApoPath);
}
+45 -9
View File
@@ -29,25 +29,61 @@
class DeviceAPOInfo
{
public:
enum InstallMode
{
INSTALL_LFX_GFX = 0,
INSTALL_SFX_MFX = 1,
INSTALL_SFX_EFX = 2
};
struct InstallState
{
bool installPreMix;
bool installPostMix;
bool useOriginalAPOPreMix;
bool useOriginalAPOPostMix;
InstallMode installMode;
InstallState()
{
installPreMix = false;
installPostMix = false;
useOriginalAPOPreMix = false;
useOriginalAPOPostMix = false;
installMode = INSTALL_LFX_GFX;
}
bool operator!=(InstallState& other)
{
return memcmp(this, &other, sizeof(InstallState)) != 0;
}
};
static std::vector<DeviceAPOInfo> loadAllInfos(bool input);
bool load(const std::wstring& deviceGuid);
bool canBeUpgraded();
bool hasChanges();
bool isExperimental();
std::wstring getOriginalAPOPreMix();
std::wstring getOriginalAPOPostMix();
void install();
void uninstall();
std::wstring deviceName;
std::wstring connectionName;
std::wstring deviceGuid;
std::wstring originalLfxGuid;
std::wstring originalGfxGuid;
// used for creating child APO
std::wstring preMixChildGuid;
std::wstring postMixChildGuid;
// used for uninstallation
std::wstring originalApoGuids[5];
bool isInput;
bool isInstalled;
bool isLFX;
bool isAPO2;
bool isDual;
bool installAsAPO2;
private:
bool tryAPOGuid(const std::wstring& keyPath, const std::wstring& valueName, GUID guid, bool lfx, bool apo2);
std::wstring version;
InstallState currentInstallState;
// selection in GUI
InstallState selectedInstallState;
};
+16 -16
View File
@@ -48,7 +48,7 @@ STDAPI DllCanUnloadNow()
STDAPI DllGetClassObject(const CLSID& clsid, const IID& iid, void** ppv)
{
if(clsid != EQUALIZERAPO_GFX_GUID && clsid != EQUALIZERAPO_LFX_GUID)
if(clsid != EQUALIZERAPO_POST_MIX_GUID && clsid != EQUALIZERAPO_PRE_MIX_GUID)
return CLASS_E_CLASSNOTAVAILABLE;
ClassFactory* factory = new ClassFactory();
@@ -66,43 +66,43 @@ STDAPI DllRegisterServer()
wchar_t filename[1024];
GetModuleFileNameW(hModule, filename, sizeof(filename)/sizeof(wchar_t));
HRESULT hr = RegisterAPO(EqualizerAPO::regGfxProperties);
HRESULT hr = RegisterAPO(EqualizerAPO::regPostMixProperties);
if(FAILED(hr))
{
UnregisterAPO(EQUALIZERAPO_GFX_GUID);
UnregisterAPO(EQUALIZERAPO_POST_MIX_GUID);
return hr;
}
hr = RegisterAPO(EqualizerAPO::regLfxProperties);
hr = RegisterAPO(EqualizerAPO::regPreMixProperties);
if(FAILED(hr))
{
UnregisterAPO(EQUALIZERAPO_GFX_GUID);
UnregisterAPO(EQUALIZERAPO_LFX_GUID);
UnregisterAPO(EQUALIZERAPO_POST_MIX_GUID);
UnregisterAPO(EQUALIZERAPO_PRE_MIX_GUID);
return hr;
}
try
{
wstring apoClsidString = RegistryHelper::getGuidString(EQUALIZERAPO_GFX_GUID);
wstring apoClsidString = RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID);
RegistryHelper::createKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString);
RegistryHelper::writeValue(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString, L"", L"EqualizerAPO GFX Class");
RegistryHelper::writeValue(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString, L"", L"EqualizerAPO Post-Mix Class");
RegistryHelper::createKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32");
RegistryHelper::writeValue(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32", L"", filename);
RegistryHelper::writeValue(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32", L"ThreadingModel", L"Both");
apoClsidString = RegistryHelper::getGuidString(EQUALIZERAPO_LFX_GUID);
apoClsidString = RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID);
RegistryHelper::createKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString);
RegistryHelper::writeValue(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString, L"", L"EqualizerAPO LFX Class");
RegistryHelper::writeValue(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString, L"", L"EqualizerAPO Pre-Mix Class");
RegistryHelper::createKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32");
RegistryHelper::writeValue(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32", L"", filename);
RegistryHelper::writeValue(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32", L"ThreadingModel", L"Both");
}
catch(RegistryException e)
{
UnregisterAPO(EQUALIZERAPO_GFX_GUID);
UnregisterAPO(EQUALIZERAPO_LFX_GUID);
UnregisterAPO(EQUALIZERAPO_POST_MIX_GUID);
UnregisterAPO(EQUALIZERAPO_PRE_MIX_GUID);
return E_FAIL;
}
@@ -113,12 +113,12 @@ STDAPI DllUnregisterServer()
{
try
{
wstring apoClsidString = RegistryHelper::getGuidString(EQUALIZERAPO_GFX_GUID);
wstring apoClsidString = RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID);
RegistryHelper::deleteKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32");
RegistryHelper::deleteKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString);
apoClsidString = RegistryHelper::getGuidString(EQUALIZERAPO_LFX_GUID);
apoClsidString = RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID);
RegistryHelper::deleteKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32");
RegistryHelper::deleteKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString);
@@ -128,8 +128,8 @@ STDAPI DllUnregisterServer()
return E_FAIL;
}
HRESULT hr = UnregisterAPO(EQUALIZERAPO_GFX_GUID);
UnregisterAPO(EQUALIZERAPO_LFX_GUID);
HRESULT hr = UnregisterAPO(EQUALIZERAPO_POST_MIX_GUID);
UnregisterAPO(EQUALIZERAPO_PRE_MIX_GUID);
return hr;
}
+12 -12
View File
@@ -30,15 +30,15 @@
using namespace std;
long EqualizerAPO::instCount = 0;
const CRegAPOProperties<1> EqualizerAPO::regGfxProperties(
EQUALIZERAPO_GFX_GUID, L"EqualizerAPO", L"Copyright (C) 2014", 1, 0, __uuidof(IAudioProcessingObject),
const CRegAPOProperties<1> EqualizerAPO::regPostMixProperties(
EQUALIZERAPO_POST_MIX_GUID, L"EqualizerAPO", L"Copyright (C) 2015", 1, 0, __uuidof(IAudioProcessingObject),
(APO_FLAG)( APO_FLAG_FRAMESPERSECOND_MUST_MATCH | APO_FLAG_BITSPERSAMPLE_MUST_MATCH | APO_FLAG_INPLACE));
const CRegAPOProperties<1> EqualizerAPO::regLfxProperties(
EQUALIZERAPO_LFX_GUID, L"EqualizerAPO", L"Copyright (C) 2014", 1, 0, __uuidof(IAudioProcessingObject),
const CRegAPOProperties<1> EqualizerAPO::regPreMixProperties(
EQUALIZERAPO_PRE_MIX_GUID, L"EqualizerAPO", L"Copyright (C) 2015", 1, 0, __uuidof(IAudioProcessingObject),
(APO_FLAG)( APO_FLAG_FRAMESPERSECOND_MUST_MATCH | APO_FLAG_BITSPERSAMPLE_MUST_MATCH | APO_FLAG_INPLACE));
EqualizerAPO::EqualizerAPO(IUnknown* pUnkOuter)
:CBaseAudioProcessingObject(regGfxProperties)
:CBaseAudioProcessingObject(regPostMixProperties)
{
refCount = 1;
if(pUnkOuter != NULL)
@@ -113,7 +113,7 @@ HRESULT EqualizerAPO::Initialize(UINT32 cbDataSize, BYTE* pbyData)
{
LogF(L"Could not convert apo guid to guid string");
}
engine.setLfx((apoGuid == EQUALIZERAPO_LFX_GUID) != 0);
engine.setPreMix((apoGuid == EQUALIZERAPO_PRE_MIX_GUID) != 0);
PROPVARIANT var;
PropVariantInit(&var);
@@ -133,12 +133,12 @@ HRESULT EqualizerAPO::Initialize(UINT32 cbDataSize, BYTE* pbyData)
DeviceAPOInfo apoInfo;
if(apoInfo.load(deviceGuid))
{
engine.setDeviceInfo(apoInfo.isInput, apoInfo.deviceName, apoInfo.connectionName, apoInfo.deviceGuid);
engine.setDeviceInfo(apoInfo.isInput, apoInfo.currentInstallState.installPostMix, apoInfo.deviceName, apoInfo.connectionName, apoInfo.deviceGuid);
if(apoGuid == EQUALIZERAPO_LFX_GUID)
childApoGuid = apoInfo.originalLfxGuid;
if(apoGuid == EQUALIZERAPO_PRE_MIX_GUID)
childApoGuid = apoInfo.preMixChildGuid;
else
childApoGuid = apoInfo.originalGfxGuid;
childApoGuid = apoInfo.postMixChildGuid;
}
}
catch(RegistryException e)
@@ -154,7 +154,7 @@ HRESULT EqualizerAPO::Initialize(UINT32 cbDataSize, BYTE* pbyData)
hr = CLSIDFromString(childApoGuid.c_str(), &childGuid);
if(FAILED(hr))
{
LogF(L"Can't convert guid string to guid");
LogF(L"Can't convert child apo guid string to guid");
return hr;
}
@@ -247,7 +247,7 @@ HRESULT EqualizerAPO::IsInputFormatSupported(IAudioMediaType* pOutputFormat,
// we do not support downmixing currently
if(hr == S_OK && inFormat.dwSamplesPerFrame > 2 && inFormat.dwSamplesPerFrame > outFormat.dwSamplesPerFrame)
{
*ppSupportedInputFormat = pOutputFormat;
CreateAudioMediaTypeFromUncompressedAudioFormat(&outFormat, ppSupportedInputFormat);
hr = S_FALSE;
}
}
+4 -4
View File
@@ -32,9 +32,9 @@ class INonDelegatingUnknown
};
// {EACD2258-FCAC-4FF4-B36D-419E924A6D79}
const GUID EQUALIZERAPO_LFX_GUID = { 0xeacd2258, 0xfcac, 0x4ff4, { 0xb3, 0x6d, 0x41, 0x9e, 0x92, 0x4a, 0x6d, 0x79 } };
const GUID EQUALIZERAPO_PRE_MIX_GUID = { 0xeacd2258, 0xfcac, 0x4ff4, { 0xb3, 0x6d, 0x41, 0x9e, 0x92, 0x4a, 0x6d, 0x79 } };
// {EC1CC9CE-FAED-4822-828A-82A81A6F018F}
const GUID EQUALIZERAPO_GFX_GUID = { 0xec1cc9ce, 0xfaed, 0x4822, { 0x82, 0x8a, 0x82, 0xa8, 0x1a, 0x6f, 0x01, 0x8f } };
const GUID EQUALIZERAPO_POST_MIX_GUID = { 0xec1cc9ce, 0xfaed, 0x4822, { 0x82, 0x8a, 0x82, 0xa8, 0x1a, 0x6f, 0x01, 0x8f } };
class EqualizerAPO
: public CBaseAudioProcessingObject, public IAudioSystemEffects, public INonDelegatingUnknown
@@ -71,8 +71,8 @@ public:
virtual ULONG __stdcall NonDelegatingRelease();
static long instCount;
static const CRegAPOProperties<1> regGfxProperties;
static const CRegAPOProperties<1> regLfxProperties;
static const CRegAPOProperties<1> regPostMixProperties;
static const CRegAPOProperties<1> regPreMixProperties;
private:
long refCount;
+7 -5
View File
@@ -56,8 +56,9 @@ using namespace mup;
FilterEngine::FilterEngine()
:parser(0)
{
lfx = false;
preMix = false;
capture = false;
postMixInstalled = true;
inputChannelCount = 0;
lastInputWasSilent = false;
threadHandle = NULL;
@@ -119,14 +120,15 @@ FilterEngine::~FilterEngine()
DeleteCriticalSection(&loadSection);
}
void FilterEngine::setLfx(bool lfx)
void FilterEngine::setPreMix(bool preMix)
{
this->lfx = lfx;
this->preMix = preMix;
}
void FilterEngine::setDeviceInfo(bool capture, const wstring& deviceName, const wstring& connectionName, const wstring& deviceGuid)
void FilterEngine::setDeviceInfo(bool capture, bool postMixInstalled, const wstring& deviceName, const wstring& connectionName, const wstring& deviceGuid)
{
this->capture = capture;
this->postMixInstalled = postMixInstalled;
this->deviceName = deviceName;
this->connectionName = connectionName;
this->deviceGuid = deviceGuid;
@@ -593,7 +595,7 @@ unsigned long __stdcall FilterEngine::notificationThread(void* parameter)
{
FilterEngine* engine = (FilterEngine*)parameter;
HANDLE notificationHandle = FindFirstChangeNotificationW(engine->configPath.c_str(), true, FILE_NOTIFY_CHANGE_LAST_WRITE);
HANDLE notificationHandle = FindFirstChangeNotificationW(engine->configPath.c_str(), true, FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE);
if(notificationHandle == INVALID_HANDLE_VALUE)
notificationHandle = NULL;
+6 -4
View File
@@ -39,16 +39,17 @@ public:
FilterEngine();
~FilterEngine();
void setLfx(bool lfx);
void setDeviceInfo(bool capture, const std::wstring& deviceName, const std::wstring& connectionName, const std::wstring& deviceGuid);
void setPreMix(bool preMix);
void setDeviceInfo(bool capture, bool postMixInstalled, const std::wstring& deviceName, const std::wstring& connectionName, const std::wstring& deviceGuid);
void initialize(float sampleRate, unsigned inputChannelCount, unsigned realChannelCount, unsigned outputChannelCount, unsigned channelMask, unsigned maxFrameCount);
void loadConfig();
void loadConfig(const std::wstring& path);
void watchRegistryKey(const std::wstring& key);
void process(float *output, float *input, unsigned frameCount);
bool isLfx() const {return lfx;}
bool isPreMix() const {return preMix;}
bool isCapture() const {return capture;}
bool isPostMixInstalled() const {return postMixInstalled;}
std::wstring getDeviceName() const {return deviceName;}
std::wstring getConnectionName() const {return connectionName;}
std::wstring getDeviceGuid() const {return deviceGuid;}
@@ -67,8 +68,9 @@ private:
std::vector<IFilterFactory*> factories;
bool lfx;
bool preMix;
bool capture;
bool postMixInstalled;
std::wstring deviceName;
std::wstring connectionName;
std::wstring deviceGuid;
+7
View File
@@ -0,0 +1,7 @@
1. Change version number in version.h
2. Create setups using build.bat
3. Export trunk to an external folder, create EqualizerAPO-src-x.zip from the folder contents
4. Upload EqualizerAPO32-x.zip, EqualizerAPO64-x.zip and EqualizerAPO-src-x.zip to new folder x
5. Update readme.txt using subversion log
6. Set EqualizerAPO64-x.zip as new default download
7. Create tag of trunk in tags/x
+6 -5
View File
@@ -26,15 +26,16 @@ using namespace std;
void StageFilterFactory::initialize(FilterEngine* engine)
{
lfx = engine->isLfx();
preMix = engine->isPreMix();
capture = engine->isCapture();
postMixInstalled = engine->isPostMixInstalled();
engine->getParser()->DefineConst(L"stage", engine->isCapture() ? L"capture" : engine->isLfx() ? L"pre-mix" : L"post-mix");
engine->getParser()->DefineConst(L"stage", engine->isCapture() ? L"capture" : engine->isPreMix() ? L"pre-mix" : L"post-mix");
}
vector<IFilter*> StageFilterFactory::startOfConfiguration()
{
stageMatches = capture || !lfx;
stageMatches = capture || !preMix || !postMixInstalled;
while(!stageMatchesStack.empty())
stageMatchesStack.pop();
@@ -62,7 +63,7 @@ vector<IFilter*> StageFilterFactory::createFilter(const wstring& configPath, wst
const wstring& part = *it;
if(part == L"pre-mix")
{
if(!capture && lfx)
if(!capture && preMix)
{
stageMatches = true;
matchingPart = part;
@@ -70,7 +71,7 @@ vector<IFilter*> StageFilterFactory::createFilter(const wstring& configPath, wst
}
else if(part == L"post-mix")
{
if(!capture && !lfx)
if(!capture && !preMix)
{
stageMatches = true;
matchingPart = part;
+2 -1
View File
@@ -34,8 +34,9 @@ public:
virtual std::vector<IFilter*> endOfFile(const std::wstring& configPath);
private:
bool lfx;
bool preMix;
bool capture;
bool postMixInstalled;
bool stageMatches;
std::stack<bool> stageMatchesStack;
+2 -2
View File
@@ -87,7 +87,7 @@ void LogHelper::log(const char* file, int line, const void* caller, bool trace,
GetLocalTime(&___st);
DWORD threadId = GetCurrentThreadId();
fwprintf(fp, L"%04d-%02d-%02d %02d:%02d:%02d.%03d %d %08X (%S:%d): ",
___st.wYear, ___st.wMonth, ___st.wDay, ___st.wHour, ___st.wMinute, ___st.wSecond, ___st.wMilliseconds, threadId, caller, file, line);
___st.wYear, ___st.wMonth, ___st.wDay, ___st.wHour, ___st.wMinute, ___st.wSecond, ___st.wMilliseconds, threadId, (DWORD)caller, file, line);
}
if(trace)
@@ -125,4 +125,4 @@ void LogHelper::set(FILE* fp, bool enableTrace, bool compact, bool useConsoleCol
LogHelper::enableTrace = enableTrace;
LogHelper::compact = compact;
LogHelper::useConsoleColors = useConsoleColors;
}
}
-1
View File
@@ -316,7 +316,6 @@ vector<wstring> RegistryHelper::enumSubKeys(wstring key)
wchar_t keyName[256];
DWORD keyLength = sizeof(keyName) / sizeof(wchar_t);
int i=0;
int itemCount=0;
LSTATUS status;
while((status = RegEnumKeyExW(keyHandle, i++, keyName, &keyLength, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS)
+1 -1
View File
@@ -1,3 +1,3 @@
#define MAJOR 0
#define MINOR 9
#define REVISION 1
#define REVISION 2