From 9d1d57b3520c5ecf87a730ac3da9aed7ed443817 Mon Sep 17 00:00:00 2001 From: jthedering <51533355+jthedering@users.noreply.github.com> Date: Wed, 9 Dec 2015 21:55:07 +0000 Subject: [PATCH] Version 1.1.1 Fixed: With some sound card drivers, unwanted sounds were heard when audio got silent (e.g. by pausing). The modification of silent buffers, which seems to cause this issue, is now optionally available via the troubleshooting options in the Configurator. Fixed: In the Configuration Editor the peak gain display in the analysis panel was sometimes showing incorrect values. Improved: The GUI of the GraphicEQ command can now import the measurement text file format from Room EQ Wizard. --- Configurator/Configurator.cpp | 32 +++++++++++++++++++++++++ Configurator/Configurator.h | 1 + Configurator/Configurator.rc | Bin 21592 -> 23284 bytes Configurator/resource.h | Bin 6244 -> 6516 bytes DeviceAPOInfo.cpp | 6 +++++ DeviceAPOInfo.h | 2 ++ Editor/AnalysisThread.cpp | 3 +-- Editor/guis/GraphicEQFilterGUI.cpp | 36 +++++++++++++++++------------ EqualizerAPO.cpp | 28 +++++++++++++++------- EqualizerAPO.h | 1 + version.h | 2 +- 11 files changed, 85 insertions(+), 26 deletions(-) diff --git a/Configurator/Configurator.cpp b/Configurator/Configurator.cpp index 64ea601..62cba7d 100644 --- a/Configurator/Configurator.cpp +++ b/Configurator/Configurator.cpp @@ -57,6 +57,7 @@ void Configurator::onInitDialog(HWND hDlg) 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); + allowSilentBuffer = GetDlgItem(hDlg, IDC_ALLOW_SILENT_BUFFER); selectOneDeviceLabel = GetDlgItem(hDlg, IDC_SELECT_ONE_DEVICE); expandTroubleShooting(false); @@ -121,6 +122,29 @@ void Configurator::onInitDialog(HWND hDlg) } ComboBox_SetCurSel(installModeComboBox, 0); + LoadStringW(hInstance, IDS_ALLOW_SILENT_BUFFER, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); + SetWindowTextW(allowSilentBuffer, stringBuf); + + LoadStringW(hInstance, IDS_ALLOW_SILENT_BUFFER_TOOLTIP, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); + HWND tooltip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL, + WS_POPUP | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + hDlg, NULL, + hInstance, NULL); + + if (tooltip != NULL) + { + TOOLINFO toolInfo = {0}; + toolInfo.cbSize = sizeof(toolInfo); + toolInfo.hwnd = hDlg; + toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + toolInfo.uId = (UINT_PTR)allowSilentBuffer; + toolInfo.lpszText = stringBuf; + SendMessage(tooltip, TTM_ADDTOOL, 0, (LPARAM)&toolInfo); + SendMessage(tooltip, TTM_SETMAXTIPWIDTH, 0, 400); + } + LoadStringW(hInstance, IDS_SELECT_ONE_DEVICE, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); SetWindowTextW(selectOneDeviceLabel, stringBuf); @@ -316,6 +340,7 @@ bool Configurator::onButtonClicked(unsigned sourceId) case IDC_USE_ORIGINAL_APO_PRE_MIX: case IDC_USE_ORIGINAL_APO_POST_MIX: case IDC_INSTALL_MODE_COMBOBOX: + case IDC_ALLOW_SILENT_BUFFER: { int index = TabCtrl_GetCurSel(categoryTabCtrl); HWND deviceList = deviceLists[index]; @@ -351,6 +376,9 @@ bool Configurator::onButtonClicked(unsigned sourceId) case IDC_INSTALL_MODE_COMBOBOX: info.selectedInstallState.installMode = (DeviceAPOInfo::InstallMode)ComboBox_GetCurSel(installModeComboBox); break; + case IDC_ALLOW_SILENT_BUFFER: + info.selectedInstallState.allowSilentBufferModification = Button_GetCheck(allowSilentBuffer) == BST_CHECKED; + break; } updateList(index, i); @@ -522,6 +550,7 @@ void Configurator::expandTroubleShooting(bool expand) ShowWindow(useOriginalAPOPreMix, showCmd); ShowWindow(useOriginalAPOPostMix, showCmd); ShowWindow(installModeComboBox, showCmd); + ShowWindow(allowSilentBuffer, showCmd); showCmd = expand && IsWindowEnabled(selectOneDeviceLabel) ? SW_SHOW : SW_HIDE; ShowWindow(selectOneDeviceLabel, showCmd); @@ -644,6 +673,7 @@ void Configurator::updateButtons(int listIndex) EnableWindow(useOriginalAPOPreMix, enable && hasOriginalAPOPreMix && installState.installPreMix); EnableWindow(useOriginalAPOPostMix, enable && !isInput && hasOriginalAPOPostMix && installState.installPostMix); EnableWindow(installModeComboBox, enable); + EnableWindow(allowSilentBuffer, enable); EnableWindow(selectOneDeviceLabel, !enable); Button_SetCheck(installPreMix, installState.installPreMix); @@ -654,6 +684,8 @@ void Configurator::updateButtons(int listIndex) if (RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1 ComboBox_SetCurSel(installModeComboBox, installState.installMode); + Button_SetCheck(allowSilentBuffer, installState.allowSilentBufferModification); + expandTroubleShooting(Button_GetCheck(toggleTroubleShooting) != 0); } diff --git a/Configurator/Configurator.h b/Configurator/Configurator.h index 86d48c4..88f256e 100644 --- a/Configurator/Configurator.h +++ b/Configurator/Configurator.h @@ -54,6 +54,7 @@ private: HWND useOriginalAPOPreMix; HWND useOriginalAPOPostMix; HWND installModeComboBox; + HWND allowSilentBuffer; HWND selectOneDeviceLabel; std::wstring cmdLine; diff --git a/Configurator/Configurator.rc b/Configurator/Configurator.rc index a87121a4d63b7e1ba9ba23c2c4738b85f9acf8fe..cc2982e1046f4f671bd22542f6d5615b70b87fa4 100644 GIT binary patch delta 1384 zcmbtUO=}ZT6g{C`r4@o!LC`W($ttKxP(z`Mw8k2UP1J^N3ZZE}49yprNu${e{)YDp z+;u4gH~K5wb+1boE~E<)^qe<|iI!ra3^VuL_wL8J_uVtcN1^ZUL+=X9=4&`&BH{Ui z9P-#f2``XE4jF7=o7y^xc+4k*=Wwt>*+Ub1=%b7(cb=ky3L2>KJ>b4a*+H8pu3a~2 zU8RqM0)1+HsF}Bm*ONJB`CrBoG35E=D6=S-UrXtQ83bnG#!dfprVKH(Q70OGU390J ziDO93!AqPFRhc$DA`;#-_uVtR+KAC&Kx>y$^{VzANuR0;RJx!ghgKglLEWxA`*m2t z2@}at_APtfWQcu&@o)#b+})+cM5eKUC-f@vDmJl7zo4*&jqC8DI)v=E2|%6iF^DSh zxT-R&z^L!~4*Bg{H&xoVFnX-#Cs*zmfPigU>o2wwf>j;Yt+?_GDtEa*0ps4bX?4vC zTj#+Z;b;sFxo$8#Ycp@6cSo<5hfAaFR5WC2$(Z?ZH8P4OKg`di@W6b2=$day$4@g% zlVuI)>e5-Wqlz3>^JjXfwPvPnp9v>Zw?e#GJYwTYywCGYSPYjCW<>j#QlfP$f%`}> zP6GF=j3bFS^*D9ek{Kqy_HmS2J-%j+7BAP&lSb6JU~v~A%}ir8z#iM@*lQ0cqU-#- z-6D`^^Ka{?-ueY-9Ln~R96O8N89p)dY3qtFp6J){nzF)-lL!G8A<;DpOLxZZG%q&T z$)f!s2amu4n|xoYtt`iMrAzksb|jIZ@APC;Q#;t delta 71 zcmeyemGQ<3#ti{-lT$P`CZE&fo2V!feT4Jo&A4@#YJr bDvZpo41SXn9d~c`vb!M$(zN+XxB@c(5c3<~ diff --git a/Configurator/resource.h b/Configurator/resource.h index bb42efbea0f61df44eb45945ac7d0ac780ff268d..84f8dc414d4c7a85f868d96a4308ba428753224b 100644 GIT binary patch delta 211 zcmaE2@Wp5Yo517)EG(*y3_d{U&k)WK&k)Su31qu6_%Vb4c}@(W3~oT^$`CYJkWZA^ zjKO#^Bde?}Q96M7Lx86G1I-Honi{~Mz+lK=#$YnJP)L3=j{qAh@fJ^hATBj|0Tat+ gK2a$qpesx#Ulh}v93nnpauc7}WCwAP$$S!F09Pp}?EnA( delta 41 wcmexj^u%BTo4{l{VYbZ&1lU+ND~X9QP5#FsF*!hD$z&EWF(556Sxzzx0422yx&QzG diff --git a/DeviceAPOInfo.cpp b/DeviceAPOInfo.cpp index a72fe9d..888290f 100644 --- a/DeviceAPOInfo.cpp +++ b/DeviceAPOInfo.cpp @@ -39,6 +39,7 @@ using namespace std; #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* allowSilentBufferValueName = L"AllowSilentBufferModification"; 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"; @@ -229,6 +230,7 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid) currentInstallState.installPostMix = !isInput; currentInstallState.useOriginalAPOPreMix = true; currentInstallState.useOriginalAPOPostMix = !isInput; + currentInstallState.allowSilentBufferModification = false; if (!RegistryHelper::keyExists(keyPath + L"\\FxProperties")) { @@ -311,6 +313,9 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid) currentInstallState.installMode = INSTALL_SFX_EFX; else if (foundAt[SFX_INDEX] || foundAt[MFX_INDEX]) currentInstallState.installMode = INSTALL_SFX_MFX; + + if (RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, allowSilentBufferValueName)) + currentInstallState.allowSilentBufferModification = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, allowSilentBufferValueName) != L"false"; } else { @@ -490,6 +495,7 @@ void DeviceAPOInfo::install() RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName, preMixValue); RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, postMixChildGuidValueName, postMixValue); + RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, allowSilentBufferValueName, selectedInstallState.allowSilentBufferModification ? L"true" : L"false"); RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, versionValueName, installVersion); if (selectedInstallState.installMode == INSTALL_LFX_GFX) diff --git a/DeviceAPOInfo.h b/DeviceAPOInfo.h index 0edb345..eb6eeb6 100644 --- a/DeviceAPOInfo.h +++ b/DeviceAPOInfo.h @@ -43,6 +43,7 @@ public: bool useOriginalAPOPreMix; bool useOriginalAPOPostMix; InstallMode installMode; + bool allowSilentBufferModification; InstallState() { @@ -51,6 +52,7 @@ public: useOriginalAPOPreMix = false; useOriginalAPOPostMix = false; installMode = INSTALL_LFX_GFX; + allowSilentBufferModification = false; } bool operator!=(InstallState& other) diff --git a/Editor/AnalysisThread.cpp b/Editor/AnalysisThread.cpp index 05177f2..1000f71 100644 --- a/Editor/AnalysisThread.cpp +++ b/Editor/AnalysisThread.cpp @@ -24,7 +24,6 @@ AnalysisThread::AnalysisThread() { - } AnalysisThread::~AnalysisThread() @@ -245,7 +244,7 @@ void AnalysisThread::run() double peakGain = -DBL_MAX; - for (int i = 0; i < frameCount; i++) + for (int i = 0; i < frameCount / 2; i++) { float sqrGain = freqData[i][0] * freqData[i][0] + freqData[i][1] * freqData[i][1]; if (sqrGain > peakGain) diff --git a/Editor/guis/GraphicEQFilterGUI.cpp b/Editor/guis/GraphicEQFilterGUI.cpp index 3ca45df..fcbd883 100644 --- a/Editor/guis/GraphicEQFilterGUI.cpp +++ b/Editor/guis/GraphicEQFilterGUI.cpp @@ -308,23 +308,29 @@ void GraphicEQFilterGUI::on_actionImport_triggered() if (file.open(QFile::ReadOnly)) { QTextStream stream(&file); - QString text = stream.readAll(); - if (!text.contains('.')) - text = text.replace(',', '.'); - QRegularExpressionMatchIterator it = numberRegEx.globalMatch(text); - while (it.hasNext()) + while (!stream.atEnd()) { - QRegularExpressionMatch match = it.next(); - QString freqString = match.captured(); - bool ok; - double freq = freqString.toDouble(&ok); - if (ok && it.hasNext()) + QString text = stream.readLine(); + if (text.startsWith('*')) + continue; + + if (!text.contains('.')) + text = text.replace(',', '.'); + QRegularExpressionMatchIterator it = numberRegEx.globalMatch(text); + while (it.hasNext()) { - match = it.next(); - QString gainString = match.captured(); - double gain = gainString.toDouble(&ok); - if (ok) - newNodes.push_back(FilterNode(freq, gain)); + QRegularExpressionMatch match = it.next(); + QString freqString = match.captured(); + bool ok; + double freq = freqString.toDouble(&ok); + if (ok && it.hasNext()) + { + match = it.next(); + QString gainString = match.captured(); + double gain = gainString.toDouble(&ok); + if (ok) + newNodes.push_back(FilterNode(freq, gain)); + } } } } diff --git a/EqualizerAPO.cpp b/EqualizerAPO.cpp index 28ea8c7..1bbb050 100644 --- a/EqualizerAPO.cpp +++ b/EqualizerAPO.cpp @@ -47,6 +47,8 @@ EqualizerAPO::EqualizerAPO(IUnknown* pUnkOuter) else this->pUnkOuter = reinterpret_cast(static_cast(this)); + allowSilentBufferModification = false; + childAPO = NULL; childRT = NULL; childCfg = NULL; @@ -142,6 +144,8 @@ HRESULT EqualizerAPO::Initialize(UINT32 cbDataSize, BYTE* pbyData) childApoGuid = apoInfo.preMixChildGuid; else childApoGuid = apoInfo.postMixChildGuid; + + allowSilentBufferModification = apoInfo.currentInstallState.allowSilentBufferModification; } } catch (RegistryException e) @@ -425,18 +429,26 @@ void EqualizerAPO::APOProcess(UINT32 u32NumInputConnections, if (ppInputConnections[0]->u32BufferFlags == BUFFER_SILENT) { - unsigned outputFrameCount = ppOutputConnections[0]->u32ValidFrameCount * engine.getOutputChannelCount(); - boolean silent = true; - for (unsigned i = 0; i < outputFrameCount; i++) + if (allowSilentBufferModification) { - if (outputFrames[i] != 0.0) + unsigned outputFrameCount = ppOutputConnections[0]->u32ValidFrameCount * engine.getOutputChannelCount(); + boolean silent = true; + for (unsigned i = 0; i < outputFrameCount; i++) { - silent = false; - break; + if (abs(outputFrames[i]) > 1e-10) + { + silent = false; + break; + } } + // BUFFER_SILENT seems to be important for some sound card drivers, so only use BUFFER_VALID if there really is audio + ppOutputConnections[0]->u32BufferFlags = silent ? BUFFER_SILENT : BUFFER_VALID; + } + else + { + memset(outputFrames, 0, ppOutputConnections[0]->u32ValidFrameCount * engine.getOutputChannelCount() * sizeof(float)); + ppOutputConnections[0]->u32BufferFlags = BUFFER_SILENT; } - // BUFFER_SILENT seems to be important for some sound card drivers, so only use BUFFER_VALID if there really is audio - ppOutputConnections[0]->u32BufferFlags = silent ? BUFFER_SILENT : BUFFER_VALID; } else { diff --git a/EqualizerAPO.h b/EqualizerAPO.h index 2089fbf..b313382 100644 --- a/EqualizerAPO.h +++ b/EqualizerAPO.h @@ -72,6 +72,7 @@ private: long refCount; IUnknown* pUnkOuter; FilterEngine engine; + bool allowSilentBufferModification; void resetChild(); diff --git a/version.h b/version.h index bdb5792..5cefd4e 100644 --- a/version.h +++ b/version.h @@ -1,3 +1,3 @@ #define MAJOR 1 #define MINOR 1 -#define REVISION 0 +#define REVISION 1