diff --git a/Benchmark/Benchmark.cpp b/Benchmark/Benchmark.cpp index a5f5f2a..52f3f0d 100644 --- a/Benchmark/Benchmark.cpp +++ b/Benchmark/Benchmark.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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 "stdafx.h" @@ -46,7 +46,7 @@ int main(int argc, char** argv) { stringstream versionStream; versionStream << MAJOR << "." << MINOR; - if(REVISION != 0) + if (REVISION != 0) versionStream << "." << REVISION; TCLAP::CmdLine cmd("Benchmark generates a linear sine sweep or reads from the given input file. " "It then filters the waveform using the Equalizer APO filter configuration " @@ -71,8 +71,8 @@ int main(int argc, char** argv) bool verbose = verboseArg.getValue(); LogHelper::set(stderr, verbose, true, true); #ifdef _DEBUG - _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); - //_CrtSetBreakAlloc(3318); + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + // _CrtSetBreakAlloc(3318); #endif unsigned sampleRate; @@ -82,7 +82,7 @@ int main(int argc, char** argv) float length; float* buf; - if(REVISION == 0) + if (REVISION == 0) printf("Benchmark %d.%d\n", MAJOR, MINOR); else printf("Benchmark %d.%d.%d\n", MAJOR, MINOR, REVISION); @@ -91,7 +91,7 @@ int main(int argc, char** argv) printf("\n"); string input = inputArg.getValue(); - if(input != "") + if (input != "") { printf("Reading sound data from %s\n", input.c_str()); @@ -100,7 +100,7 @@ int main(int argc, char** argv) SF_INFO info; SNDFILE* inFile = sf_open(input.c_str(), SFM_READ, &info); - if(inFile == NULL) + if (inFile == NULL) { fprintf(stderr, "%s", sf_strerror(inFile)); return 1; @@ -115,7 +115,7 @@ int main(int argc, char** argv) buf = new float[frameCount * channelCount]; sf_count_t numRead = 0; - while(numRead < frameCount) + while (numRead < frameCount) numRead += sf_readf_float(inFile, buf + numRead * channelCount, frameCount - numRead); sf_close(inFile); @@ -141,13 +141,13 @@ int main(int argc, char** argv) timer.start(); buf = new float[frameCount * channelCount]; - for(unsigned i=0; i max) + if (f > max) max = f; - if(f > 1.0f) + if (f > 1.0f) clipCount++; } printf("Max output level: %f (%f dB)", max, log10(max) * 20.0f); - if(clipCount > 0) + if (clipCount > 0) printf(" (%d samples clipped!)", clipCount); printf("\n"); string output = outputArg.getValue(); - if(output == "") + if (output == "") { char temp[255]; - GetTempPathA(sizeof(temp)/sizeof(wchar_t), temp); + GetTempPathA(sizeof(temp) / sizeof(wchar_t), temp); output = temp; output += "testout.wav"; @@ -217,28 +217,28 @@ int main(int argc, char** argv) SF_INFO info = {frameCount, (int)sampleRate, (int)channelCount, SF_FORMAT_WAV | SF_FORMAT_PCM_16, 0}; SNDFILE* outFile = sf_open(output.c_str(), SFM_WRITE, &info); - if(outFile == NULL) + if (outFile == NULL) { fprintf(stderr, "%s", sf_strerror(outFile)); return 1; } sf_count_t numWritten = 0; - while(numWritten < frameCount) + while (numWritten < frameCount) numWritten += sf_writef_float(outFile, buf2 + numWritten * channelCount, frameCount - numWritten); sf_close(outFile); outFile = NULL; - delete[] buf; - delete[] buf2; + delete[]buf; + delete[]buf2; - if(!noPauseArg.getValue()) + if (!noPauseArg.getValue()) system("pause"); return 0; } - catch(TCLAP::ArgException e) + catch (TCLAP::ArgException e) { printf("Error: %s for arg %s\n", e.error().c_str(), e.argId().c_str()); return -1; diff --git a/ClassFactory.cpp b/ClassFactory.cpp index b0dd4f7..64f2b17 100644 --- a/ClassFactory.cpp +++ b/ClassFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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 "stdafx.h" @@ -31,7 +31,7 @@ ClassFactory::ClassFactory() HRESULT __stdcall ClassFactory::QueryInterface(const IID& iid, void** ppv) { - if(iid == __uuidof(IUnknown) || iid == __uuidof(IClassFactory)) + if (iid == __uuidof(IUnknown) || iid == __uuidof(IClassFactory)) *ppv = static_cast(this); else { @@ -50,7 +50,7 @@ ULONG __stdcall ClassFactory::AddRef() ULONG __stdcall ClassFactory::Release() { - if(InterlockedDecrement(&refCount) == 0) + if (InterlockedDecrement(&refCount) == 0) { delete this; return 0; @@ -61,11 +61,11 @@ ULONG __stdcall ClassFactory::Release() HRESULT __stdcall ClassFactory::CreateInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv) { - if(pUnknownOuter != NULL && iid != __uuidof(IUnknown)) + if (pUnknownOuter != NULL && iid != __uuidof(IUnknown)) return E_NOINTERFACE; EqualizerAPO* apo = new EqualizerAPO(pUnknownOuter); - if(apo == NULL) + if (apo == NULL) return E_OUTOFMEMORY; HRESULT hr = apo->NonDelegatingQueryInterface(iid, ppv); @@ -76,7 +76,7 @@ HRESULT __stdcall ClassFactory::CreateInstance(IUnknown* pUnknownOuter, const II HRESULT __stdcall ClassFactory::LockServer(BOOL bLock) { - if(bLock) + if (bLock) InterlockedIncrement(&lockCount); else InterlockedDecrement(&lockCount); diff --git a/ClassFactory.h b/ClassFactory.h index f694144..6bf93b4 100644 --- a/ClassFactory.h +++ b/ClassFactory.h @@ -1,27 +1,27 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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. */ #pragma once #include -class ClassFactory: public IClassFactory +class ClassFactory : public IClassFactory { public: ClassFactory(); diff --git a/Configurator/Configurator.cpp b/Configurator/Configurator.cpp index 5f82868..64ea601 100644 --- a/Configurator/Configurator.cpp +++ b/Configurator/Configurator.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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 "stdafx.h" @@ -32,7 +32,7 @@ using namespace std; Configurator* configurator; Configurator::Configurator(HINSTANCE hInstance, const wchar_t* cmdLine) - :cmdLine(cmdLine) + : cmdLine(cmdLine) { this->hInstance = hInstance; hDlg = NULL; @@ -67,56 +67,56 @@ void Configurator::onInitDialog(HWND hDlg) tci.pszText = stringBuf; tci.mask = TCIF_TEXT; - LoadStringW(hInstance, IDS_PLAYBACK_DEVICES, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_PLAYBACK_DEVICES, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); TabCtrl_InsertItem(categoryTabCtrl, 0, &tci); - LoadStringW(hInstance, IDS_CAPTURE_DEVICES, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_CAPTURE_DEVICES, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); TabCtrl_InsertItem(categoryTabCtrl, 1, &tci); - LoadStringW(hInstance, IDS_REQUEST, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_REQUEST, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); SetWindowTextW(requestLabel, stringBuf); - LoadStringW(hInstance, IDS_COPY_DEVICE_COMMAND, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_COPY_DEVICE_COMMAND, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); SetWindowTextW(copyDeviceCommandButton, stringBuf); - LoadStringW(hInstance, IDS_OK, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_OK, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); SetWindowTextW(okButton, stringBuf); - LoadStringW(hInstance, IDS_CANCEL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_CANCEL, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); SetWindowTextW(cancelButton, stringBuf); - LoadStringW(hInstance, IDS_TOGGLE_TROUBLESHOOTING, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_TOGGLE_TROUBLESHOOTING, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); SetWindowTextW(toggleTroubleShooting, stringBuf); int width = 185; - if(wcsncmp(stringBuf, L"Probleml", 8) == 0) + 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); + 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)); + 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)); + 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)); + 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)); + 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)); + 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 + if (RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1 { - LoadStringW(hInstance, IDS_INSTALL_MODE_SFX_MFX, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + 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)); + LoadStringW(hInstance, IDS_INSTALL_MODE_SFX_EFX, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); ComboBox_AddString(installModeComboBox, stringBuf); } ComboBox_SetCurSel(installModeComboBox, 0); @@ -124,7 +124,7 @@ void Configurator::onInitDialog(HWND hDlg) LoadStringW(hInstance, IDS_SELECT_ONE_DEVICE, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); SetWindowTextW(selectOneDeviceLabel, stringBuf); - for(int i=0; i<=1; i++) + for (int i = 0; i <= 1; i++) { HWND deviceList = deviceLists[i]; ListView_SetExtendedListViewStyle(deviceList, ListView_GetExtendedListViewStyle(deviceList) | LVS_EX_CHECKBOXES); @@ -132,13 +132,13 @@ void Configurator::onInitDialog(HWND hDlg) column.pszText = stringBuf; column.mask = LVCF_TEXT; - LoadStringW(hInstance, IDS_CONNECTOR, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_CONNECTOR, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); ListView_InsertColumn(deviceList, 0, &column); - LoadStringW(hInstance, IDS_DEVICE, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_DEVICE, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); ListView_InsertColumn(deviceList, 1, &column); - LoadStringW(hInstance, IDS_STATUS, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_STATUS, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); ListView_InsertColumn(deviceList, 2, &column); LVITEM item; @@ -148,42 +148,42 @@ void Configurator::onInitDialog(HWND hDlg) try { - apoInfos[i] = DeviceAPOInfo::loadAllInfos(i==1); - wstring defaultDevice = StringHelper::toLowerCase(DeviceAPOInfo::getDefaultDevice(i==1)); + apoInfos[i] = DeviceAPOInfo::loadAllInfos(i == 1); + wstring defaultDevice = StringHelper::toLowerCase(DeviceAPOInfo::getDefaultDevice(i == 1)); - int itemCount=0; - for(vector::iterator it = apoInfos[i].begin(); it != apoInfos[i].end(); it++) + int itemCount = 0; + for (vector::iterator it = apoInfos[i].begin(); it != apoInfos[i].end(); it++) { - wcsncpy_s(stringBuf, sizeof(stringBuf)/sizeof(wchar_t), it->connectionName.c_str(), _TRUNCATE); + wcsncpy_s(stringBuf, sizeof(stringBuf) / sizeof(wchar_t), it->connectionName.c_str(), _TRUNCATE); item.iItem = itemCount; item.lParam = itemCount; ListView_InsertItem(deviceList, &item); - wcsncpy_s(stringBuf, sizeof(stringBuf)/sizeof(wchar_t), it->deviceName.c_str(), _TRUNCATE); + wcsncpy_s(stringBuf, sizeof(stringBuf) / sizeof(wchar_t), it->deviceName.c_str(), _TRUNCATE); ListView_SetItemText(deviceList, itemCount, 1, stringBuf); - if(it->isInstalled) + if (it->isInstalled) { ListView_SetCheckState(deviceList, itemCount, TRUE); - if(it->canBeUpgraded()) + if (it->canBeUpgraded()) LoadStringW(hInstance, IDS_WILL_BE_UPGRADED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); - else if(it->isEnhancementsDisabled) + else if (it->isEnhancementsDisabled) LoadStringW(hInstance, IDS_ENHANCEMENTS_WILL_BE_ENABLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); else - LoadStringW(hInstance, IDS_ALREADY_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_ALREADY_INSTALLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); } - else if(it->isExperimental()) + else if (it->isExperimental()) { - LoadStringW(hInstance, IDS_CAN_BE_INSTALLED_EXPERIMENTAL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + 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)); + LoadStringW(hInstance, IDS_CAN_BE_INSTALLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); } - if(it->isDefaultDevice) + if (it->isDefaultDevice) { wstring statusText = stringBuf; - LoadStringW(hInstance, IDS_DEFAULT_DEVICE, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_DEFAULT_DEVICE, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); statusText = wstring(stringBuf) + L", " + statusText; ListView_SetItemText(deviceList, itemCount, 2, const_cast(statusText.c_str())); @@ -196,7 +196,7 @@ void Configurator::onInitDialog(HWND hDlg) itemCount++; } } - catch(RegistryException e) + catch (RegistryException e) { MessageBoxW(hDlg, e.getMessage().c_str(), L"Error while accessing the registry", MB_ICONERROR | MB_OK); } @@ -226,15 +226,15 @@ void Configurator::onLvnItemChanged(unsigned sourceId, LPNMLISTVIEW info) bool Configurator::onButtonClicked(unsigned sourceId) { - switch(sourceId) + switch (sourceId) { case IDOK: { - for(int index = 0; index <= 1; index++) + for (int index = 0; index <= 1; index++) { HWND deviceList = deviceLists[index]; - for(int i = 0; i < ListView_GetItemCount(deviceList); i++) + for (int i = 0; i < ListView_GetItemCount(deviceList); i++) { LVITEM item; item.iItem = i; @@ -245,18 +245,18 @@ bool Configurator::onButtonClicked(unsigned sourceId) try { DeviceAPOInfo info = apoInfos[index][item.lParam]; - if(ListView_GetCheckState(deviceList, i) && !info.isInstalled) + if (ListView_GetCheckState(deviceList, i) && !info.isInstalled) info.install(); - else if(!ListView_GetCheckState(deviceList, i) && info.isInstalled) + else if (!ListView_GetCheckState(deviceList, i) && info.isInstalled) info.uninstall(); - else if(ListView_GetCheckState(deviceList, i) && (info.canBeUpgraded() || info.hasChanges() || info.isEnhancementsDisabled)) + else if (ListView_GetCheckState(deviceList, i) && (info.canBeUpgraded() || info.hasChanges() || info.isEnhancementsDisabled)) { info.uninstall(); info.load(info.deviceGuid); info.install(); } } - catch(RegistryException e) + catch (RegistryException e) { MessageBoxW(hDlg, e.getMessage().c_str(), L"Error while accessing the registry", MB_ICONERROR | MB_OK); } @@ -272,7 +272,7 @@ bool Configurator::onButtonClicked(unsigned sourceId) HWND deviceList = deviceLists[index]; bool first = true; - for(int i = 0; i < ListView_GetItemCount(deviceList); i++) + for (int i = 0; i < ListView_GetItemCount(deviceList); i++) { LVITEM item; item.iItem = i; @@ -281,9 +281,9 @@ bool Configurator::onButtonClicked(unsigned sourceId) item.stateMask = LVIS_SELECTED; ListView_GetItem(deviceList, &item); - if(item.state & LVIS_SELECTED) + if (item.state & LVIS_SELECTED) { - if(first) + if (first) first = false; else command += L"; "; @@ -321,7 +321,7 @@ bool Configurator::onButtonClicked(unsigned sourceId) HWND deviceList = deviceLists[index]; unsigned selectedCount = ListView_GetSelectedCount(deviceList); - for(int i = 0; i < ListView_GetItemCount(deviceList); i++) + for (int i = 0; i < ListView_GetItemCount(deviceList); i++) { LVITEM item; item.iItem = i; @@ -330,11 +330,11 @@ bool Configurator::onButtonClicked(unsigned sourceId) item.stateMask = LVIS_SELECTED; ListView_GetItem(deviceList, &item); - if(item.state & LVIS_SELECTED) + if (item.state & LVIS_SELECTED) { DeviceAPOInfo& info = apoInfos[index][item.lParam]; - switch(sourceId) + switch (sourceId) { case IDC_INSTALL_PRE_MIX: info.selectedInstallState.installPreMix = Button_GetCheck(installPreMix) == BST_CHECKED; @@ -362,45 +362,45 @@ bool Configurator::onButtonClicked(unsigned sourceId) break; } - if(sourceId == IDCANCEL && hasUpgrades()) + if (sourceId == IDCANCEL && hasUpgrades()) { wchar_t captionBuf[255]; - LoadStringW(hInstance, IDS_CANCEL_UPGRADES_CAPTION, captionBuf, sizeof(captionBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_CANCEL_UPGRADES_CAPTION, captionBuf, sizeof(captionBuf) / sizeof(wchar_t)); wchar_t stringBuf[255]; - LoadStringW(hInstance, IDS_CANCEL_UPGRADES, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); - if(MessageBoxW(hDlg, stringBuf, captionBuf, MB_ICONWARNING | MB_YESNO) == IDNO) + LoadStringW(hInstance, IDS_CANCEL_UPGRADES, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); + if (MessageBoxW(hDlg, stringBuf, captionBuf, MB_ICONWARNING | MB_YESNO) == IDNO) return false; } - if(sourceId == IDOK || sourceId == IDCANCEL) + if (sourceId == IDOK || sourceId == IDCANCEL) { - if(cmdLine == L"/i") + if (cmdLine == L"/i") { wchar_t stringBuf[255]; - LoadStringW(hInstance, IDS_AFTERINSTALL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_AFTERINSTALL, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); MessageBoxW(hDlg, stringBuf, L"Info", MB_ICONINFORMATION | MB_OK); } - else if(sourceId == IDOK && RegistryHelper::isWindowsVersionAtLeast(6, 3) // Windows 8.1 + else if (sourceId == IDOK && RegistryHelper::isWindowsVersionAtLeast(6, 3) // Windows 8.1 || askForReboot) { wchar_t captionBuf[255]; - LoadStringW(hInstance, IDS_SHOULD_REBOOT_CAPTION, captionBuf, sizeof(captionBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_SHOULD_REBOOT_CAPTION, captionBuf, sizeof(captionBuf) / sizeof(wchar_t)); wchar_t stringBuf[255]; - LoadStringW(hInstance, IDS_SHOULD_REBOOT, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); - if(MessageBoxW(hDlg, stringBuf, captionBuf, MB_ICONQUESTION | MB_YESNO) == IDYES) + LoadStringW(hInstance, IDS_SHOULD_REBOOT, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); + if (MessageBoxW(hDlg, stringBuf, captionBuf, MB_ICONQUESTION | MB_YESNO) == IDYES) { HANDLE tokenHandle; - if(OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tokenHandle)) + if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tokenHandle)) { LUID luid; - if(LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &luid)) + if (LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &luid)) { TOKEN_PRIVILEGES tp; tp.PrivilegeCount = 1; tp.Privileges[0].Luid = luid; tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - if(AdjustTokenPrivileges(tokenHandle, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL)) + if (AdjustTokenPrivileges(tokenHandle, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL)) InitiateShutdownW(NULL, NULL, 0, SHUTDOWN_RESTART | SHUTDOWN_GRACE_OVERRIDE, SHTDN_REASON_MAJOR_APPLICATION | SHTDN_REASON_MINOR_MAINTENANCE); } @@ -431,11 +431,11 @@ bool Configurator::isAnySelected() { bool anySelected = false; - for(int index = 0; index <= 1; index++) + for (int index = 0; index <= 1; index++) { HWND deviceList = deviceLists[index]; - for(int i = 0; i < ListView_GetItemCount(deviceList); i++) + for (int i = 0; i < ListView_GetItemCount(deviceList); i++) { LVITEM item; item.iItem = i; @@ -443,7 +443,7 @@ bool Configurator::isAnySelected() item.mask = LVIF_PARAM; ListView_GetItem(deviceList, &item); DeviceAPOInfo apoInfo = apoInfos[index][item.lParam]; - if(ListView_GetCheckState(deviceList, i) != 0) + if (ListView_GetCheckState(deviceList, i) != 0) { anySelected = true; break; @@ -458,11 +458,11 @@ bool Configurator::isChanged() { bool changed = false; - for(int index = 0; index <= 1; index++) + for (int index = 0; index <= 1; index++) { HWND deviceList = deviceLists[index]; - for(int i = 0; i < ListView_GetItemCount(deviceList); i++) + for (int i = 0; i < ListView_GetItemCount(deviceList); i++) { LVITEM item; item.iItem = i; @@ -470,7 +470,7 @@ bool Configurator::isChanged() item.mask = LVIF_PARAM; ListView_GetItem(deviceList, &item); DeviceAPOInfo apoInfo = apoInfos[index][item.lParam]; - if((ListView_GetCheckState(deviceList, i) != 0) != apoInfo.isInstalled + if ((ListView_GetCheckState(deviceList, i) != 0) != apoInfo.isInstalled || ListView_GetCheckState(deviceList, i) && apoInfo.isInstalled && (apoInfo.canBeUpgraded() || apoInfo.hasChanges() || apoInfo.isEnhancementsDisabled)) { changed = true; @@ -486,11 +486,11 @@ bool Configurator::hasUpgrades() { bool hasUpgrades = false; - for(int index = 0; index <= 1; index++) + for (int index = 0; index <= 1; index++) { HWND deviceList = deviceLists[index]; - for(int i = 0; i < ListView_GetItemCount(deviceList); i++) + for (int i = 0; i < ListView_GetItemCount(deviceList); i++) { LVITEM item; item.iItem = i; @@ -498,7 +498,7 @@ bool Configurator::hasUpgrades() item.mask = LVIF_PARAM; ListView_GetItem(deviceList, &item); DeviceAPOInfo apoInfo = apoInfos[index][item.lParam]; - if(ListView_GetCheckState(deviceList, i) && apoInfo.isInstalled && (apoInfo.canBeUpgraded() || apoInfo.isEnhancementsDisabled)) + if (ListView_GetCheckState(deviceList, i) && apoInfo.isInstalled && (apoInfo.canBeUpgraded() || apoInfo.isEnhancementsDisabled)) { hasUpgrades = true; break; @@ -536,15 +536,15 @@ void Configurator::expandTroubleShooting(bool expand) WINDOWINFO windowInfo; GetWindowInfo(hDlg, &windowInfo); int height = expand ? 250 : 209; - RECT rect={0, 0, 401, height}; + 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); + 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}; + 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); } @@ -555,32 +555,32 @@ void Configurator::updateList(int listIndex, int itemIndex) int itemCount = ListView_GetItemCount(deviceList); - if(apoInfos[listIndex].size() == itemCount) + 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 && apoInfo.isEnhancementsDisabled) + 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 && apoInfo.isEnhancementsDisabled) LoadStringW(hInstance, IDS_ENHANCEMENTS_WILL_BE_ENABLED, 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 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)); + LoadStringW(hInstance, IDS_CAN_BE_INSTALLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); - if(apoInfo.isDefaultDevice) + if (apoInfo.isDefaultDevice) { wstring statusText = stringBuf; - LoadStringW(hInstance, IDS_DEFAULT_DEVICE, stringBuf, sizeof(stringBuf)/sizeof(wchar_t)); + LoadStringW(hInstance, IDS_DEFAULT_DEVICE, stringBuf, sizeof(stringBuf) / sizeof(wchar_t)); statusText = wstring(stringBuf) + L", " + statusText; ListView_SetItemText(deviceList, itemIndex, 2, const_cast(statusText.c_str())); @@ -600,7 +600,7 @@ void Configurator::updateButtons(int listIndex) wchar_t stringBuf[255]; bool changed = isChanged(); - if(changed || !isAnySelected()) + if (changed || !isAnySelected()) { ShowWindow(okButton, SW_SHOW); EnableWindow(okButton, changed); @@ -622,10 +622,10 @@ void Configurator::updateButtons(int listIndex) bool hasOriginalAPOPreMix = true; bool hasOriginalAPOPostMix = true; DeviceAPOInfo::InstallState installState; - if(selectedCount == 1) + if (selectedCount == 1) { int selectedIndex = ListView_GetNextItem(deviceList, -1, LVNI_SELECTED); - if(selectedIndex != -1) + if (selectedIndex != -1) { enable = ListView_GetCheckState(deviceList, selectedIndex) != 0; @@ -651,7 +651,7 @@ void Configurator::updateButtons(int listIndex) Button_SetCheck(useOriginalAPOPreMix, installState.useOriginalAPOPreMix && hasOriginalAPOPreMix); Button_SetCheck(useOriginalAPOPostMix, installState.useOriginalAPOPostMix && hasOriginalAPOPostMix); - if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1 + if (RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1 ComboBox_SetCurSel(installModeComboBox, installState.installMode); expandTroubleShooting(Button_GetCheck(toggleTroubleShooting) != 0); @@ -660,9 +660,9 @@ void Configurator::updateButtons(int listIndex) INT_PTR CALLBACK dlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); int APIENTRY wWinMain(HINSTANCE hInstance, - HINSTANCE /* hPrevInstance */, - LPWSTR lpCmdLine, - int nCmdShow) + HINSTANCE /* hPrevInstance */, + LPWSTR lpCmdLine, + int nCmdShow) { CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -673,17 +673,17 @@ int APIENTRY wWinMain(HINSTANCE hInstance, int result = 0; - if(wcscmp(lpCmdLine, L"/u") == 0) + if (wcscmp(lpCmdLine, L"/u") == 0) { - for(int index = 0; index <= 1; index++) + for (int index = 0; index <= 1; index++) { vector apoInfos = DeviceAPOInfo::loadAllInfos(index == 1); - for(vector::iterator it = apoInfos.begin(); it != apoInfos.end(); it++) + for (vector::iterator it = apoInfos.begin(); it != apoInfos.end(); it++) { try { - if(it->isInstalled) + if (it->isInstalled) it->uninstall(); } catch (RegistryException e) @@ -699,7 +699,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, configurator = new Configurator(hInstance, lpCmdLine); DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAINWINDOW), GetDesktopWindow(), dlgProc); } - + CoUninitialize(); return result; @@ -716,7 +716,7 @@ INT_PTR CALLBACK dlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) return (INT_PTR)TRUE; case WM_COMMAND: - if(configurator->onButtonClicked(LOWORD(wParam))) + if (configurator->onButtonClicked(LOWORD(wParam))) { EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; diff --git a/Configurator/Configurator.h b/Configurator/Configurator.h index 26504ef..86d48c4 100644 --- a/Configurator/Configurator.h +++ b/Configurator/Configurator.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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. */ #pragma once diff --git a/DeviceAPOInfo.cpp b/DeviceAPOInfo.cpp index c9f369d..a72fe9d 100644 --- a/DeviceAPOInfo.cpp +++ b/DeviceAPOInfo.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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 "stdafx.h" @@ -73,12 +73,12 @@ vector DeviceAPOInfo::loadAllInfos(bool input) vector result; vector deviceGuidStrings = RegistryHelper::enumSubKeys(input ? captureKeyPath : renderKeyPath); wstring defaultDeviceGuid = getDefaultDevice(input); - for(vector::iterator it = deviceGuidStrings.begin(); it != deviceGuidStrings.end(); it++) + for (vector::iterator it = deviceGuidStrings.begin(); it != deviceGuidStrings.end(); it++) { wstring deviceGuidString = *it; DeviceAPOInfo info; - if(info.load(deviceGuidString, defaultDeviceGuid)) + if (info.load(deviceGuidString, defaultDeviceGuid)) { info.selectedInstallState = info.currentInstallState; result.push_back(info); @@ -94,20 +94,20 @@ wstring DeviceAPOInfo::getDefaultDevice(bool input, int role) IMMDeviceEnumerator* enumerator = NULL; HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&enumerator); - if(SUCCEEDED(hr)) + if (SUCCEEDED(hr)) { IMMDevice* endPoint = NULL; hr = enumerator->GetDefaultAudioEndpoint(input ? eCapture : eRender, (ERole)role, &endPoint); - if(SUCCEEDED(hr)) + if (SUCCEEDED(hr)) { IPropertyStore* propertyStore = NULL; hr = endPoint->OpenPropertyStore(STGM_READ, &propertyStore); - if(SUCCEEDED(hr)) + if (SUCCEEDED(hr)) { PROPVARIANT variant; PropVariantInit(&variant); hr = propertyStore->GetValue(guidPropertyKey, &variant); - if(SUCCEEDED(hr)) + if (SUCCEEDED(hr)) { result = variant.pwszVal; PropVariantClear(&variant); @@ -142,16 +142,16 @@ bool DeviceAPOInfo::checkAPORegistration(bool fix) bool result = true; if (!RegistryHelper::keyExists(apoRegistrationKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID)) - || !RegistryHelper::keyExists(apoRegistrationKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID)) - || !RegistryHelper::keyExists(clsidKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID)) - || !RegistryHelper::keyExists(clsidKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID))) + || !RegistryHelper::keyExists(apoRegistrationKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID)) + || !RegistryHelper::keyExists(clsidKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID)) + || !RegistryHelper::keyExists(clsidKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID))) { result = false; if (fix) { wchar_t path[MAX_PATH]; - if(GetModuleFileNameW(NULL, path, MAX_PATH) != 0) + if (GetModuleFileNameW(NULL, path, MAX_PATH) != 0) { PathRemoveFileSpecW(path); wstring params = wstring(L"/s \"") + path + L"\\EqualizerAPO.dll\""; @@ -166,7 +166,7 @@ bool DeviceAPOInfo::checkAPORegistration(bool fix) bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid) { wstring keyPath; - if(RegistryHelper::keyExists(renderKeyPath L"\\" + deviceGuid)) + if (RegistryHelper::keyExists(renderKeyPath L"\\" + deviceGuid)) { keyPath = renderKeyPath L"\\" + deviceGuid; isInput = false; @@ -178,7 +178,7 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid) } unsigned long deviceState = RegistryHelper::readDWORDValue(keyPath, L"DeviceState"); - if(deviceState & DEVICE_STATE_NOTPRESENT) + if (deviceState & DEVICE_STATE_NOTPRESENT) return false; this->deviceGuid = deviceGuid; @@ -189,35 +189,35 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid) channelCount = 0; sampleRate = 0; channelMask = 0; - if(RegistryHelper::valueExists(keyPath + L"\\Properties", formatValueName)) + if (RegistryHelper::valueExists(keyPath + L"\\Properties", formatValueName)) { std::vector format = RegistryHelper::readBinaryValue(keyPath + L"\\Properties", formatValueName); - if(format.size() >= sizeof(WAVEFORMATEX) + 8) + if (format.size() >= sizeof(WAVEFORMATEX) + 8) { WAVEFORMATEX* waveFormat = (WAVEFORMATEX*)&format[8]; channelCount = waveFormat->nChannels; sampleRate = waveFormat->nSamplesPerSec; - if(waveFormat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) + if (waveFormat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { WAVEFORMATEXTENSIBLE* waveFormatExtensible = (WAVEFORMATEXTENSIBLE*)waveFormat; channelMask = waveFormatExtensible->dwChannelMask; } } } - if(channelMask == 0 && RegistryHelper::valueExists(keyPath + L"\\Properties", channelMaskValueName)) + if (channelMask == 0 && RegistryHelper::valueExists(keyPath + L"\\Properties", channelMaskValueName)) channelMask = RegistryHelper::readDWORDValue(keyPath + L"\\Properties", channelMaskValueName); - if(defaultDeviceGuid == L"") + if (defaultDeviceGuid == L"") defaultDeviceGuid = getDefaultDevice(isInput); GUID guid1, guid2; - if(SUCCEEDED(CLSIDFromString(deviceGuid.c_str(), &guid1)) && SUCCEEDED(CLSIDFromString(defaultDeviceGuid.c_str(), &guid2))) + if (SUCCEEDED(CLSIDFromString(deviceGuid.c_str(), &guid1)) && SUCCEEDED(CLSIDFromString(defaultDeviceGuid.c_str(), &guid2))) isDefaultDevice = (guid1 == guid2) != 0; else isDefaultDevice = false; isEnhancementsDisabled = false; - if(RegistryHelper::keyExists(keyPath + L"\\FxProperties") && RegistryHelper::valueExists(keyPath + L"\\FxProperties", disableEnhancementsValueName)) + if (RegistryHelper::keyExists(keyPath + L"\\FxProperties") && RegistryHelper::valueExists(keyPath + L"\\FxProperties", disableEnhancementsValueName)) isEnhancementsDisabled = RegistryHelper::readDWORDValue(keyPath + L"\\FxProperties", disableEnhancementsValueName) != 0; isInstalled = false; @@ -230,16 +230,16 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid) currentInstallState.useOriginalAPOPreMix = true; currentInstallState.useOriginalAPOPostMix = !isInput; - if(!RegistryHelper::keyExists(keyPath + L"\\FxProperties")) + if (!RegistryHelper::keyExists(keyPath + L"\\FxProperties")) { - for(int i = 0; i < allGuidValueNameCount; i++) + for (int i = 0; i < allGuidValueNameCount; i++) originalApoGuids[i] = APOGUID_NOKEY; } else { - for(int i = 0; i < allGuidValueNameCount; i++) + for (int i = 0; i < allGuidValueNameCount; i++) { - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i])) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i])) originalApoGuids[i] = RegistryHelper::readValue(keyPath + L"\\FxProperties", allGuidValueNames[i]); else originalApoGuids[i] = APOGUID_NOVALUE; @@ -247,18 +247,18 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid) bool found = false; bool foundAt[allGuidValueNameCount]; - for(int i = 0; i < allGuidValueNameCount; i++) + for (int i = 0; i < allGuidValueNameCount; i++) { foundAt[i] = false; - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i])) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i])) { wstring apoGuidString = RegistryHelper::readValue(keyPath + L"\\FxProperties", allGuidValueNames[i]); GUID apoGuid; - if(SUCCEEDED(CLSIDFromString(apoGuidString.c_str(), &apoGuid))) + if (SUCCEEDED(CLSIDFromString(apoGuidString.c_str(), &apoGuid))) { - if(apoGuid == EQUALIZERAPO_PRE_MIX_GUID || apoGuid == EQUALIZERAPO_POST_MIX_GUID) + if (apoGuid == EQUALIZERAPO_PRE_MIX_GUID || apoGuid == EQUALIZERAPO_POST_MIX_GUID) { foundAt[i] = true; found = true; @@ -267,16 +267,16 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid) } } - if(found) + if (found) { isInstalled = true; - if(RegistryHelper::keyExists(childApoPath L"\\" + deviceGuid)) + if (RegistryHelper::keyExists(childApoPath L"\\" + deviceGuid)) { - if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, versionValueName)) + if (RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, versionValueName)) { version = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, versionValueName); - if(version != installVersion) + if (version != installVersion) throw RegistryException(L"Unsupported version of APO installation detected! Please uninstall newer Equalizer APO before using this version of Configurator."); } else @@ -284,37 +284,37 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid) version = L"1"; } - for(int i = 0; i < allGuidValueNameCount; i++) + for (int i = 0; i < allGuidValueNameCount; i++) { - if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, allGuidValueNames[i])) + if (RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, allGuidValueNames[i])) originalApoGuids[i] = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, allGuidValueNames[i]); } - if(version == installVersion) + if (version == installVersion) { - if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName)) + if (RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName)) preMixChildGuid = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName); - if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, postMixChildGuidValueName)) + 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"") + if (preMixChildGuid == L"") currentInstallState.useOriginalAPOPreMix = false; - if(postMixChildGuid == L"") + if (postMixChildGuid == L"") currentInstallState.useOriginalAPOPostMix = false; - if(foundAt[LFX_INDEX] || foundAt[GFX_INDEX]) + if (foundAt[LFX_INDEX] || foundAt[GFX_INDEX]) currentInstallState.installMode = INSTALL_LFX_GFX; - else if(foundAt[EFX_INDEX]) + else if (foundAt[EFX_INDEX]) currentInstallState.installMode = INSTALL_SFX_EFX; - else if(foundAt[SFX_INDEX] || foundAt[MFX_INDEX]) + else if (foundAt[SFX_INDEX] || foundAt[MFX_INDEX]) currentInstallState.installMode = INSTALL_SFX_MFX; } else { - if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, lfxGuidValueName)) + if (RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, lfxGuidValueName)) { preMixChildGuid = originalApoGuids[0]; postMixChildGuid = originalApoGuids[1]; @@ -326,14 +326,14 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid) } } } - else if(RegistryHelper::valueExists(childApoPath, deviceGuid)) + else if (RegistryHelper::valueExists(childApoPath, deviceGuid)) { - for(int i = 0; i < allGuidValueNameCount; i++) + for (int i = 0; i < allGuidValueNameCount; i++) { - if(foundAt[i]) + if (foundAt[i]) { originalApoGuids[i] = RegistryHelper::readValue(childApoPath, deviceGuid); - if(i == LFX_INDEX || i == SFX_INDEX) + if (i == LFX_INDEX || i == SFX_INDEX) preMixChildGuid = originalApoGuids[i]; else postMixChildGuid = originalApoGuids[i]; @@ -365,29 +365,29 @@ bool DeviceAPOInfo::isExperimental() wstring DeviceAPOInfo::getOriginalAPOPreMix() { wstring guid; - switch(selectedInstallState.installMode) + switch (selectedInstallState.installMode) { case INSTALL_LFX_GFX: guid = originalApoGuids[LFX_INDEX]; - if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1 + if (RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1 { - if(originalApoGuids[LFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[GFX_INDEX] == APOGUID_NOVALUE) + 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) + 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) + if (originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[EFX_INDEX] == APOGUID_NOVALUE) guid = originalApoGuids[LFX_INDEX]; break; } - if(guid == APOGUID_NOKEY || guid == APOGUID_NOVALUE) + if (guid == APOGUID_NOKEY || guid == APOGUID_NOVALUE) guid = L""; return guid; @@ -396,29 +396,29 @@ wstring DeviceAPOInfo::getOriginalAPOPreMix() wstring DeviceAPOInfo::getOriginalAPOPostMix() { wstring guid; - switch(selectedInstallState.installMode) + switch (selectedInstallState.installMode) { case INSTALL_LFX_GFX: guid = originalApoGuids[GFX_INDEX]; - if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1 + if (RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1 { - if(originalApoGuids[LFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[GFX_INDEX] == APOGUID_NOVALUE) + 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) + 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) + if (originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[EFX_INDEX] == APOGUID_NOVALUE) guid = originalApoGuids[GFX_INDEX]; break; } - if(guid == APOGUID_NOKEY || guid == APOGUID_NOVALUE) + if (guid == APOGUID_NOKEY || guid == APOGUID_NOVALUE) guid = L""; return guid; @@ -426,25 +426,25 @@ wstring DeviceAPOInfo::getOriginalAPOPostMix() void DeviceAPOInfo::install() { - if(!selectedInstallState.installPreMix && !selectedInstallState.installPostMix) + if (!selectedInstallState.installPreMix && !selectedInstallState.installPostMix) return; RegistryHelper::createKey(childApoPath); RegistryHelper::createKey(childApoPath L"\\" + deviceGuid); wstring keyPath; - if(!isInput) + if (!isInput) keyPath = renderKeyPath L"\\" + deviceGuid; else keyPath = captureKeyPath L"\\" + deviceGuid; - if(!RegistryHelper::keyExists(keyPath + L"\\FxProperties")) + if (!RegistryHelper::keyExists(keyPath + L"\\FxProperties")) { try { RegistryHelper::createKey(keyPath + L"\\FxProperties"); } - catch(RegistryException e) + catch (RegistryException e) { // Permissions were not sufficient, so change them RegistryHelper::takeOwnership(keyPath); @@ -455,7 +455,7 @@ void DeviceAPOInfo::install() RegistryHelper::writeValue(keyPath + L"\\FxProperties", fxTitleValueName, L"Equalizer APO"); - for(int i = 0; i < allGuidValueNameCount; i++) + for (int i = 0; i < allGuidValueNameCount; i++) { RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, allGuidValueNames[i], APOGUID_NOKEY); } @@ -464,10 +464,10 @@ void DeviceAPOInfo::install() { vector valuenames; - for(int i = 0; i < allGuidValueNameCount; i++) + for (int i = 0; i < allGuidValueNameCount; i++) { wstring apoGuidString = APOGUID_NOVALUE; - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i])) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i])) { apoGuidString = RegistryHelper::readValue(keyPath + L"\\FxProperties", allGuidValueNames[i]); valuenames.push_back(allGuidValueNames[i]); @@ -476,115 +476,115 @@ void DeviceAPOInfo::install() RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, allGuidValueNames[i], apoGuidString); } - if(!valuenames.empty()) + if (!valuenames.empty()) RegistryHelper::saveToFile(keyPath + L"\\FxProperties", valuenames, - L"backup_" + StringHelper::replaceIllegalCharacters(deviceName) + L"_" + StringHelper::replaceIllegalCharacters(connectionName) + L".reg"); + L"backup_" + StringHelper::replaceIllegalCharacters(deviceName) + L"_" + StringHelper::replaceIllegalCharacters(connectionName) + L".reg"); } wstring preMixValue; wstring postMixValue; - if(selectedInstallState.useOriginalAPOPreMix) + if (selectedInstallState.useOriginalAPOPreMix) preMixValue = getOriginalAPOPreMix(); - if(selectedInstallState.useOriginalAPOPostMix) + 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.installMode == INSTALL_LFX_GFX) { - if(selectedInstallState.installPreMix) + if (selectedInstallState.installPreMix) RegistryHelper::writeValue(keyPath + L"\\FxProperties", lfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID)); - if(selectedInstallState.installPostMix && !isInput) + if (selectedInstallState.installPostMix && !isInput) RegistryHelper::writeValue(keyPath + L"\\FxProperties", gfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID)); - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxGuidValueName)) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxGuidValueName)) RegistryHelper::deleteValue(keyPath + L"\\FxProperties", sfxGuidValueName); - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", mfxGuidValueName)) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", mfxGuidValueName)) RegistryHelper::deleteValue(keyPath + L"\\FxProperties", mfxGuidValueName); - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", efxGuidValueName)) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", efxGuidValueName)) RegistryHelper::deleteValue(keyPath + L"\\FxProperties", efxGuidValueName); } - else if(selectedInstallState.installMode == INSTALL_SFX_MFX) + else if (selectedInstallState.installMode == INSTALL_SFX_MFX) { - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName)) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName)) RegistryHelper::deleteValue(keyPath + L"\\FxProperties", lfxGuidValueName); - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName)) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName)) RegistryHelper::deleteValue(keyPath + L"\\FxProperties", gfxGuidValueName); - if(selectedInstallState.installPreMix) + if (selectedInstallState.installPreMix) { RegistryHelper::writeValue(keyPath + L"\\FxProperties", sfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID)); - if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxProcessingModesValueName)) + if (!RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxProcessingModesValueName)) RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", sfxProcessingModesValueName, defaultProcessingModeValue); } - if(selectedInstallState.installPostMix && !isInput) + if (selectedInstallState.installPostMix && !isInput) { RegistryHelper::writeValue(keyPath + L"\\FxProperties", mfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID)); - if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", mfxProcessingModesValueName)) + 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) + else if (selectedInstallState.installMode == INSTALL_SFX_EFX) { - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName)) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName)) RegistryHelper::deleteValue(keyPath + L"\\FxProperties", lfxGuidValueName); - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName)) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName)) RegistryHelper::deleteValue(keyPath + L"\\FxProperties", gfxGuidValueName); - if(selectedInstallState.installPreMix) + if (selectedInstallState.installPreMix) { RegistryHelper::writeValue(keyPath + L"\\FxProperties", sfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID)); - if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxProcessingModesValueName)) + if (!RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxProcessingModesValueName)) RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", sfxProcessingModesValueName, defaultProcessingModeValue); } // don't change mfx - if(selectedInstallState.installPostMix && !isInput) + if (selectedInstallState.installPostMix && !isInput) { RegistryHelper::writeValue(keyPath + L"\\FxProperties", efxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID)); - if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", efxProcessingModesValueName)) + if (!RegistryHelper::valueExists(keyPath + L"\\FxProperties", efxProcessingModesValueName)) RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", efxProcessingModesValueName, defaultProcessingModeValue); } } // force-enable enhancements - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", disableEnhancementsValueName)) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", disableEnhancementsValueName)) RegistryHelper::deleteValue(keyPath + L"\\FxProperties", disableEnhancementsValueName); } void DeviceAPOInfo::uninstall() { wstring keyPath; - if(!isInput) + if (!isInput) keyPath = renderKeyPath L"\\" + deviceGuid; else keyPath = captureKeyPath L"\\" + deviceGuid; - if(originalApoGuids[0] == APOGUID_NOKEY) + if (originalApoGuids[0] == APOGUID_NOKEY) { RegistryHelper::deleteKey(keyPath + L"\\FxProperties"); } else { - for(int i = 0; i < allGuidValueNameCount; i++) + for (int i = 0; i < allGuidValueNameCount; i++) { - if(originalApoGuids[i] == APOGUID_NOVALUE) + if (originalApoGuids[i] == APOGUID_NOVALUE) { - if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i])) + if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i])) RegistryHelper::deleteValue(keyPath + L"\\FxProperties", allGuidValueNames[i]); } - else if(originalApoGuids[i] != L"") + else if (originalApoGuids[i] != L"") { RegistryHelper::writeValue(keyPath + L"\\FxProperties", allGuidValueNames[i], originalApoGuids[i]); } } } - if(RegistryHelper::valueExists(childApoPath, deviceGuid)) + if (RegistryHelper::valueExists(childApoPath, deviceGuid)) RegistryHelper::deleteValue(childApoPath, deviceGuid); - if(RegistryHelper::keyExists(childApoPath L"\\" + deviceGuid)) + if (RegistryHelper::keyExists(childApoPath L"\\" + deviceGuid)) RegistryHelper::deleteKey(childApoPath L"\\" + deviceGuid); - if(RegistryHelper::keyEmpty(childApoPath)) + if (RegistryHelper::keyEmpty(childApoPath)) RegistryHelper::deleteKey(childApoPath); } diff --git a/DeviceAPOInfo.h b/DeviceAPOInfo.h index ca20870..0edb345 100644 --- a/DeviceAPOInfo.h +++ b/DeviceAPOInfo.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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. */ #pragma once diff --git a/DllMain.cpp b/DllMain.cpp index 2aa51ca..136e7b0 100644 --- a/DllMain.cpp +++ b/DllMain.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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 "stdafx.h" @@ -33,7 +33,7 @@ static HINSTANCE hModule; BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, void* lpReserved) { - if(dwReason == DLL_PROCESS_ATTACH) + if (dwReason == DLL_PROCESS_ATTACH) ::hModule = hModule; return TRUE; @@ -41,7 +41,7 @@ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, void* lpReserved) STDAPI DllCanUnloadNow() { - if(EqualizerAPO::instCount == 0 && ClassFactory::lockCount == 0) + if (EqualizerAPO::instCount == 0 && ClassFactory::lockCount == 0) return S_OK; else return S_FALSE; @@ -49,11 +49,11 @@ STDAPI DllCanUnloadNow() STDAPI DllGetClassObject(const CLSID& clsid, const IID& iid, void** ppv) { - if(clsid != EQUALIZERAPO_POST_MIX_GUID && clsid != EQUALIZERAPO_PRE_MIX_GUID) + if (clsid != EQUALIZERAPO_POST_MIX_GUID && clsid != EQUALIZERAPO_PRE_MIX_GUID) return CLASS_E_CLASSNOTAVAILABLE; ClassFactory* factory = new ClassFactory(); - if(factory == NULL) + if (factory == NULL) return E_OUTOFMEMORY; HRESULT hr = factory->QueryInterface(iid, ppv); @@ -65,17 +65,17 @@ STDAPI DllGetClassObject(const CLSID& clsid, const IID& iid, void** ppv) STDAPI DllRegisterServer() { wchar_t filename[1024]; - GetModuleFileNameW(hModule, filename, sizeof(filename)/sizeof(wchar_t)); + GetModuleFileNameW(hModule, filename, sizeof(filename) / sizeof(wchar_t)); HRESULT hr = RegisterAPO(EqualizerAPO::regPostMixProperties); - if(FAILED(hr)) + if (FAILED(hr)) { UnregisterAPO(EQUALIZERAPO_POST_MIX_GUID); return hr; } hr = RegisterAPO(EqualizerAPO::regPreMixProperties); - if(FAILED(hr)) + if (FAILED(hr)) { UnregisterAPO(EQUALIZERAPO_POST_MIX_GUID); UnregisterAPO(EQUALIZERAPO_PRE_MIX_GUID); @@ -100,7 +100,7 @@ STDAPI DllRegisterServer() 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) + catch (RegistryException e) { UnregisterAPO(EQUALIZERAPO_POST_MIX_GUID); UnregisterAPO(EQUALIZERAPO_PRE_MIX_GUID); @@ -124,7 +124,7 @@ STDAPI DllUnregisterServer() RegistryHelper::deleteKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32"); RegistryHelper::deleteKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString); } - catch(RegistryException e) + catch (RegistryException e) { return E_FAIL; } diff --git a/Editor/AnalysisPlotScene.cpp b/Editor/AnalysisPlotScene.cpp index ce2c80a..f573c8d 100644 --- a/Editor/AnalysisPlotScene.cpp +++ b/Editor/AnalysisPlotScene.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -31,11 +31,11 @@ AnalysisPlotScene::AnalysisPlotScene(QObject* parent) void AnalysisPlotScene::setFreqData(fftwf_complex* freqData, int frameCount, unsigned sampleRate) { nodes.clear(); - for(int i = 0; i < frameCount / 2; i++) + for (int i = 0; i < frameCount / 2; i++) { float freq = (i * 1.0f / frameCount) * sampleRate; // GainIterator can't handle 0 Hz node - if(freq == 0.0f) + if (freq == 0.0f) freq = 0.001f; float gain = sqrt(freqData[i][0] * freqData[i][0] + freqData[i][1] * freqData[i][1]); float dbGain = log10(gain) * 20; diff --git a/Editor/AnalysisPlotScene.h b/Editor/AnalysisPlotScene.h index 93f43ef..5677510 100644 --- a/Editor/AnalysisPlotScene.h +++ b/Editor/AnalysisPlotScene.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/AnalysisPlotView.cpp b/Editor/AnalysisPlotView.cpp index 8afaa47..62664d0 100644 --- a/Editor/AnalysisPlotView.cpp +++ b/Editor/AnalysisPlotView.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -41,15 +41,15 @@ void AnalysisPlotView::drawBackground(QPainter* painter, const QRectF& rect) QPainterPath path; bool first = true; double lastDb = -1000; - for(int x = rect.left() - 1; x <= rect.right() + 1; x++) + for (int x = rect.left() - 1; x <= rect.right() + 1; x++) { double hz = s->xToHz(x); double db = gainIterator.gainAt(hz); double y = s->dbToY(db); - if(db == lastDb) + if (db == lastDb) y = floor(y) + 0.5; lastDb = db; - if(first) + if (first) { path.moveTo(x, y); first = false; @@ -64,7 +64,7 @@ void AnalysisPlotView::drawBackground(QPainter* painter, const QRectF& rect) path.lineTo(rect.left() - 1, rect.bottom() + 1); double thresholdY = s->dbToY(0); - if(rect.top() < thresholdY) + if (rect.top() < thresholdY) { QPainterPath rectPath; rectPath.addRect(rect.left(), rect.top(), rect.width(), min(thresholdY - rect.top(), rect.height())); diff --git a/Editor/AnalysisPlotView.h b/Editor/AnalysisPlotView.h index d838beb..6e772bf 100644 --- a/Editor/AnalysisPlotView.h +++ b/Editor/AnalysisPlotView.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/AnalysisThread.cpp b/Editor/AnalysisThread.cpp index b44c895..05177f2 100644 --- a/Editor/AnalysisThread.cpp +++ b/Editor/AnalysisThread.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -36,18 +36,18 @@ AnalysisThread::~AnalysisThread() wait(); - if(resultFreqData != NULL) + if (resultFreqData != NULL) fftwf_free(resultFreqData); - if(buf != NULL) + if (buf != NULL) delete buf; - if(buf2 != NULL) + if (buf2 != NULL) delete buf2; - if(timeData != NULL) + if (timeData != NULL) fftwf_free(timeData); - if(freqData != NULL) + if (freqData != NULL) fftwf_free(freqData); - if(planForward != NULL) + if (planForward != NULL) fftwf_destroy_plan(planForward); } @@ -115,12 +115,12 @@ int AnalysisThread::getProcessedFrames() const void AnalysisThread::run() { - while(true) + while (true) { mutex.lock(); - if(!quit && this->frameCount == 0) + if (!quit && this->frameCount == 0) condition.wait(&mutex); - if(quit) + if (quit) { mutex.unlock(); break; @@ -138,13 +138,13 @@ void AnalysisThread::run() timer.start(); unsigned channelCount = device.channelCount; - if(channelMask != 0 && channelMask != device.channelMask) + if (channelMask != 0 && channelMask != device.channelMask) { channelCount = 0; - for(int i = 0; i < 31; i++) + for (int i = 0; i < 31; i++) { int channelPos = 1 << i; - if(channelMask & channelPos) + if (channelMask & channelPos) channelCount++; } } @@ -157,31 +157,31 @@ void AnalysisThread::run() engine.initialize(sampleRate, channelCount, channelCount, channelCount, channelMask, frameCount, configPath.toStdWString()); double initializationTime = (timer.nsecsElapsed() - startTime) / 1e6; - if(frameCount != lastFrameCount || channelCount != lastChannelCount) + if (frameCount != lastFrameCount || channelCount != lastChannelCount) { - if(buf != NULL) + if (buf != NULL) delete buf; buf = new float[frameCount * channelCount]; memset(buf, 0, frameCount * channelCount * sizeof(float)); - if(buf2 != NULL) + if (buf2 != NULL) delete buf2; buf2 = new float[frameCount * channelCount]; } - for(unsigned i = 0; i < channelCount; i++) + for (unsigned i = 0; i < channelCount; i++) buf[i] = 1.0f; - if(frameCount != lastFrameCount) + if (frameCount != lastFrameCount) { - if(timeData != NULL) + if (timeData != NULL) fftwf_free(timeData); timeData = fftwf_alloc_real(frameCount); - if(freqData != NULL) + if (freqData != NULL) fftwf_free(freqData); freqData = fftwf_alloc_complex(frameCount); - if(planForward != NULL) + if (planForward != NULL) fftwf_destroy_plan(planForward); planForward = fftwf_plan_dft_r2c_1d(frameCount, timeData, freqData, FFTW_ESTIMATE); } @@ -193,50 +193,50 @@ void AnalysisThread::run() int startFrame = -1; double processingTime = 0.0; int processedFrames = 0; - while(true) + while (true) { qint64 startTime = timer.nsecsElapsed(); engine.process(buf2, buf, frameCount); processingTime += (timer.nsecsElapsed() - startTime) / 1e6; processedFrames += frameCount; - if(startFrame != -1) + if (startFrame != -1) { - for(int i = 0; i < startFrame; i++) + for (int i = 0; i < startFrame; i++) { timeData[frameCount - startFrame + i] = buf2[i * channelCount + channelIndex]; } break; } - for(int i = 0; i < frameCount; i++) + for (int i = 0; i < frameCount; i++) { float s = buf2[i * channelCount + channelIndex]; - if(abs(s) > 1e-5f) + if (abs(s) > 1e-5f) { startFrame = i; break; } } - if(startFrame != -1) + if (startFrame != -1) { - for(int i = 0; i < frameCount - startFrame; i++) + for (int i = 0; i < frameCount - startFrame; i++) { timeData[i] = buf2[(startFrame + i) * channelCount + channelIndex]; } - if(startFrame == 0) + if (startFrame == 0) break; } - if(latency == 0) + if (latency == 0) { - for(unsigned i = 0; i < channelCount; i++) + for (unsigned i = 0; i < channelCount; i++) buf[i] = 0.0f; } - if(startFrame == -1) + if (startFrame == -1) latency += frameCount; } latency += startFrame; @@ -245,19 +245,19 @@ void AnalysisThread::run() double peakGain = -DBL_MAX; - for(int i = 0; i < frameCount; i++) + for (int i = 0; i < frameCount; i++) { float sqrGain = freqData[i][0] * freqData[i][0] + freqData[i][1] * freqData[i][1]; - if(sqrGain > peakGain) + if (sqrGain > peakGain) peakGain = sqrGain; } peakGain = sqrt(peakGain); peakGain = log10(peakGain) * 20.0; mutex.lock(); - if(this->freqDataLength != frameCount) + if (this->freqDataLength != frameCount) { - if(resultFreqData != NULL) + if (resultFreqData != NULL) fftwf_free(resultFreqData); resultFreqData = fftwf_alloc_complex(frameCount); } diff --git a/Editor/AnalysisThread.h b/Editor/AnalysisThread.h index ecfa017..907ffd8 100644 --- a/Editor/AnalysisThread.h +++ b/Editor/AnalysisThread.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/Editor.pro b/Editor/Editor.pro index e4ae66f..85b4131 100644 --- a/Editor/Editor.pro +++ b/Editor/Editor.pro @@ -111,8 +111,8 @@ SOURCES += main.cpp\ ../parser/RegistryFunctions.cpp \ ../parser/StringOperators.cpp \ AnalysisThread.cpp \ - widgets/ExponentialSpinBox.cpp \ - FilterTableMimeData.cpp + widgets/ExponentialSpinBox.cpp \ + FilterTableMimeData.cpp HEADERS += \ ../helpers/LogHelper.h \ @@ -212,8 +212,8 @@ HEADERS += \ ../parser/RegistryFunctions.h \ ../parser/StringOperators.h \ AnalysisThread.h \ - widgets/ExponentialSpinBox.h \ - FilterTableMimeData.h + widgets/ExponentialSpinBox.h \ + FilterTableMimeData.h FORMS += \ guis/PreampFilterGUI.ui \ @@ -254,4 +254,4 @@ TRANSLATIONS += translations/Editor_de.ts RC_ICONS = icons/accessories-text-editor.ico -DISTFILES += +DISTFILES += ../uncrustify.cfg diff --git a/Editor/FilterTable.cpp b/Editor/FilterTable.cpp index 38fcf49..65aebb8 100644 --- a/Editor/FilterTable.cpp +++ b/Editor/FilterTable.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 @@ -56,8 +56,8 @@ using namespace std; -FilterTable::FilterTable(MainWindow* mainWindow, QWidget *parent) : - QWidget(parent), mainWindow(mainWindow) +FilterTable::FilterTable(MainWindow* mainWindow, QWidget* parent) + : QWidget(parent), mainWindow(mainWindow) { gridLayout = new QGridLayout(this); @@ -88,7 +88,7 @@ void FilterTable::initialize(QScrollArea* scrollArea, const QList this->outputDevices = outputDevices; this->inputDevices = inputDevices; - for(IFilterGUIFactory* factory : factories) + for (IFilterGUIFactory* factory : factories) factory->initialize(this); } @@ -97,7 +97,7 @@ void FilterTable::updateDeviceAndChannelMask(DeviceAPOInfo* selectedDevice, int this->selectedDevice = selectedDevice; this->selectedChannelMask = channelMask; - if(!items.empty()) + if (!items.empty()) updateGuis(); } @@ -106,9 +106,9 @@ void FilterTable::updateGuis() QElapsedTimer timer; timer.start(); - for(Item* item : items) + for (Item* item : items) { - if(item->gui != NULL) + if (item->gui != NULL) { item->prefs.clear(); item->gui->storePreferences(item->prefs); @@ -117,12 +117,12 @@ void FilterTable::updateGuis() delete layout(); - for(QObject* object : children()) + for (QObject* object : children()) { - if(object != insertArrow) + if (object != insertArrow) { QWidget* widget = qobject_cast(object); - if(widget != NULL) + if (widget != NULL) widget->setVisible(false); object->deleteLater(); } @@ -137,16 +137,16 @@ void FilterTable::updateGuis() gridLayout->setColumnStretch(0, 0); gridLayout->setColumnStretch(1, 1); - for(IFilterGUIFactory* factory : factories) + for (IFilterGUIFactory* factory : factories) factory->startOfFile(configPath); int row = 0; - for(Item* item : items) + for (Item* item : items) { QString line = item->text; IFilterGUI* gui = NULL; int pos = line.indexOf(':'); - if(pos != -1) + if (pos != -1) { QString key = line.mid(0, pos); QString value = line.mid(pos + 1); @@ -156,17 +156,17 @@ void FilterTable::updateGuis() QString factoryKey = key; QString factoryValue = value; - for(IFilterGUIFactory* factory : factories) + for (IFilterGUIFactory* factory : factories) { gui = factory->createFilterGUI(factoryKey, factoryValue); - if(gui != NULL || factoryKey == "") + if (gui != NULL || factoryKey == "") break; } - if(gui != NULL) + if (gui != NULL) { - for(IFilterGUIFactory* factory : factories) + for (IFilterGUIFactory* factory : factories) { gui = factory->decorateFilterGUI(gui); } @@ -178,7 +178,7 @@ void FilterTable::updateGuis() item->gui = gui; - if(gui != NULL) + if (gui != NULL) { gui->loadPreferences(item->prefs); @@ -189,7 +189,7 @@ void FilterTable::updateGuis() row++; } - for(IFilterGUIFactory* factory : factories) + for (IFilterGUIFactory* factory : factories) factory->endOfFile(configPath); propagateChannels(); @@ -223,9 +223,9 @@ void FilterTable::propagateChannels() { vector channelNames = ChannelHelper::getChannelNames(selectedDevice->channelCount, selectedChannelMask); - for(Item* item : items) + for (Item* item : items) { - if(item->gui != NULL) + if (item->gui != NULL) item->gui->configureChannels(channelNames); } } @@ -233,7 +233,7 @@ void FilterTable::propagateChannels() QList FilterTable::getLines() { QList result; - for(Item* item : items) + for (Item* item : items) result.append(item->text); return result; @@ -246,7 +246,7 @@ void FilterTable::setLines(const QString& configPath, const QList& line qDeleteAll(items); items.clear(); - for(QString line : lines) + for (QString line : lines) { items.append(new Item(line)); } @@ -255,35 +255,35 @@ void FilterTable::setLines(const QString& configPath, const QList& line settings.beginGroup(QString(configPath).replace('\\', '|')); QVariant prefsValue = settings.value("rowPrefs"); QStringList prefLines; - if(prefsValue.isValid()) + if (prefsValue.isValid()) prefLines = prefsValue.toStringList(); - for(QString prefLine : prefLines) + for (QString prefLine : prefLines) { int index = prefLine.indexOf(':'); int lineNumber; - if(index != -1) + if (index != -1) lineNumber = prefLine.left(index).toInt(); QString prefCommand; QString prefString; - if(lineNumber > 0) + if (lineNumber > 0) { int index2 = prefLine.indexOf(':', index + 1); - if(index2 != -1) + if (index2 != -1) { prefCommand = prefLine.mid(index + 1, index2 - index - 1); prefString = prefLine.mid(index2 + 1); - if(lineNumber <= items.size()) + if (lineNumber <= items.size()) { Item* item = items[lineNumber - 1]; QString command; int index = item->text.indexOf(':'); - if(index != -1) + if (index != -1) command = item->text.left(index).trimmed(); - if(command == prefCommand) + if (command == prefCommand) item->prefs = QJsonDocument::fromJson(prefString.toUtf8()).toVariant().toMap(); } } @@ -292,7 +292,7 @@ void FilterTable::setLines(const QString& configPath, const QList& line setScrollOffsets(settings.value("scrollX", 0).toInt(), settings.value("scrollY", 0).toInt()); settings.endGroup(); - if(!items.isEmpty()) + if (!items.isEmpty()) { focused = items[0]; selectionStart = items[0]; @@ -310,7 +310,7 @@ FilterTable::Item* FilterTable::addLine(const QString& line, FilterTable::Item* { Item* newItem = new Item(line); - if(before != NULL) + if (before != NULL) { int index = items.indexOf(before); items.insert(index, newItem); @@ -337,21 +337,21 @@ QMenu* FilterTable::createAddPopupMenu() QMenu* rootMenu = new QMenu; pathMap[QStringList()] = rootMenu; - for(IFilterGUIFactory* f : factories) + for (IFilterGUIFactory* f : factories) { QList templates = f->createFilterTemplates(); - for(FilterTemplate t : templates) + for (FilterTemplate t : templates) { QMenu* menu = pathMap.value(t.getPath()); - if(menu == NULL) + if (menu == NULL) { QMenu* parentMenu = rootMenu; QStringList currentPath; - for(QString pathSegment : t.getPath()) + for (QString pathSegment : t.getPath()) { currentPath.append(pathSegment); menu = pathMap.value(currentPath); - if(menu == NULL) + if (menu == NULL) { menu = new QMenu(pathSegment); pathMap.insert(currentPath, menu); @@ -380,11 +380,11 @@ void FilterTable::copy() QString text; QList prefsList; bool first = true; - for(Item* item : items) + for (Item* item : items) { - if(selected.contains(item)) + if (selected.contains(item)) { - if(first) + if (first) first = false; else text += "\n"; @@ -393,7 +393,7 @@ void FilterTable::copy() } } - if(selected.size() > 0) + if (selected.size() > 0) { FilterTableMimeData* mimeData = new FilterTableMimeData; mimeData->setText(text); @@ -407,12 +407,12 @@ void FilterTable::paste() { QClipboard* clipboard = QApplication::clipboard(); const QMimeData* mimeData = clipboard->mimeData(); - if(mimeData->hasText()) + if (mimeData->hasText()) { int dropRow = items.size(); - for(int i = 0; i < items.size(); i++) + for (int i = 0; i < items.size(); i++) { - if(selected.contains(items[i])) + if (selected.contains(items[i])) { dropRow = i; break; @@ -423,21 +423,21 @@ void FilterTable::paste() QStringList textLines = text.split("\n"); QList prefsList; const FilterTableMimeData* filterTableMimeData = qobject_cast(mimeData); - if(filterTableMimeData != NULL) + if (filterTableMimeData != NULL) prefsList = filterTableMimeData->getPrefsList(); selected.clear(); focused = NULL; selectionStart = NULL; - for(int i = 0; i < textLines.size(); i++) + for (int i = 0; i < textLines.size(); i++) { QString line = textLines[i]; Item* item = new Item(line); - if(!prefsList.isEmpty()) + if (!prefsList.isEmpty()) item->prefs = prefsList[i]; selected.insert(item); items.insert(dropRow++, item); - if(focused == NULL) + if (focused == NULL) { focused = item; selectionStart = item; @@ -452,13 +452,13 @@ void FilterTable::paste() void FilterTable::deleteSelectedLines() { QList newItems; - for(Item* item : items) + for (Item* item : items) { - if(selected.contains(item)) + if (selected.contains(item)) { - if(item == focused) + if (item == focused) focused = NULL; - if(item == selectionStart) + if (item == selectionStart) selectionStart = NULL; delete item; } @@ -492,7 +492,7 @@ void FilterTable::addActionTriggered() QPoint p = toolBar->mapToGlobal(QPoint(rect.x(), rect.y() + rect.height())); QAction* action = menu->exec(p); addAction->setChecked(false); - if(action != NULL) + if (action != NULL) { FilterTemplate t = action->data().value(); QString line = t.getLine(); @@ -508,7 +508,7 @@ void FilterTable::openConfig(QString path) int FilterTable::getPreferredWidth() { - if(scrollArea == NULL) + if (scrollArea == NULL) return width(); return scrollArea->viewport()->width(); @@ -516,7 +516,7 @@ int FilterTable::getPreferredWidth() void FilterTable::updateSizeHints() { - for(int i = 0; i < items.size(); i++) + for (int i = 0; i < items.size(); i++) { FilterTableRow* tableRow = qobject_cast(gridLayout->itemAtPosition(i, 0)->widget()); tableRow->updateGeometry(); @@ -526,7 +526,7 @@ void FilterTable::updateSizeHints() QSize FilterTable::minimumSizeHint() const { QSize size = QWidget::minimumSizeHint(); - if(size.height() < minimumHeightHint) + if (size.height() < minimumHeightHint) size.setHeight(minimumHeightHint); return size; @@ -540,25 +540,25 @@ void FilterTable::setMinimumHeightHint(int height) void FilterTable::savePreferences() { - if(!configPath.isEmpty()) + if (!configPath.isEmpty()) { QStringList prefLines; - for(int i = 0; i < items.size(); i++) + for (int i = 0; i < items.size(); i++) { Item* item = items[i]; - if(item->gui != NULL) + if (item->gui != NULL) { item->prefs.clear(); item->gui->storePreferences(item->prefs); } - if(!item->prefs.isEmpty()) + if (!item->prefs.isEmpty()) { QString command; int index = item->text.indexOf(':'); - if(index != -1) + if (index != -1) command = item->text.left(index).trimmed(); QByteArray byteArray = QJsonDocument::fromVariant(item->prefs).toJson(QJsonDocument::Compact); @@ -584,26 +584,26 @@ void FilterTable::setScrollOffsets(int x, int y) void FilterTable::mousePressEvent(QMouseEvent* event) { - if(event->buttons() & Qt::LeftButton ) + if (event->buttons() & Qt::LeftButton) { int row = rowForPos(event->pos(), false); - if(row != -1) + if (row != -1) { Item* item = items[row]; - if(event->modifiers() & Qt::ControlModifier) + if (event->modifiers() & Qt::ControlModifier) { - if(!selected.remove(item)) + if (!selected.remove(item)) selected.insert(item); selectionStart = item; } - else if(event->modifiers() & Qt::ShiftModifier) + else if (event->modifiers() & Qt::ShiftModifier) { int startRow = items.indexOf(selectionStart); - if(startRow != -1) + if (startRow != -1) { selected.clear(); - for(int i = min(startRow, row); i <= max(startRow, row); i++) + for (int i = min(startRow, row); i <= max(startRow, row); i++) { selected.insert(items[i]); } @@ -611,7 +611,7 @@ void FilterTable::mousePressEvent(QMouseEvent* event) } else { - if(!selected.contains(item)) + if (!selected.contains(item)) { selected.clear(); selected.insert(item); @@ -634,40 +634,40 @@ void FilterTable::mousePressEvent(QMouseEvent* event) void FilterTable::mouseMoveEvent(QMouseEvent* event) { - if(event->buttons() & Qt::LeftButton) + if (event->buttons() & Qt::LeftButton) { - if((event->pos() - dragStartPos).manhattanLength() >= QApplication::startDragDistance()) + if ((event->pos() - dragStartPos).manhattanLength() >= QApplication::startDragDistance()) { QString text; QList prefsList; bool first = true; int i = 0; bool dragPosInside = false; - for(Item* item : items) + for (Item* item : items) { - if(selected.contains(item)) + if (selected.contains(item)) { - if(first) + if (first) first = false; else text += "\n"; text += item->text; - if(item->gui != NULL) + if (item->gui != NULL) item->gui->storePreferences(item->prefs); prefsList.append(item->prefs); - if(!dragPosInside) + if (!dragPosInside) { FilterTableRow* tableRow = qobject_cast(gridLayout->itemAtPosition(i, 0)->widget()); QRect rect = tableRow->getHeaderRect().translated(tableRow->pos()); - if(rect.contains(dragStartPos)) + if (rect.contains(dragStartPos)) dragPosInside = true; } } i++; } - if(selected.size() > 0 && dragPosInside) + if (selected.size() > 0 && dragPosInside) { FilterTableMimeData* mimeData = new FilterTableMimeData; mimeData->setText(text); @@ -679,21 +679,21 @@ void FilterTable::mouseMoveEvent(QMouseEvent* event) internalDrag = true; Qt::DropAction action = drag->exec(Qt::MoveAction | Qt::CopyAction); internalDrag = false; - if(action == Qt::MoveAction) + if (action == Qt::MoveAction) { - for(Item* item : selectedBefore) + for (Item* item : selectedBefore) { items.removeOne(item); - if(focused == item) + if (focused == item) focused = NULL; - if(selectionStart == item) + if (selectionStart == item) selectionStart = NULL; selected.remove(item); delete item; } } - if(action != Qt::IgnoreAction) + if (action != Qt::IgnoreAction) { emit linesChanged(); updateGuis(); @@ -707,9 +707,9 @@ void FilterTable::mouseMoveEvent(QMouseEvent* event) void FilterTable::dragEnterEvent(QDragEnterEvent* event) { - if(event->mimeData()->hasText()) + if (event->mimeData()->hasText()) { - if(event->keyboardModifiers() & Qt::ControlModifier) + if (event->keyboardModifiers() & Qt::ControlModifier) event->setDropAction(Qt::CopyAction); else event->setDropAction(Qt::MoveAction); @@ -721,9 +721,9 @@ void FilterTable::dragEnterEvent(QDragEnterEvent* event) void FilterTable::dragMoveEvent(QDragMoveEvent* event) { - if(event->mimeData()->hasText()) + if (event->mimeData()->hasText()) { - if(event->keyboardModifiers() & Qt::ControlModifier) + if (event->keyboardModifiers() & Qt::ControlModifier) event->setDropAction(Qt::CopyAction); else event->setDropAction(Qt::MoveAction); @@ -748,9 +748,9 @@ void FilterTable::dragLeaveEvent(QDragLeaveEvent* event) void FilterTable::dropEvent(QDropEvent* event) { const QMimeData* mimeData = event->mimeData(); - if(mimeData->hasText()) + if (mimeData->hasText()) { - if(event->keyboardModifiers() & Qt::ControlModifier) + if (event->keyboardModifiers() & Qt::ControlModifier) event->setDropAction(Qt::CopyAction); else event->setDropAction(Qt::MoveAction); @@ -759,25 +759,25 @@ void FilterTable::dropEvent(QDropEvent* event) QStringList textLines = text.split("\n"); QList prefsList; const FilterTableMimeData* filterTableMimeData = qobject_cast(mimeData); - if(filterTableMimeData != NULL) + if (filterTableMimeData != NULL) prefsList = filterTableMimeData->getPrefsList(); int dropRow = rowForPos(event->pos(), true); - if(dropRow == -1) + if (dropRow == -1) dropRow = items.size(); selected.clear(); focused = NULL; selectionStart = NULL; - for(int i = 0; i < textLines.size(); i++) + for (int i = 0; i < textLines.size(); i++) { QString line = textLines[i]; Item* item = new Item(line); - if(!prefsList.isEmpty()) + if (!prefsList.isEmpty()) item->prefs = prefsList[i]; selected.insert(item); items.insert(dropRow++, item); - if(focused == NULL) + if (focused == NULL) { focused = item; selectionStart = item; @@ -785,7 +785,7 @@ void FilterTable::dropEvent(QDropEvent* event) } event->accept(); - if(!internalDrag) + if (!internalDrag) { emit linesChanged(); updateGuis(); @@ -799,32 +799,32 @@ void FilterTable::dropEvent(QDropEvent* event) void FilterTable::keyPressEvent(QKeyEvent* event) { - if(event->key() == Qt::Key_Down || event->key() == Qt::Key_Up) + if (event->key() == Qt::Key_Down || event->key() == Qt::Key_Up) { - if(focused != NULL) + if (focused != NULL) { int row = items.indexOf(focused); - if(row != -1) + if (row != -1) { int newRow = row; - if(event->key() == Qt::Key_Down && row + 1 < items.size()) + if (event->key() == Qt::Key_Down && row + 1 < items.size()) newRow = row + 1; - else if(event->key() == Qt::Key_Up && row - 1 >= 0) + else if (event->key() == Qt::Key_Up && row - 1 >= 0) newRow = row - 1; - if(newRow != row) + if (newRow != row) { focused = items[newRow]; - if(event->modifiers() & Qt::ControlModifier) + if (event->modifiers() & Qt::ControlModifier) { } - else if(event->modifiers() & Qt::ShiftModifier) + else if (event->modifiers() & Qt::ShiftModifier) { int startRow = items.indexOf(selectionStart); - if(startRow != -1) + if (startRow != -1) { selected.clear(); - for(int i = min(startRow, newRow); i <= max(startRow, newRow); i++) + for (int i = min(startRow, newRow); i <= max(startRow, newRow); i++) { selected.insert(items[i]); } @@ -844,35 +844,35 @@ void FilterTable::keyPressEvent(QKeyEvent* event) } } - if(event->key() == Qt::Key_Space) + if (event->key() == Qt::Key_Space) { - if(!(event->modifiers() & Qt::ControlModifier) || !selected.remove(focused)) + if (!(event->modifiers() & Qt::ControlModifier) || !selected.remove(focused)) selected.insert(focused); update(); } - if(event->key() == Qt::Key_F2) + if (event->key() == Qt::Key_F2) { - if(focused != NULL) + if (focused != NULL) { int rowIndex = items.indexOf(focused); - if(rowIndex != -1) + if (rowIndex != -1) { QLayoutItem* layoutItem = gridLayout->itemAtPosition(rowIndex, 0); FilterTableRow* tableRow = qobject_cast(layoutItem->widget()); - if(tableRow != NULL) + if (tableRow != NULL) tableRow->editText(); } } } - if(event->key() == Qt::Key_Delete) + if (event->key() == Qt::Key_Delete) { deleteSelectedLines(); } } -void FilterTable::wheelEvent(QWheelEvent * event) +void FilterTable::wheelEvent(QWheelEvent* event) { scrollingNow = true; scrollStartPoint = event->globalPos(); @@ -880,34 +880,33 @@ void FilterTable::wheelEvent(QWheelEvent * event) QWidget::wheelEvent(event); } - bool FilterTable::eventFilter(QObject* obj, QEvent* event) { QEvent::Type type = event->type(); - if(scrollingNow) + if (scrollingNow) { - if(type == QEvent::Wheel) + if (type == QEvent::Wheel) { QWidget* widget = qobject_cast(obj); - if(widget != NULL) + if (widget != NULL) { - if(isAncestorOf(widget)) + if (isAncestorOf(widget)) { QApplication::sendEvent(parent(), event); return true; } } } - else if(type == QEvent::MouseMove) + else if (type == QEvent::MouseMove) { QMouseEvent* mouseEvent = (QMouseEvent*)event; - if((mouseEvent->globalPos() - scrollStartPoint).manhattanLength() > QApplication::startDragDistance()) + if ((mouseEvent->globalPos() - scrollStartPoint).manhattanLength() > QApplication::startDragDistance()) scrollingNow = false; } } - if(obj == scrollArea && type == QEvent::Resize) + if (obj == scrollArea && type == QEvent::Resize) { updateSizeHints(); } @@ -917,13 +916,13 @@ bool FilterTable::eventFilter(QObject* obj, QEvent* event) void FilterTable::showEvent(QShowEvent*) { - if(presetScrollX != -1) + if (presetScrollX != -1) { scrollArea->horizontalScrollBar()->setValue(presetScrollX); presetScrollX = -1; } - if(presetScrollY != -1) + if (presetScrollY != -1) { scrollArea->verticalScrollBar()->setValue(presetScrollY); presetScrollY = -1; @@ -933,12 +932,12 @@ void FilterTable::showEvent(QShowEvent*) void FilterTable::ensureRowVisible(int row) { QScrollBar* vScrollBar = scrollArea->verticalScrollBar(); - if(vScrollBar != NULL) + if (vScrollBar != NULL) { QRect rect = rowRect(row).toAlignedRect(); - if(rect.top() < vScrollBar->value()) + if (rect.top() < vScrollBar->value()) vScrollBar->setValue(max(0, rect.top())); - else if(rect.bottom() + 1 > vScrollBar->value() + scrollArea->viewport()->height()) + else if (rect.bottom() + 1 > vScrollBar->value() + scrollArea->viewport()->height()) vScrollBar->setValue(min(vScrollBar->maximum(), rect.bottom() + 1 - scrollArea->viewport()->height())); } } @@ -946,16 +945,16 @@ void FilterTable::ensureRowVisible(int row) int FilterTable::rowForPos(QPoint pos, bool insert) { int row = -1; - for(int i = 0; i < gridLayout->rowCount() - 2; i++) + for (int i = 0; i < gridLayout->rowCount() - 2; i++) { QRect rect = gridLayout->itemAtPosition(i, 0)->geometry(); int y; - if(insert) + if (insert) y = rect.center().y(); else y = rect.bottom(); - if(pos.y() <= y) + if (pos.y() <= y) { row = i; break; @@ -975,12 +974,12 @@ QRectF FilterTable::rowRect(int row) void FilterTable::disableWheelForWidgets() { QList widgets = findChildren(); - for(QWidget* widget : widgets) + for (QWidget* widget : widgets) { - if(qobject_cast(widget) || qobject_cast(widget) || qobject_cast(widget)) + if (qobject_cast(widget) || qobject_cast(widget) || qobject_cast(widget)) { widget->installEventFilter(new DisableWheelFilter(this, widget)); - if(widget->focusPolicy() == Qt::WheelFocus) + if (widget->focusPolicy() == Qt::WheelFocus) widget->setFocusPolicy(Qt::StrongFocus); } } diff --git a/Editor/FilterTable.h b/Editor/FilterTable.h index cf15e46..888589a 100644 --- a/Editor/FilterTable.h +++ b/Editor/FilterTable.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once @@ -39,7 +39,8 @@ class FilterTable : public QWidget { Q_OBJECT public: - struct Item { + struct Item + { Item() { } @@ -54,7 +55,7 @@ public: IFilterGUI* gui = NULL; }; - explicit FilterTable(MainWindow* mainWindow, QWidget *parent = 0); + explicit FilterTable(MainWindow* mainWindow, QWidget* parent = 0); void initialize(QScrollArea* scrollArea, const QList& outputDevices, const QList& inputDevices); void updateDeviceAndChannelMask(DeviceAPOInfo* selectedDevice, int selectedChannelMask); void updateGuis(); @@ -101,11 +102,11 @@ public slots: protected: void mousePressEvent(QMouseEvent* event) override; - void mouseMoveEvent(QMouseEvent *event) override; - void dragEnterEvent(QDragEnterEvent *event) override; - void dragMoveEvent(QDragMoveEvent *event) override; + void mouseMoveEvent(QMouseEvent* event) override; + void dragEnterEvent(QDragEnterEvent* event) override; + void dragMoveEvent(QDragMoveEvent* event) override; void dragLeaveEvent(QDragLeaveEvent* event) override; - void dropEvent(QDropEvent *event) override; + void dropEvent(QDropEvent* event) override; void keyPressEvent(QKeyEvent* event) override; void wheelEvent(QWheelEvent* event) override; bool eventFilter(QObject* obj, QEvent* event) override; @@ -144,7 +145,7 @@ template inline uint qHash(QList list) { uint hashValue = 0; - for(T t : list) + for (T t : list) hashValue = 31 * hashValue + qHash(t); return hashValue; diff --git a/Editor/FilterTableMimeData.cpp b/Editor/FilterTableMimeData.cpp index 9c8b30c..579fd6e 100644 --- a/Editor/FilterTableMimeData.cpp +++ b/Editor/FilterTableMimeData.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "FilterTableMimeData.h" diff --git a/Editor/FilterTableMimeData.h b/Editor/FilterTableMimeData.h index 1dabd88..b7330b7 100644 --- a/Editor/FilterTableMimeData.h +++ b/Editor/FilterTableMimeData.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/FilterTableRow.cpp b/Editor/FilterTableRow.cpp index ca09c24..be76456 100644 --- a/Editor/FilterTableRow.cpp +++ b/Editor/FilterTableRow.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -25,8 +25,8 @@ #include "FilterTableRow.h" #include "ui_FilterTableRow.h" -FilterTableRow::FilterTableRow(FilterTable* table, int number, FilterTable::Item* item, IFilterGUI* gui) : - QWidget(table), +FilterTableRow::FilterTableRow(FilterTable* table, int number, FilterTable::Item* item, IFilterGUI* gui) + : QWidget(table), ui(new Ui::FilterTableRow) { ui->setupUi(this); @@ -44,7 +44,7 @@ FilterTableRow::FilterTableRow(FilterTable* table, int number, FilterTable::Item ui->stackedWidget->setContentsMargins(0, 5, 0, 5); - if(gui != NULL) + if (gui != NULL) { connect(gui, SIGNAL(updateModel()), this, SLOT(updateModel())); ui->stackedWidget->addWidget(gui); @@ -70,7 +70,7 @@ QRect FilterTableRow::getHeaderRect() void FilterTableRow::editText() { - if(!ui->actionEditText->isChecked()) + if (!ui->actionEditText->isChecked()) ui->actionEditText->trigger(); } @@ -78,14 +78,14 @@ QSize FilterTableRow::sizeHint() const { QSize size = QWidget::minimumSizeHint(); int preferredWidth = table->getPreferredWidth(); - if(size.width() < preferredWidth) + if (size.width() < preferredWidth) size = QSize(preferredWidth, size.height()); return size; } void FilterTableRow::mouseDoubleClickEvent(QMouseEvent*) { - if(gui == NULL && ui->stackedWidget->currentIndex() == 1) + if (gui == NULL && ui->stackedWidget->currentIndex() == 1) ui->actionEditText->trigger(); } @@ -98,16 +98,16 @@ void FilterTableRow::paintEvent(QPaintEvent*) r = r.marginsAdded(QMarginsF(-1.5, -1.5, -1.5, -0.5)); QColor color; - if(table->getSelectedItems().contains(item)) + if (table->getSelectedItems().contains(item)) { - if(table->getFocusedItem() == item) + if (table->getFocusedItem() == item) color = QColor(44, 111, 222); else color = QColor(64, 136, 255); } else { - if(table->getFocusedItem() == item) + if (table->getFocusedItem() == item) color = QColor(160, 160, 160); else color = QColor(180, 180, 180); @@ -149,7 +149,7 @@ void FilterTableRow::on_actionAdd_triggered() QPoint p = ui->toolBar->mapToGlobal(QPoint(rect.x(), rect.y() + rect.height())); QAction* action = menu->exec(p); ui->actionAdd->setChecked(false); - if(action != NULL) + if (action != NULL) { FilterTemplate t = action->data().value(); QString line = t.getLine(); @@ -166,9 +166,9 @@ void FilterTableRow::on_actionRemove_triggered() void FilterTableRow::on_actionEditText_triggered(bool checked) { - if(checked) + if (checked) { - if(!lastEditTime.isValid() || lastEditTime.elapsed() > 100) + if (!lastEditTime.isValid() || lastEditTime.elapsed() > 100) { ui->lineEdit->setText(item->text); ui->stackedWidget->setCurrentIndex(0); @@ -183,9 +183,9 @@ void FilterTableRow::on_actionEditText_triggered(bool checked) void FilterTableRow::on_lineEdit_editingFinished() { - if(ui->stackedWidget->currentIndex() == 0 && !editingDone) + if (ui->stackedWidget->currentIndex() == 0 && !editingDone) { - if(ui->lineEdit->text() != item->text) + if (ui->lineEdit->text() != item->text) { editingDone = true; item->text = ui->lineEdit->text(); @@ -204,7 +204,7 @@ void FilterTableRow::on_lineEdit_editingFinished() void FilterTableRow::on_lineEdit_editingCanceled() { - if(ui->stackedWidget->currentIndex() == 0) + if (ui->stackedWidget->currentIndex() == 0) { // will cause editingFinished to be called, so prevent committing editingDone = true; diff --git a/Editor/FilterTableRow.h b/Editor/FilterTableRow.h index bcef0d8..589ff9c 100644 --- a/Editor/FilterTableRow.h +++ b/Editor/FilterTableRow.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -55,7 +55,7 @@ private slots: void on_lineEdit_editingCanceled(); private: - Ui::FilterTableRow *ui; + Ui::FilterTableRow* ui; FilterTable* table; FilterTable::Item* item; IFilterGUI* gui; diff --git a/Editor/FilterTemplate.cpp b/Editor/FilterTemplate.cpp index 9799b9c..cfd4063 100644 --- a/Editor/FilterTemplate.cpp +++ b/Editor/FilterTemplate.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "FilterTemplate.h" diff --git a/Editor/FilterTemplate.h b/Editor/FilterTemplate.h index 35f8ed3..917f3b5 100644 --- a/Editor/FilterTemplate.h +++ b/Editor/FilterTemplate.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/IFilterGUI.cpp b/Editor/IFilterGUI.cpp index 487bfeb..b365db1 100644 --- a/Editor/IFilterGUI.cpp +++ b/Editor/IFilterGUI.cpp @@ -1,26 +1,26 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "IFilterGUI.h" -IFilterGUI::IFilterGUI(QWidget* parent) : - QWidget(parent) +IFilterGUI::IFilterGUI(QWidget* parent) + : QWidget(parent) { } diff --git a/Editor/IFilterGUI.h b/Editor/IFilterGUI.h index 7f105a8..8167b2e 100644 --- a/Editor/IFilterGUI.h +++ b/Editor/IFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/IFilterGUIFactory.cpp b/Editor/IFilterGUIFactory.cpp index eb9b5d8..78b6f0f 100644 --- a/Editor/IFilterGUIFactory.cpp +++ b/Editor/IFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "IFilterGUIFactory.h" diff --git a/Editor/IFilterGUIFactory.h b/Editor/IFilterGUIFactory.h index e704db4..cc5e8b9 100644 --- a/Editor/IFilterGUIFactory.h +++ b/Editor/IFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/MainWindow.cpp b/Editor/MainWindow.cpp index a3812ed..f5937bd 100644 --- a/Editor/MainWindow.cpp +++ b/Editor/MainWindow.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -47,16 +47,16 @@ using namespace std; -MainWindow::MainWindow(QDir configDir, QWidget *parent) : - QMainWindow(parent), ui(new Ui::MainWindow), configDir(configDir) +MainWindow::MainWindow(QDir configDir, QWidget* parent) + : QMainWindow(parent), ui(new Ui::MainWindow), configDir(configDir) { outputDevices = QList::fromVector(QVector::fromStdVector(DeviceAPOInfo::loadAllInfos(false))); inputDevices = QList::fromVector(QVector::fromStdVector(DeviceAPOInfo::loadAllInfos(true))); defaultOutputDevice = NULL; - for(DeviceAPOInfo& apoInfo : outputDevices) + for (DeviceAPOInfo& apoInfo : outputDevices) { - if(apoInfo.isDefaultDevice) + if (apoInfo.isDefaultDevice) { defaultOutputDevice = &apoInfo; break; @@ -68,7 +68,7 @@ MainWindow::MainWindow(QDir configDir, QWidget *parent) : LogHelper::set(stderr, true, false, false); QString version = QString("%0.%1").arg(MAJOR).arg(MINOR); - if(REVISION != 0) + if (REVISION != 0) version += QString(".%0").arg(REVISION); setWindowTitle(tr("Equalizer APO %0 Configuration Editor").arg(version)); @@ -103,7 +103,7 @@ MainWindow::MainWindow(QDir configDir, QWidget *parent) : ui->mainToolBar->addWidget(channelConfigurationComboBox); QStandardItemModel* model = qobject_cast(deviceComboBox->model()); - if(defaultOutputDevice != NULL) + if (defaultOutputDevice != NULL) deviceComboBox->addItem(tr("Default") + " (" + QString::fromStdWString(defaultOutputDevice->connectionName) + " - " + QString::fromStdWString(defaultOutputDevice->deviceName) + ")", NULL); deviceComboBox->addItem(tr("Playback devices:")); @@ -113,8 +113,8 @@ MainWindow::MainWindow(QDir configDir, QWidget *parent) : item->setFont(font); item->setSelectable(false); - for(DeviceAPOInfo& apoInfo : outputDevices) - if(apoInfo.isInstalled) + for (DeviceAPOInfo& apoInfo : outputDevices) + if (apoInfo.isInstalled) deviceComboBox->addItem(QString::fromStdWString(apoInfo.connectionName) + " - " + QString::fromStdWString(apoInfo.deviceName), QVariant::fromValue(&apoInfo)); deviceComboBox->addItem(tr("Capture devices:")); @@ -122,8 +122,8 @@ MainWindow::MainWindow(QDir configDir, QWidget *parent) : item->setFont(font); item->setSelectable(false); - for(DeviceAPOInfo& apoInfo : inputDevices) - if(apoInfo.isInstalled) + for (DeviceAPOInfo& apoInfo : inputDevices) + if (apoInfo.isInstalled) deviceComboBox->addItem(QString::fromStdWString(apoInfo.connectionName) + " - " + QString::fromStdWString(apoInfo.deviceName), QVariant::fromValue(&apoInfo)); connect(channelConfigurationComboBox, SIGNAL(activated(int)), this, SLOT(channelConfigurationSelected(int))); @@ -136,21 +136,21 @@ MainWindow::MainWindow(QDir configDir, QWidget *parent) : connect(analysisThread, SIGNAL(analysisFinished()), this, SLOT(updateAnalysisPanel())); QLocale autoLocale = QLocale::system(); - if(autoLocale.language() != QLocale::German) + if (autoLocale.language() != QLocale::German) autoLocale = QLocale("en"); QLocale::Language languages[] = {QLocale::AnyLanguage, QLocale::English, QLocale::German}; - for(int i = 0; i < sizeof(languages) / sizeof(QLocale::Language); i++) + for (int i = 0; i < sizeof(languages) / sizeof(QLocale::Language); i++) { QLocale::Language language = languages[i]; QString languageName; - if(language == QLocale::AnyLanguage) + if (language == QLocale::AnyLanguage) languageName = autoLocale.nativeLanguageName(); else languageName = QLocale(language).nativeLanguageName(); - if(languageName == "American English") + if (languageName == "American English") languageName = "English"; QString text; - if(language == QLocale::AnyLanguage) + if (language == QLocale::AnyLanguage) text = tr("Automatic (%0)").arg(languageName); else text = languageName; @@ -172,18 +172,18 @@ MainWindow::~MainWindow() void MainWindow::doChecks() { - if(!DeviceAPOInfo::checkProtectedAudioDG(false) || !DeviceAPOInfo::checkAPORegistration(false)) + if (!DeviceAPOInfo::checkProtectedAudioDG(false) || !DeviceAPOInfo::checkAPORegistration(false)) { - if(QMessageBox::warning(this, tr("Registry problem"), tr("A registry value that is required for the operation of Equalizer APO is not set correctly.\nDo you want to run the Configurator application to fix the problem?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) + if (QMessageBox::warning(this, tr("Registry problem"), tr("A registry value that is required for the operation of Equalizer APO is not set correctly.\nDo you want to run the Configurator application to fix the problem?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { runConfigurator(); return; } } - if(!defaultOutputDevice->isInstalled) + if (!defaultOutputDevice->isInstalled) { - if(QMessageBox::warning(this, tr("APO not installed to device"), tr("Equalizer APO has not been installed to the selected device.\nDo you want to run the Configurator application to fix the problem?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) + if (QMessageBox::warning(this, tr("APO not installed to device"), tr("Equalizer APO has not been installed to the selected device.\nDo you want to run the Configurator application to fix the problem?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { runConfigurator(); return; @@ -191,20 +191,20 @@ void MainWindow::doChecks() } DeviceAPOInfo* disabledApoInfo = NULL; - for(DeviceAPOInfo& apoInfo : outputDevices) + for (DeviceAPOInfo& apoInfo : outputDevices) { - if(apoInfo.isInstalled && apoInfo.isEnhancementsDisabled) + if (apoInfo.isInstalled && apoInfo.isEnhancementsDisabled) { disabledApoInfo = &apoInfo; break; } } - if(disabledApoInfo == NULL) + if (disabledApoInfo == NULL) { - for(DeviceAPOInfo& apoInfo : inputDevices) + for (DeviceAPOInfo& apoInfo : inputDevices) { - if(apoInfo.isInstalled && apoInfo.isEnhancementsDisabled) + if (apoInfo.isInstalled && apoInfo.isEnhancementsDisabled) { disabledApoInfo = &apoInfo; break; @@ -212,9 +212,9 @@ void MainWindow::doChecks() } } - if(disabledApoInfo != NULL) + if (disabledApoInfo != NULL) { - if(QMessageBox::warning(this, tr("Audio enhancements disabled"), tr("Audio enhancements are not enabled for the device\n%0 %1.\nDo you want to run the Configurator application to fix the problem?").arg(QString::fromStdWString(disabledApoInfo->connectionName)).arg(QString::fromStdWString(disabledApoInfo->deviceName)), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) + if (QMessageBox::warning(this, tr("Audio enhancements disabled"), tr("Audio enhancements are not enabled for the device\n%0 %1.\nDo you want to run the Configurator application to fix the problem?").arg(QString::fromStdWString(disabledApoInfo->connectionName)).arg(QString::fromStdWString(disabledApoInfo->deviceName)), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { runConfigurator(); return; @@ -227,7 +227,7 @@ void MainWindow::runConfigurator() // cannot use QProcess::startDetached because of UAC wstring file = (QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/Configurator.exe")).toStdWString(); int result = (int)ShellExecuteW(NULL, L"open", file.c_str(), NULL, NULL, SW_SHOWNORMAL); - if(result == SE_ERR_ACCESSDENIED) + if (result == SE_ERR_ACCESSDENIED) ShellExecuteW(NULL, L"runas", file.c_str(), NULL, NULL, SW_SHOWNORMAL); } @@ -235,12 +235,12 @@ void MainWindow::load(QString path) { path = QDir::toNativeSeparators(path); - for(int i = 0; i < ui->tabWidget->count(); i++) + for (int i = 0; i < ui->tabWidget->count(); i++) { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->widget(i)); FilterTable* filterTable = qobject_cast(scrollArea->widget()); - if(filterTable->getConfigPath() == path) + if (filterTable->getConfigPath() == path) { ui->tabWidget->setCurrentIndex(i); return; @@ -251,13 +251,13 @@ void MainWindow::load(QString path) timer.start(); HANDLE hFile = INVALID_HANDLE_VALUE; - while(hFile == INVALID_HANDLE_VALUE) + while (hFile == INVALID_HANDLE_VALUE) { hFile = CreateFile(path.toStdWString().c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if(hFile == INVALID_HANDLE_VALUE) + if (hFile == INVALID_HANDLE_VALUE) { DWORD error = GetLastError(); - if(error != ERROR_SHARING_VIOLATION) + if (error != ERROR_SHARING_VIOLATION) { QMessageBox::critical(this, tr("Error"), tr("Error while reading configuration file: %0").arg(QString::fromStdWString(StringHelper::getSystemErrorString(error)))); return; @@ -272,7 +272,7 @@ void MainWindow::load(QString path) char buf[8192]; unsigned long bytesRead = -1; - while(ReadFile(hFile, buf, sizeof(buf), &bytesRead, NULL) && bytesRead != 0) + while (ReadFile(hFile, buf, sizeof(buf), &bytesRead, NULL) && bytesRead != 0) { inputStream.write(buf, bytesRead); } @@ -282,15 +282,15 @@ void MainWindow::load(QString path) inputStream.seekg(0); QList lines; - while(inputStream.good()) + while (inputStream.good()) { string encodedLine; getline(inputStream, encodedLine); - if(encodedLine.size() > 0 && encodedLine[encodedLine.size() - 1] == '\r') + if (encodedLine.size() > 0 && encodedLine[encodedLine.size() - 1] == '\r') encodedLine.resize(encodedLine.size() - 1); wstring line = StringHelper::toWString(encodedLine, CP_UTF8); - if(line.find(L'\uFFFD') != -1) + if (line.find(L'\uFFFD') != -1) line = StringHelper::toWString(encodedLine, CP_ACP); lines.append(QString::fromStdWString(line)); @@ -309,7 +309,7 @@ void MainWindow::load(QString path) recentFiles.removeAll(path); recentFiles.prepend(path); - if(recentFiles.size() > 10) + if (recentFiles.size() > 10) recentFiles.removeLast(); updateRecentFiles(); } @@ -323,9 +323,9 @@ void MainWindow::save(FilterTable* filterTable, QString path) bool first = true; QByteArray byteArray; - for(QString line : lines) + for (QString line : lines) { - if(first) + if (first) first = false; else byteArray.append("\r\n"); @@ -333,13 +333,13 @@ void MainWindow::save(FilterTable* filterTable, QString path) } HANDLE hFile = INVALID_HANDLE_VALUE; - while(hFile == INVALID_HANDLE_VALUE) + while (hFile == INVALID_HANDLE_VALUE) { hFile = CreateFile(path.toStdWString().c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if(hFile == INVALID_HANDLE_VALUE) + if (hFile == INVALID_HANDLE_VALUE) { DWORD error = GetLastError(); - if(error != ERROR_SHARING_VIOLATION) + if (error != ERROR_SHARING_VIOLATION) { QMessageBox::critical(this, tr("Error"), tr("Error while writing configuration file: %0").arg(QString::fromStdWString(StringHelper::getSystemErrorString(error)))); return; @@ -352,7 +352,7 @@ void MainWindow::save(FilterTable* filterTable, QString path) unsigned long bytesWritten; WriteFile(hFile, byteArray.constData(), byteArray.length(), &bytesWritten, NULL); - if(bytesWritten != byteArray.length()) + if (bytesWritten != byteArray.length()) { // should never happen QMessageBox::critical(this, tr("Error"), tr("Only %0/%1 bytes have been written!").arg(bytesWritten).arg(byteArray.length())); @@ -378,16 +378,16 @@ bool MainWindow::shouldRestart() void MainWindow::closeEvent(QCloseEvent* event) { bool canceled = false; - for(int i = 0; i < ui->tabWidget->count(); i++) + for (int i = 0; i < ui->tabWidget->count(); i++) { - if(!askForClose(i)) + if (!askForClose(i)) { canceled = true; break; } } - if(canceled) + if (canceled) { event->ignore(); restart = false; @@ -403,32 +403,32 @@ void MainWindow::closeEvent(QCloseEvent* event) void MainWindow::deviceSelected(int index) { DeviceAPOInfo* apoInfo = deviceComboBox->itemData(index).value(); - if(apoInfo == NULL) + if (apoInfo == NULL) apoInfo = defaultOutputDevice; channelConfigurationComboBox->clear(); const QList& infos = GUIChannelHelper::getInstance()->getChannelConfigurationInfos(); - if(apoInfo != NULL) + if (apoInfo != NULL) { const GUIChannelHelper::ChannelConfigurationInfo* selectedInfo = NULL; - for(const GUIChannelHelper::ChannelConfigurationInfo& info : infos) + for (const GUIChannelHelper::ChannelConfigurationInfo& info : infos) { - if(info.channelMask == apoInfo->channelMask) + if (info.channelMask == apoInfo->channelMask) { selectedInfo = &info; break; } } - if(selectedInfo != NULL) + if (selectedInfo != NULL) channelConfigurationComboBox->addItem(tr("From device") + " (" + selectedInfo->name + ")", 0); else channelConfigurationComboBox->addItem(tr("From device") + " (" + apoInfo->channelCount + " channels)", 0); } - for(const GUIChannelHelper::ChannelConfigurationInfo& info : infos) + for (const GUIChannelHelper::ChannelConfigurationInfo& info : infos) channelConfigurationComboBox->addItem(info.name, info.channelMask); channelConfigurationSelected(channelConfigurationComboBox->currentIndex()); @@ -440,7 +440,7 @@ void MainWindow::channelConfigurationSelected(int index) int channelMask; getDeviceAndChannelMask(&selectedDevice, &channelMask); - for(int i = 0; i < ui->tabWidget->count(); i++) + for (int i = 0; i < ui->tabWidget->count(); i++) { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->widget(i)); FilterTable* filterTable = qobject_cast(scrollArea->widget()); @@ -449,22 +449,22 @@ void MainWindow::channelConfigurationSelected(int index) ui->analysisChannelComboBox->clear(); - if(selectedDevice != NULL) + if (selectedDevice != NULL) { unsigned channelCount = selectedDevice->channelCount; - if(channelMask != 0 && channelMask != selectedDevice->channelMask) + if (channelMask != 0 && channelMask != selectedDevice->channelMask) { channelCount = 0; - for(int i = 0; i < 31; i++) + for (int i = 0; i < 31; i++) { int channelPos = 1 << i; - if(channelMask & channelPos) + if (channelMask & channelPos) channelCount++; } } vector channelNames = ChannelHelper::getChannelNames(channelCount, channelMask); - for(wstring channelName : channelNames) + for (wstring channelName : channelNames) { ui->analysisChannelComboBox->addItem(QString::fromStdWString(channelName)); } @@ -475,10 +475,10 @@ void MainWindow::linesChanged() { FilterTable* filterTable = qobject_cast(sender()); - if(instantModeCheckBox->isChecked()) + if (instantModeCheckBox->isChecked()) { QString configPath = filterTable->getConfigPath(); - if(configPath.length() > 0) + if (configPath.length() > 0) { save(filterTable, configPath); return; @@ -486,17 +486,17 @@ void MainWindow::linesChanged() } int tabIndex = -1; - for(int i = 0; i < ui->tabWidget->count(); i++) + for (int i = 0; i < ui->tabWidget->count(); i++) { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->widget(i)); - if(scrollArea->widget() == filterTable) + if (scrollArea->widget() == filterTable) { tabIndex = i; break; } } QString tabText = ui->tabWidget->tabText(tabIndex); - if(!tabText.endsWith('*')) + if (!tabText.endsWith('*')) { tabText += '*'; ui->tabWidget->setTabText(tabIndex, tabText); @@ -505,7 +505,7 @@ void MainWindow::linesChanged() bool MainWindow::on_tabWidget_tabCloseRequested(int index) { - if(askForClose(index)) + if (askForClose(index)) ui->tabWidget->removeTab(index); return true; } @@ -514,25 +514,25 @@ void MainWindow::on_actionOpen_triggered() { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->currentWidget()); QString path; - if(scrollArea != NULL) + if (scrollArea != NULL) { FilterTable* filterTable = qobject_cast(scrollArea->widget()); - if(filterTable->getConfigPath().length() > 0) + if (filterTable->getConfigPath().length() > 0) { QFileInfo fileInfo(filterTable->getConfigPath()); path = fileInfo.absolutePath(); } } - if(path.length() == 0) + if (path.length() == 0) path = configDir.absolutePath(); QFileDialog dialog(this, tr("Open file"), path, "*.txt"); dialog.setFileMode(QFileDialog::ExistingFiles); dialog.setNameFilter(tr("E-APO configurations (*.txt)")); - if(dialog.exec() == QDialog::Accepted) + if (dialog.exec() == QDialog::Accepted) { - for(QString file : dialog.selectedFiles()) + for (QString file : dialog.selectedFiles()) load(file); } } @@ -540,12 +540,12 @@ void MainWindow::on_actionOpen_triggered() void MainWindow::on_actionSave_triggered() { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->currentWidget()); - if(scrollArea == NULL) + if (scrollArea == NULL) return; FilterTable* filterTable = qobject_cast(scrollArea->widget()); - if(filterTable->getConfigPath().length() == 0) + if (filterTable->getConfigPath().length() == 0) { ui->actionSaveAs->trigger(); } @@ -554,7 +554,7 @@ void MainWindow::on_actionSave_triggered() save(filterTable, filterTable->getConfigPath()); QString tabText = ui->tabWidget->tabText(ui->tabWidget->currentIndex()); - if(tabText.endsWith('*')) + if (tabText.endsWith('*')) ui->tabWidget->setTabText(ui->tabWidget->currentIndex(), tabText.left(tabText.length() - 1)); } } @@ -562,13 +562,13 @@ void MainWindow::on_actionSave_triggered() void MainWindow::on_actionSaveAs_triggered() { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->currentWidget()); - if(scrollArea == NULL) + if (scrollArea == NULL) return; FilterTable* filterTable = qobject_cast(scrollArea->widget()); QString path; QString filename; - if(filterTable->getConfigPath().length() == 0) + if (filterTable->getConfigPath().length() == 0) { path = configDir.absolutePath(); } @@ -583,10 +583,10 @@ void MainWindow::on_actionSaveAs_triggered() dialog.setAcceptMode(QFileDialog::AcceptSave); dialog.setNameFilter(tr("E-APO configurations (*.txt)")); dialog.setDefaultSuffix(".txt"); - if(filename.length() > 0) + if (filename.length() > 0) dialog.selectFile(filename); - if(dialog.exec() == QDialog::Accepted) + if (dialog.exec() == QDialog::Accepted) { QString savePath = dialog.selectedFiles().first(); save(filterTable, savePath); @@ -616,7 +616,7 @@ void MainWindow::recentFileSelected() void MainWindow::on_actionCut_triggered() { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->currentWidget()); - if(scrollArea == NULL) + if (scrollArea == NULL) return; FilterTable* filterTable = qobject_cast(scrollArea->widget()); @@ -626,7 +626,7 @@ void MainWindow::on_actionCut_triggered() void MainWindow::on_actionCopy_triggered() { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->currentWidget()); - if(scrollArea == NULL) + if (scrollArea == NULL) return; FilterTable* filterTable = qobject_cast(scrollArea->widget()); @@ -636,7 +636,7 @@ void MainWindow::on_actionCopy_triggered() void MainWindow::on_actionPaste_triggered() { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->currentWidget()); - if(scrollArea == NULL) + if (scrollArea == NULL) return; FilterTable* filterTable = qobject_cast(scrollArea->widget()); @@ -646,7 +646,7 @@ void MainWindow::on_actionPaste_triggered() void MainWindow::on_actionDelete_triggered() { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->currentWidget()); - if(scrollArea == NULL) + if (scrollArea == NULL) return; FilterTable* filterTable = qobject_cast(scrollArea->widget()); @@ -655,19 +655,19 @@ void MainWindow::on_actionDelete_triggered() void MainWindow::instantModeEnabled(bool enabled) { - if(enabled) + if (enabled) { - for(int i = 0; i < ui->tabWidget->count(); i++) + for (int i = 0; i < ui->tabWidget->count(); i++) { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->widget(i)); FilterTable* filterTable = qobject_cast(scrollArea->widget()); - if(filterTable->getConfigPath().length() > 0) + if (filterTable->getConfigPath().length() > 0) { save(filterTable, filterTable->getConfigPath()); QString tabText = ui->tabWidget->tabText(i); - if(tabText.endsWith('*')) + if (tabText.endsWith('*')) ui->tabWidget->setTabText(i, tabText.left(tabText.length() - 1)); } } @@ -740,7 +740,7 @@ void MainWindow::languageSelected(bool selected) { QAction* action = qobject_cast(sender()); - if(!selected) + if (!selected) { action->setChecked(true); return; @@ -748,10 +748,10 @@ void MainWindow::languageSelected(bool selected) QLocale::Language language = (QLocale::Language)action->data().toInt(); - if(QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes) + if (QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes) { QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat); - if(language == QLocale::AnyLanguage) + if (language == QLocale::AnyLanguage) { settings.remove("language"); } @@ -759,7 +759,7 @@ void MainWindow::languageSelected(bool selected) { QString name = QLocale(language).name(); int index = name.indexOf('_'); - if(index != -1) + if (index != -1) name = name.left(index); settings.setValue("language", name); } @@ -775,15 +775,15 @@ void MainWindow::languageSelected(bool selected) void MainWindow::on_actionResetAllGlobalPreferences_triggered() { - if(QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes) + if (QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes) { QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat); - for(QString key : settings.childGroups()) + for (QString key : settings.childGroups()) { - if(key != "file-specific") + if (key != "file-specific") settings.remove(key); } - for(QString key : settings.childKeys()) + for (QString key : settings.childKeys()) settings.remove(key); restart = true; @@ -794,12 +794,12 @@ void MainWindow::on_actionResetAllGlobalPreferences_triggered() void MainWindow::on_actionResetAllFileSpecificPreferences_triggered() { - if(QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes) + if (QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes) { QSettings settings(QString::fromWCharArray(EDITOR_PER_FILE_REGPATH), QSettings::NativeFormat); - for(QString key : settings.childGroups()) + for (QString key : settings.childGroups()) settings.remove(key); - for(QString key : settings.childKeys()) + for (QString key : settings.childKeys()) settings.remove(key); restart = true; @@ -832,15 +832,15 @@ FilterTable* MainWindow::addTab(QString title, QString tooltip) void MainWindow::getDeviceAndChannelMask(DeviceAPOInfo** selectedDevice, int* channelMask) { *selectedDevice = deviceComboBox->currentData().value(); - if(*selectedDevice == NULL) + if (*selectedDevice == NULL) *selectedDevice = defaultOutputDevice; *channelMask = channelConfigurationComboBox->currentData().toInt(); - if(*channelMask == 0 && selectedDevice != NULL) + if (*channelMask == 0 && selectedDevice != NULL) { *channelMask = (*selectedDevice)->channelMask; - if(*channelMask == 0) + if (*channelMask == 0) *channelMask = ChannelHelper::getDefaultChannelMask((*selectedDevice)->channelCount); } } @@ -848,7 +848,7 @@ void MainWindow::getDeviceAndChannelMask(DeviceAPOInfo** selectedDevice, int* ch bool MainWindow::askForClose(int tabIndex) { bool discarded = false; - if(ui->tabWidget->tabText(tabIndex).endsWith('*')) + if (ui->tabWidget->tabText(tabIndex).endsWith('*')) { ui->tabWidget->setCurrentIndex(tabIndex); QString configPath = ui->tabWidget->tabToolTip(tabIndex); @@ -863,11 +863,11 @@ bool MainWindow::askForClose(int tabIndex) messageBox.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); int result = messageBox.exec(); - switch(result) + switch (result) { case QMessageBox::Save: ui->actionSave->trigger(); - if(ui->tabWidget->tabText(tabIndex).endsWith('*')) + if (ui->tabWidget->tabText(tabIndex).endsWith('*')) // saving was canceled return false; break; @@ -879,10 +879,10 @@ bool MainWindow::askForClose(int tabIndex) } } - if(!discarded && !noSaveFilePreferences) + if (!discarded && !noSaveFilePreferences) { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->widget(tabIndex)); - if(scrollArea != NULL) + if (scrollArea != NULL) { FilterTable* filterTable = qobject_cast(scrollArea->widget()); filterTable->savePreferences(); @@ -899,23 +899,23 @@ void MainWindow::startAnalysis() int channelMask; getDeviceAndChannelMask(&selectedDevice, &channelMask); - if(selectedDevice != NULL) + if (selectedDevice != NULL) { QString configPath; - if(ui->startFromComboBox->currentIndex() == 1) + if (ui->startFromComboBox->currentIndex() == 1) { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->currentWidget()); - if(scrollArea != NULL) + if (scrollArea != NULL) { FilterTable* filterTable = qobject_cast(scrollArea->widget()); - if(filterTable->getConfigPath().length() > 0) + if (filterTable->getConfigPath().length() > 0) configPath = filterTable->getConfigPath(); } } - if(configPath.isEmpty()) + if (configPath.isEmpty()) configPath = configDir.absoluteFilePath("config.txt"); configPath = QDir::toNativeSeparators(configPath); @@ -927,10 +927,10 @@ void MainWindow::loadPreferences() { QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat); QVariant geometryValue = settings.value("geometry"); - if(geometryValue.isValid()) + if (geometryValue.isValid()) restoreGeometry(geometryValue.toByteArray()); QVariant stateValue = settings.value("windowState"); - if(stateValue.isValid()) + if (stateValue.isValid()) restoreState(stateValue.toByteArray()); instantModeCheckBox->setChecked(settings.value("instantMode", true).toBool()); @@ -939,7 +939,7 @@ void MainWindow::loadPreferences() ui->resolutionSpinBox->setValue(settings.value("analysis/resolution", 65536).toInt()); double zoomX = settings.value("analysis/zoomX", 1.0).toDouble(); double zoomY = settings.value("analysis/zoomY", 1.0).toDouble(); - if(zoomX != 1.0 || zoomY != 1.0) + if (zoomX != 1.0 || zoomY != 1.0) analysisPlotScene->setZoom(zoomX, zoomY); int scrollX = settings.value("analysis/scrollX", round(analysisPlotScene->hzToX(20))).toInt(); int scrollY = settings.value("analysis/scrollY", round(analysisPlotScene->dbToY(22))).toInt(); @@ -947,13 +947,13 @@ void MainWindow::loadPreferences() QVariant openFilesValue = settings.value("openFiles"); int tabIndex = settings.value("tabIndex").toInt(); - if(openFilesValue.isValid()) + if (openFilesValue.isValid()) { QStringList fileList = openFilesValue.toStringList(); - for(int i = 0; i < fileList.size(); i++) + for (int i = 0; i < fileList.size(); i++) { load(fileList[i]); - if(i == tabIndex) + if (i == tabIndex) tabIndex = ui->tabWidget->currentIndex(); } } @@ -963,18 +963,18 @@ void MainWindow::loadPreferences() QVariant languageValue = settings.value("language"); QLocale::Language language; - if(languageValue.isValid()) + if (languageValue.isValid()) language = QLocale(languageValue.toString()).language(); else language = QLocale::AnyLanguage; - for(QAction* action : ui->menuLanguage->actions()) + for (QAction* action : ui->menuLanguage->actions()) action->setChecked(action->data().toInt() == language); } void MainWindow::savePreferences() { - if(noSavePreferences) + if (noSavePreferences) return; QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat); @@ -995,13 +995,13 @@ void MainWindow::savePreferences() settings.setValue("analysis/scrollY", value); QStringList fileList; - for(int i = 0; i < ui->tabWidget->count(); i++) + for (int i = 0; i < ui->tabWidget->count(); i++) { QScrollArea* scrollArea = qobject_cast(ui->tabWidget->widget(i)); - if(scrollArea == NULL) + if (scrollArea == NULL) continue; FilterTable* filterTable = qobject_cast(scrollArea->widget()); - if(filterTable->getConfigPath().length() > 0) + if (filterTable->getConfigPath().length() > 0) { fileList.append(filterTable->getConfigPath()); } @@ -1017,17 +1017,17 @@ void MainWindow::updateRecentFiles() { QList actions = ui->menuFile->actions(); int separatorsFound = 0; - for(int i = actions.size() - 1; i >= 0; i--) + for (int i = actions.size() - 1; i >= 0; i--) { QAction* action = actions[i]; - if(action->isSeparator()) + if (action->isSeparator()) { separatorsFound++; - if(separatorsFound == 1) + if (separatorsFound == 1) { QList newActions; - for(QString recentFile : recentFiles) + for (QString recentFile : recentFiles) { QAction* newAction = new QAction(recentFile, ui->menuFile); connect(newAction, SIGNAL(triggered(bool)), this, SLOT(recentFileSelected())); @@ -1040,7 +1040,7 @@ void MainWindow::updateRecentFiles() break; } } - else if(separatorsFound >= 1) + else if (separatorsFound >= 1) { ui->menuFile->removeAction(action); } diff --git a/Editor/MainWindow.h b/Editor/MainWindow.h index eaf4dee..9bfed10 100644 --- a/Editor/MainWindow.h +++ b/Editor/MainWindow.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -44,7 +44,7 @@ class MainWindow : public QMainWindow Q_OBJECT public: - explicit MainWindow(QDir configDir, QWidget *parent = 0); + explicit MainWindow(QDir configDir, QWidget* parent = 0); ~MainWindow(); void doChecks(); void runConfigurator(); @@ -98,7 +98,7 @@ private: void savePreferences(); void updateRecentFiles(); - Ui::MainWindow *ui; + Ui::MainWindow* ui; QDir configDir; QCheckBox* instantModeCheckBox; diff --git a/Editor/guis/BiQuadFilterGUI.cpp b/Editor/guis/BiQuadFilterGUI.cpp index d198550..e7fa07a 100644 --- a/Editor/guis/BiQuadFilterGUI.cpp +++ b/Editor/guis/BiQuadFilterGUI.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #define _USE_MATH_DEFINES @@ -30,8 +30,8 @@ static const double dialQSteps = 1000; static const double dialQMin = 0.3333; static const double dialQMax = 33.3333; -BiQuadFilterGUI::BiQuadFilterGUI(BiQuadFilter* filter) : - ui(new Ui::BiQuadFilterGUI) +BiQuadFilterGUI::BiQuadFilterGUI(BiQuadFilter* filter) + : ui(new Ui::BiQuadFilterGUI) { ui->setupUi(this); @@ -46,22 +46,22 @@ BiQuadFilterGUI::BiQuadFilterGUI(BiQuadFilter* filter) : BiQuad::Type type = filter->getType(); int typeIndex = ui->typeComboBox->findData(type); - if(typeIndex != -1) + if (typeIndex != -1) ui->typeComboBox->setCurrentIndex(typeIndex); - if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF ) + if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) ui->freqComboBox->setCurrentIndex(filter->getIsCornerFreq() ? 1 : 0); ui->freqSpinBox->setValue(filter->getFreq()); - if(type == BiQuad::PEAKING ) + if (type == BiQuad::PEAKING) ui->qComboBox->setCurrentIndex(filter->getIsBandwidth() ? 1 : 0); - else if(type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS) + else if (type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS) ui->qComboBox->setCurrentIndex(filter->getBandwidthOrQOrS() == M_SQRT1_2 ? 0 : 1); - else if((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && !filter->getIsCornerFreq()) + else if ((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && !filter->getIsCornerFreq()) ui->qComboBox->setCurrentIndex(filter->getBandwidthOrQOrS() == 0.9 ? 0 : 1); - if((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && filter->getBandwidthOrQOrS() != 0.9) + if ((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && filter->getBandwidthOrQOrS() != 0.9) ui->qSpinBox->setValue(filter->getBandwidthOrQOrS() * 12.0); else ui->qSpinBox->setValue(filter->getBandwidthOrQOrS()); @@ -82,19 +82,19 @@ void BiQuadFilterGUI::store(QString& command, QString& parameters) command = "Filter"; parameters = "ON "; - switch(type) + switch (type) { case BiQuad::PEAKING: parameters += "PK"; break; case BiQuad::LOW_PASS: - if(mode == 'F') + if (mode == 'F') parameters += "LP"; else parameters += "LPQ"; break; case BiQuad::HIGH_PASS: - if(mode == 'F') + if (mode == 'F') parameters += "HP"; else parameters += "HPQ"; @@ -103,13 +103,13 @@ void BiQuadFilterGUI::store(QString& command, QString& parameters) parameters += "BP"; break; case BiQuad::LOW_SHELF: - if(freqMode == 'E' && mode == 'S') + if (freqMode == 'E' && mode == 'S') parameters += "LSC"; else parameters += "LS"; break; case BiQuad::HIGH_SHELF: - if(freqMode == 'E' && mode == 'S') + if (freqMode == 'E' && mode == 'S') parameters += "HSC"; else parameters += "HS"; @@ -122,18 +122,18 @@ void BiQuadFilterGUI::store(QString& command, QString& parameters) break; } - if((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && mode == 'S') + if ((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && mode == 'S') parameters += QString(" %1 dB").arg(ui->qSpinBox->value()); parameters += QString(" Fc %1 Hz").arg(ui->freqSpinBox->value()); - if(type == BiQuad::PEAKING || type == BiQuad::LOW_SHELF - || type == BiQuad::HIGH_SHELF) + if (type == BiQuad::PEAKING || type == BiQuad::LOW_SHELF + || type == BiQuad::HIGH_SHELF) parameters += QString(" Gain %1 dB").arg(ui->gainSpinBox->value()); - if(mode == 'Q') + if (mode == 'Q') parameters += QString(" Q %1").arg(ui->qSpinBox->value()); - else if(mode == 'B') + else if (mode == 'B') parameters += QString(" BW Oct %1").arg(ui->qSpinBox->value()); } @@ -187,13 +187,13 @@ void BiQuadFilterGUI::on_typeComboBox_currentIndexChanged(int index) QChar freqMode = ui->freqComboBox->currentData().toChar(); double freqValue = ui->freqSpinBox->value(); ui->freqComboBox->clear(); - if(type == BiQuad::PEAKING || type == BiQuad::BAND_PASS || type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF || type == BiQuad::NOTCH || type == BiQuad::ALL_PASS ) + if (type == BiQuad::PEAKING || type == BiQuad::BAND_PASS || type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF || type == BiQuad::NOTCH || type == BiQuad::ALL_PASS) ui->freqComboBox->addItem(tr("Center frequency"), 'E'); - if(type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) + if (type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) ui->freqComboBox->addItem(tr("Corner frequency"), 'O'); ui->freqComboBox->setEnabled(ui->freqComboBox->count() > 1); int freqIndex = ui->freqComboBox->findData(freqMode); - if(freqIndex != -1 && sameTypeCategory) + if (freqIndex != -1 && sameTypeCategory) { ui->freqComboBox->setCurrentIndex(freqIndex); ui->freqSpinBox->setValue(freqValue); @@ -206,30 +206,30 @@ void BiQuadFilterGUI::on_typeComboBox_currentIndexChanged(int index) QChar mode = ui->qComboBox->currentData().toChar(); double qValue = ui->qSpinBox->value(); ui->qComboBox->clear(); - if(type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS || type == BiQuad::NOTCH ) + if (type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS || type == BiQuad::NOTCH) ui->qComboBox->addItem(tr("Fixed Q"), 'F'); - else if((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && freqMode == 'E') + else if ((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && freqMode == 'E') ui->qComboBox->addItem(tr("Fixed S"), 'F'); - if(type == BiQuad::PEAKING || type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::ALL_PASS || type == BiQuad::BAND_PASS || type == BiQuad::NOTCH) + if (type == BiQuad::PEAKING || type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::ALL_PASS || type == BiQuad::BAND_PASS || type == BiQuad::NOTCH) ui->qComboBox->addItem(tr("Q factor"), 'Q'); - if(type == BiQuad::PEAKING) + if (type == BiQuad::PEAKING) ui->qComboBox->addItem(tr("Bandwidth"), 'B'); - if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) + if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) ui->qComboBox->addItem(tr("Slope"), 'S'); ui->qComboBox->setEnabled(ui->qComboBox->count() > 1); int qIndex = ui->qComboBox->findData(mode); - if(qIndex != -1 && sameTypeCategory) + if (qIndex != -1 && sameTypeCategory) { ui->qComboBox->setCurrentIndex(qIndex); ui->qSpinBox->setValue(qValue); } - else if(type == BiQuad::PEAKING || type == BiQuad::ALL_PASS) + else if (type == BiQuad::PEAKING || type == BiQuad::ALL_PASS) { ui->qSpinBox->setValue(10); } bool gainVisible = type == BiQuad::PEAKING || type == BiQuad::LOW_SHELF - || type == BiQuad::HIGH_SHELF; + || type == BiQuad::HIGH_SHELF; ui->gainDial->setVisible(gainVisible); ui->gainLabel->setVisible(gainVisible); ui->gainSpinBox->setVisible(gainVisible); @@ -243,17 +243,17 @@ void BiQuadFilterGUI::on_freqComboBox_currentIndexChanged(int index) { BiQuad::Type type = (BiQuad::Type)ui->typeComboBox->currentData().toInt(); QChar freqMode = ui->freqComboBox->itemData(index).toChar(); - if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) + if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) { QChar mode = ui->qComboBox->currentData().toChar(); double qValue = ui->qSpinBox->value(); ui->qComboBox->clear(); - if(freqMode == 'E') + if (freqMode == 'E') ui->qComboBox->addItem(tr("Fixed S"), 'F'); ui->qComboBox->addItem(tr("Slope"), 'S'); ui->qComboBox->setEnabled(ui->qComboBox->count() > 1); int qIndex = ui->qComboBox->findData(mode); - if(qIndex != -1) + if (qIndex != -1) { ui->qComboBox->setCurrentIndex(qIndex); ui->qSpinBox->setValue(qValue); @@ -261,7 +261,7 @@ void BiQuadFilterGUI::on_freqComboBox_currentIndexChanged(int index) double centerFreqFactor = pow(10.0, abs(ui->gainSpinBox->value()) / 80.0 / (ui->qSpinBox->value() / 12.0)); double freq = ui->freqSpinBox->value(); - if((freqMode == 'E') == (type == BiQuad::LOW_SHELF) ) + if ((freqMode == 'E') == (type == BiQuad::LOW_SHELF)) freq *= centerFreqFactor; else freq /= centerFreqFactor; @@ -272,27 +272,27 @@ void BiQuadFilterGUI::on_freqComboBox_currentIndexChanged(int index) void BiQuadFilterGUI::on_qComboBox_currentIndexChanged(int index) { QChar mode = ui->qComboBox->currentData().toChar(); - if(mode == 'F' || mode == 'Q') + if (mode == 'F' || mode == 'Q') ui->qSpinBox->setSuffix(""); - else if(mode == 'B') + else if (mode == 'B') ui->qSpinBox->setSuffix(" Oct"); - else if(mode == 'S') + else if (mode == 'S') ui->qSpinBox->setSuffix(" dB/Oct"); ui->qDial->setEnabled(mode != 'F'); ui->qSpinBox->setEnabled(mode != 'F'); - if(mode == 'F') + if (mode == 'F') { BiQuad::Type type = (BiQuad::Type)ui->typeComboBox->currentData().toInt(); - if(type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS) + if (type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS) ui->qSpinBox->setValue(M_SQRT1_2); - else if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) + else if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) ui->qSpinBox->setValue(0.9); - else if(type == BiQuad::NOTCH) + else if (type == BiQuad::NOTCH) ui->qSpinBox->setValue(30); } - else if(qIsBw && mode == 'Q') + else if (qIsBw && mode == 'Q') { double n = ui->qSpinBox->value(); double p2n = pow(2.0, n); @@ -300,14 +300,14 @@ void BiQuadFilterGUI::on_qComboBox_currentIndexChanged(int index) ui->qSpinBox->setValue(q); qIsBw = false; } - else if(!qIsBw && mode == 'B') + else if (!qIsBw && mode == 'B') { double q = ui->qSpinBox->value(); double n = 2.0 / M_LN2 * asinh(1.0 / (2.0 * q)); ui->qSpinBox->setValue(n); qIsBw = true; } - else if(mode == 'S') + else if (mode == 'S') { ui->qSpinBox->setValue(12.0); } @@ -317,7 +317,7 @@ void BiQuadFilterGUI::on_qComboBox_currentIndexChanged(int index) int BiQuadFilterGUI::getTypeCategory(BiQuad::Type type) { - switch(type) + switch (type) { case BiQuad::PEAKING: return 0; diff --git a/Editor/guis/BiQuadFilterGUI.h b/Editor/guis/BiQuadFilterGUI.h index e278189..2549616 100644 --- a/Editor/guis/BiQuadFilterGUI.h +++ b/Editor/guis/BiQuadFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -22,8 +22,7 @@ #include "Editor/IFilterGUI.h" #include -namespace Ui -{ +namespace Ui { class BiQuadFilterGUI; } diff --git a/Editor/guis/BiQuadFilterGUIFactory.cpp b/Editor/guis/BiQuadFilterGUIFactory.cpp index acb5505..8589025 100644 --- a/Editor/guis/BiQuadFilterGUIFactory.cpp +++ b/Editor/guis/BiQuadFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "BiQuadFilterGUI.h" @@ -43,17 +43,17 @@ IFilterGUI* BiQuadFilterGUIFactory::createFilterGUI(QString& command, QString& p { BiQuadFilterGUI* result = NULL; - if(command.startsWith("Filter")) + if (command.startsWith("Filter")) { BiQuadFilterFactory factory; std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); - if(!filters.empty()) + if (!filters.empty()) { BiQuadFilter* filter = (BiQuadFilter*)filters[0]; result = new BiQuadFilterGUI(filter); } - for(IFilter* f : filters) + for (IFilter* f : filters) { f->~IFilter(); MemoryHelper::free(f); diff --git a/Editor/guis/BiQuadFilterGUIFactory.h b/Editor/guis/BiQuadFilterGUIFactory.h index a1c0cb1..fdf6eaa 100644 --- a/Editor/guis/BiQuadFilterGUIFactory.h +++ b/Editor/guis/BiQuadFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/ChannelFilterGUI.cpp b/Editor/guis/ChannelFilterGUI.cpp index 7c73089..06d0ae3 100644 --- a/Editor/guis/ChannelFilterGUI.cpp +++ b/Editor/guis/ChannelFilterGUI.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "ChannelFilterGUI.h" @@ -23,8 +23,8 @@ using namespace std; -ChannelFilterGUI::ChannelFilterGUI(const QString& parameters, int selectedChannelMask) : - ui(new Ui::ChannelFilterGUI) +ChannelFilterGUI::ChannelFilterGUI(const QString& parameters, int selectedChannelMask) + : ui(new Ui::ChannelFilterGUI) { ui->setupUi(this); @@ -38,8 +38,8 @@ ChannelFilterGUI::ChannelFilterGUI(const QString& parameters, int selectedChanne selectedChannels.clear(); QStringList words = parameters.trimmed().split(' ', QString::SkipEmptyParts); - for(QString word : words) - if(word.length() > 0) + for (QString word : words) + if (word.length() > 0) selectedChannels.append(word.toUpper()); } @@ -66,7 +66,7 @@ void ChannelFilterGUI::store(QString& command, QString& parameters) void ChannelFilterGUI::on_pushButton_clicked() { ChannelFilterGUIDialog dialog(this, selectedChannels, selectedChannelMask, channelNames); - if(dialog.exec() == QDialog::Accepted) + if (dialog.exec() == QDialog::Accepted) { selectedChannels = dialog.getSelectedChannels(); refreshGui(); diff --git a/Editor/guis/ChannelFilterGUI.h b/Editor/guis/ChannelFilterGUI.h index cd89143..20d2675 100644 --- a/Editor/guis/ChannelFilterGUI.h +++ b/Editor/guis/ChannelFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -43,7 +43,7 @@ private slots: private: void refreshGui(); - Ui::ChannelFilterGUI *ui; + Ui::ChannelFilterGUI* ui; QStringList selectedChannels; int selectedChannelMask; std::vector channelNames; diff --git a/Editor/guis/ChannelFilterGUIChannelItem.cpp b/Editor/guis/ChannelFilterGUIChannelItem.cpp index b11e37d..93dbe1d 100644 --- a/Editor/guis/ChannelFilterGUIChannelItem.cpp +++ b/Editor/guis/ChannelFilterGUIChannelItem.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -22,8 +22,8 @@ #include "ChannelFilterGUIScene.h" #include "ChannelFilterGUIChannelItem.h" -ChannelFilterGUIChannelItem::ChannelFilterGUIChannelItem(const QString& name) : - ChannelGraphItem(name) +ChannelFilterGUIChannelItem::ChannelFilterGUIChannelItem(const QString& name) + : ChannelGraphItem(name) { setFlag(ItemIsSelectable); } @@ -32,7 +32,7 @@ void ChannelFilterGUIChannelItem::paint(QPainter* painter, const QStyleOptionGra { QColor color; - if(isSelected()) + if (isSelected()) { color = QColor(176, 229, 255); } diff --git a/Editor/guis/ChannelFilterGUIChannelItem.h b/Editor/guis/ChannelFilterGUIChannelItem.h index b1e88a9..4d8fadb 100644 --- a/Editor/guis/ChannelFilterGUIChannelItem.h +++ b/Editor/guis/ChannelFilterGUIChannelItem.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -26,7 +26,7 @@ class ChannelFilterGUIChannelItem : public ChannelGraphItem public: ChannelFilterGUIChannelItem(const QString& name); - enum { Type = UserType + 2 }; + enum {Type = UserType + 2}; virtual int type() const { return Type; diff --git a/Editor/guis/ChannelFilterGUIDialog.cpp b/Editor/guis/ChannelFilterGUIDialog.cpp index 1001310..1586a19 100644 --- a/Editor/guis/ChannelFilterGUIDialog.cpp +++ b/Editor/guis/ChannelFilterGUIDialog.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -30,8 +30,8 @@ using namespace std; -ChannelFilterGUIDialog::ChannelFilterGUIDialog(QWidget *parent, QStringList selectedChannels, int selectedChannelMask, const vector& channelNames) : - QDialog(parent), +ChannelFilterGUIDialog::ChannelFilterGUIDialog(QWidget* parent, QStringList selectedChannels, int selectedChannelMask, const vector& channelNames) + : QDialog(parent), ui(new Ui::ChannelFilterGUIDialog) { ui->setupUi(this); @@ -68,26 +68,26 @@ ChannelFilterGUIDialog::ChannelFilterGUIDialog(QWidget *parent, QStringList sele vector remainingChannelNames = channelNames; QStringList remainingSelectedChannels = selectedChannels; - if(selectedChannels.contains("ALL")) + if (selectedChannels.contains("ALL")) { ui->allChannelsCheckBox->setChecked(true); remainingSelectedChannels.clear(); } int channelIndex = 0; - for(QCheckBox* checkBox : checkBoxes) + for (QCheckBox* checkBox : checkBoxes) { int channelPos = checkBox->property(PROPERTY_POSITION).toInt(); QString channelName = checkBox->property(PROPERTY_NAME).toString(); bool exists = selectedChannelMask & channelPos; checkBox->setVisible(exists); - if(exists) + if (exists) { channelIndex++; bool checked = false; remainingChannelNames.erase(remove(remainingChannelNames.begin(), remainingChannelNames.end(), channelName.toStdWString()), remainingChannelNames.end()); - if(remainingSelectedChannels.removeOne(channelName)) + if (remainingSelectedChannels.removeOne(channelName)) checked = true; - if(remainingSelectedChannels.removeOne(QString(channelIndex))) + if (remainingSelectedChannels.removeOne(QString(channelIndex))) checked = true; checkBox->setChecked(checked); } @@ -98,18 +98,18 @@ ChannelFilterGUIDialog::ChannelFilterGUIDialog(QWidget *parent, QStringList sele } ui->listWidget->clear(); - for(wstring channelName : remainingChannelNames) + for (wstring channelName : remainingChannelNames) { QListWidgetItem* item = new QListWidgetItem(QString::fromStdWString(channelName)); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); - if(remainingSelectedChannels.removeOne(QString::fromStdWString(channelName))) + if (remainingSelectedChannels.removeOne(QString::fromStdWString(channelName))) item->setCheckState(Qt::Checked); else item->setCheckState(Qt::Unchecked); ui->listWidget->addItem(item); } - for(QString c : remainingSelectedChannels) + for (QString c : remainingSelectedChannels) { QListWidgetItem* item = new QListWidgetItem(c); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); @@ -143,28 +143,28 @@ QStringList ChannelFilterGUIDialog::getSelectedChannels() const { QStringList selectedChannels; - if(ui->allChannelsCheckBox->isChecked()) + if (ui->allChannelsCheckBox->isChecked()) { selectedChannels.append("ALL"); } else { - for(QCheckBox* checkBox : checkBoxes) + for (QCheckBox* checkBox : checkBoxes) { - if(checkBox->isChecked()) + if (checkBox->isChecked()) { QString channelName = checkBox->property(PROPERTY_NAME).toString(); selectedChannels.append(channelName); } } - for(int i = 0; i < ui->listWidget->count(); i++) + for (int i = 0; i < ui->listWidget->count(); i++) { QListWidgetItem* item = ui->listWidget->item(i); - if(item->checkState() == Qt::Checked) + if (item->checkState() == Qt::Checked) { QString text = item->text().trimmed(); - if(text.length() > 0) + if (text.length() > 0) selectedChannels.append(text.toUpper()); } } diff --git a/Editor/guis/ChannelFilterGUIDialog.h b/Editor/guis/ChannelFilterGUIDialog.h index dcd06e6..4223481 100644 --- a/Editor/guis/ChannelFilterGUIDialog.h +++ b/Editor/guis/ChannelFilterGUIDialog.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -31,7 +31,7 @@ class ChannelFilterGUIDialog : public QDialog Q_OBJECT public: - explicit ChannelFilterGUIDialog(QWidget *parent, QStringList selectedChannels, int selectedChannelMask, const std::vector& channelNames); + explicit ChannelFilterGUIDialog(QWidget* parent, QStringList selectedChannels, int selectedChannelMask, const std::vector& channelNames); ~ChannelFilterGUIDialog(); QStringList getSelectedChannels() const; @@ -44,6 +44,6 @@ private slots: void on_allChannelsCheckBox_toggled(bool checked); private: - Ui::ChannelFilterGUIDialog *ui; + Ui::ChannelFilterGUIDialog* ui; QList checkBoxes; }; diff --git a/Editor/guis/ChannelFilterGUIFactory.cpp b/Editor/guis/ChannelFilterGUIFactory.cpp index f2f70b4..ac25bb1 100644 --- a/Editor/guis/ChannelFilterGUIFactory.cpp +++ b/Editor/guis/ChannelFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "Editor/FilterTable.h" @@ -41,7 +41,7 @@ IFilterGUI* ChannelFilterGUIFactory::createFilterGUI(QString& command, QString& { ChannelFilterGUI* result = NULL; - if(command == "Channel") + if (command == "Channel") { result = new ChannelFilterGUI(parameters, filterTable->getSelectedChannelMask()); } diff --git a/Editor/guis/ChannelFilterGUIFactory.h b/Editor/guis/ChannelFilterGUIFactory.h index 8322d8e..b547ce0 100644 --- a/Editor/guis/ChannelFilterGUIFactory.h +++ b/Editor/guis/ChannelFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/ChannelFilterGUIScene.cpp b/Editor/guis/ChannelFilterGUIScene.cpp index f8f020b..f2707d4 100644 --- a/Editor/guis/ChannelFilterGUIScene.cpp +++ b/Editor/guis/ChannelFilterGUIScene.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "ChannelFilterGUIChannelItem.h" @@ -37,7 +37,7 @@ void ChannelFilterGUIScene::load(vector channelNames, QStringList selec channelNames.push_back(L"ALL"); - for(unsigned i = 0; i < channelNames.size(); i++) + for (unsigned i = 0; i < channelNames.size(); i++) { QString c = QString::fromStdWString(channelNames[i]); @@ -46,15 +46,15 @@ void ChannelFilterGUIScene::load(vector channelNames, QStringList selec addItem(item); channelMap.insert(c, item); - if(c != "ALL") + if (c != "ALL") channelMap.insert(QString().setNum(i), item); lastItem = item; } - for(QString c : selectedChannels) + for (QString c : selectedChannels) { ChannelFilterGUIChannelItem* item = channelMap.value(c.toUpper()); - if(item == NULL) + if (item == NULL) { item = new ChannelFilterGUIChannelItem(c); item->setPos(getNextChannelPoint(lastItem, false)); @@ -74,12 +74,12 @@ QStringList ChannelFilterGUIScene::getSelectedChannels() { QStringList selectedChannels; - for(QGraphicsItem* item : items(Qt::AscendingOrder)) + for (QGraphicsItem* item : items(Qt::AscendingOrder)) { ChannelFilterGUIChannelItem* channelItem = qgraphicsitem_cast(item); - if(channelItem != NULL) + if (channelItem != NULL) { - if(channelItem->isSelected()) + if (channelItem->isSelected()) selectedChannels.append(channelItem->getName()); } } diff --git a/Editor/guis/ChannelFilterGUIScene.h b/Editor/guis/ChannelFilterGUIScene.h index c8bd72d..a76c1e3 100644 --- a/Editor/guis/ChannelFilterGUIScene.h +++ b/Editor/guis/ChannelFilterGUIScene.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/CommentFilterGUI.cpp b/Editor/guis/CommentFilterGUI.cpp index 40b01bf..3137998 100644 --- a/Editor/guis/CommentFilterGUI.cpp +++ b/Editor/guis/CommentFilterGUI.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "CommentFilterGUI.h" @@ -49,7 +49,7 @@ CommentFilterGUI::~CommentFilterGUI() void CommentFilterGUI::configureChannels(vector& channelNames) { - if(ui->actionPowerOn->isChecked()) + if (ui->actionPowerOn->isChecked()) { child->configureChannels(channelNames); } @@ -65,7 +65,7 @@ void CommentFilterGUI::store(QString& command, QString& parameters) { child->store(command, parameters); - if(!ui->actionPowerOn->isChecked()) + if (!ui->actionPowerOn->isChecked()) command = "# " + command; } diff --git a/Editor/guis/CommentFilterGUI.h b/Editor/guis/CommentFilterGUI.h index 4886850..313d770 100644 --- a/Editor/guis/CommentFilterGUI.h +++ b/Editor/guis/CommentFilterGUI.h @@ -1,28 +1,27 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once #include "Editor/IFilterGUI.h" -namespace Ui -{ +namespace Ui { class CommentFilterGUI; } diff --git a/Editor/guis/CommentFilterGUIFactory.cpp b/Editor/guis/CommentFilterGUIFactory.cpp index a73d59e..58c5b31 100644 --- a/Editor/guis/CommentFilterGUIFactory.cpp +++ b/Editor/guis/CommentFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "helpers/StringHelper.h" @@ -37,7 +37,7 @@ QList CommentFilterGUIFactory::createFilterTemplates() IFilterGUI* CommentFilterGUIFactory::createFilterGUI(QString& command, QString& parameters) { lastWasComment = command.length() > 0 && command[0] == '#'; - if(lastWasComment) + if (lastWasComment) command = command.mid(1).trimmed(); return NULL; diff --git a/Editor/guis/CommentFilterGUIFactory.h b/Editor/guis/CommentFilterGUIFactory.h index 8679ba8..b27a15e 100644 --- a/Editor/guis/CommentFilterGUIFactory.h +++ b/Editor/guis/CommentFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/ConvolutionFilterGUI.cpp b/Editor/guis/ConvolutionFilterGUI.cpp index a5d414e..b88f27b 100644 --- a/Editor/guis/ConvolutionFilterGUI.cpp +++ b/Editor/guis/ConvolutionFilterGUI.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -24,8 +24,8 @@ #include "ConvolutionFilterGUI.h" #include "ui_ConvolutionFilterGUI.h" -ConvolutionFilterGUI::ConvolutionFilterGUI(const QString& configPath, unsigned deviceSampleRate, const QString& path) : - ui(new Ui::ConvolutionFilterGUI), deviceSampleRate(deviceSampleRate) +ConvolutionFilterGUI::ConvolutionFilterGUI(const QString& configPath, unsigned deviceSampleRate, const QString& path) + : ui(new Ui::ConvolutionFilterGUI), deviceSampleRate(deviceSampleRate) { ui->setupUi(this); @@ -51,19 +51,19 @@ void ConvolutionFilterGUI::on_selectFileToolButton_clicked() QFileInfo fileInfo(configPath); QDir configDir = fileInfo.absoluteDir(); QString path = ui->pathLineEdit->text(); - if(path.length() > 0) + if (path.length() > 0) fileInfo.setFile(configDir, path); QFileDialog dialog(this, tr("Select impulse response file"), fileInfo.absolutePath(), "*.wav;*.flac;*.ogg"); dialog.setFileMode(QFileDialog::ExistingFile); dialog.setNameFilter(tr("Impulse response (*.wav *.flac *.ogg)")); - if(path.length() > 0) + if (path.length() > 0) dialog.selectFile(fileInfo.fileName()); - if(dialog.exec() == QDialog::Accepted) + if (dialog.exec() == QDialog::Accepted) { QString absolutePath = dialog.selectedFiles().first(); QString relativePath = configDir.relativeFilePath(absolutePath); - if(relativePath.startsWith("../../")) + if (relativePath.startsWith("../../")) relativePath = absolutePath; ui->pathLineEdit->setText(QDir::toNativeSeparators(relativePath)); updateFileInfo(); @@ -85,7 +85,7 @@ void ConvolutionFilterGUI::updateFileInfo() QString error = ""; QString path = ui->pathLineEdit->text(); - if(path.length() == 0) + if (path.length() == 0) { error = tr("No file selected"); labelsVisible = false; @@ -95,7 +95,7 @@ void ConvolutionFilterGUI::updateFileInfo() QFileInfo fileInfo(configPath); QDir configDir = fileInfo.absoluteDir(); fileInfo.setFile(configDir, path); - if(!fileInfo.exists()) + if (!fileInfo.exists()) { error = tr("File not found"); labelsVisible = false; @@ -106,7 +106,7 @@ void ConvolutionFilterGUI::updateFileInfo() SF_INFO info; SNDFILE* file = sf_wchar_open(path.toStdWString().c_str(), SFM_READ, &info); - if(file == NULL) + if (file == NULL) { error = tr("Unsupported file format"); labelsVisible = false; @@ -120,7 +120,7 @@ void ConvolutionFilterGUI::updateFileInfo() ui->labelSampleRateValue->setText(tr("%0 Hz").arg(sampleRate)); sf_close(file); - if(sampleRate != deviceSampleRate) + if (sampleRate != deviceSampleRate) { error = tr("The file sample rate does not match the device sample rate (%0 Hz)!\nSelect a different file or change the device configuration.").arg(deviceSampleRate); } diff --git a/Editor/guis/ConvolutionFilterGUI.h b/Editor/guis/ConvolutionFilterGUI.h index b9de55e..b5a81d2 100644 --- a/Editor/guis/ConvolutionFilterGUI.h +++ b/Editor/guis/ConvolutionFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -43,7 +43,7 @@ private slots: private: void updateFileInfo(); - Ui::ConvolutionFilterGUI *ui; + Ui::ConvolutionFilterGUI* ui; QString configPath; unsigned deviceSampleRate; }; diff --git a/Editor/guis/ConvolutionFilterGUIFactory.cpp b/Editor/guis/ConvolutionFilterGUIFactory.cpp index d4fa61e..64211cd 100644 --- a/Editor/guis/ConvolutionFilterGUIFactory.cpp +++ b/Editor/guis/ConvolutionFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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" @@ -47,7 +47,7 @@ IFilterGUI* ConvolutionFilterGUIFactory::createFilterGUI(QString& command, QStri { ConvolutionFilterGUI* result = NULL; - if(command == "Convolution") + if (command == "Convolution") { result = new ConvolutionFilterGUI(configPath, deviceSampleRate, parameters.trimmed()); } diff --git a/Editor/guis/ConvolutionFilterGUIFactory.h b/Editor/guis/ConvolutionFilterGUIFactory.h index 8518a01..5fc4fec 100644 --- a/Editor/guis/ConvolutionFilterGUIFactory.h +++ b/Editor/guis/ConvolutionFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/CopyFilterGUI.cpp b/Editor/guis/CopyFilterGUI.cpp index 6f0c33c..953a76d 100644 --- a/Editor/guis/CopyFilterGUI.cpp +++ b/Editor/guis/CopyFilterGUI.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "Editor/widgets/ResizeCorner.h" @@ -27,8 +27,8 @@ static const int DEFAULT_HEIGHT = 88; using namespace std; -CopyFilterGUI::CopyFilterGUI(CopyFilter* filter, FilterTable* filterTable) : - ui(new Ui::CopyFilterGUI) +CopyFilterGUI::CopyFilterGUI(CopyFilter* filter, FilterTable* filterTable) + : ui(new Ui::CopyFilterGUI) { ui->setupUi(this); @@ -40,10 +40,10 @@ CopyFilterGUI::CopyFilterGUI(CopyFilter* filter, FilterTable* filterTable) : ResizeCorner* cornerWidget = new ResizeCorner(filterTable, QSize(0, 50), QSize(0, INT_MAX), - [this]() { + [this]() { return QSize(0, ui->scrollArea->height()); }, - [this](QSize size) { + [this](QSize size) { ui->scrollArea->setFixedHeight(size.height()); }, ui->scrollArea); cornerWidget->setCursor(Qt::SizeVerCursor); @@ -66,7 +66,7 @@ void CopyFilterGUI::configureChannels(vector& channelNames) { vector assignments = ui->form->buildAssignments(); - if(channelNames != inputChannelNames) + if (channelNames != inputChannelNames) { inputChannelNames = channelNames; @@ -74,24 +74,24 @@ void CopyFilterGUI::configureChannels(vector& channelNames) ui->form->setChannelNames(channelNames); } - for(Assignment assignment : assignments) + for (Assignment assignment : assignments) { - if(assignment.targetChannel == L"") + if (assignment.targetChannel == L"") continue; bool hasSummand = false; - for(Assignment::Summand summand : assignment.sourceSum) + for (Assignment::Summand summand : assignment.sourceSum) { - if(summand.channel != L" ") + if (summand.channel != L" ") { hasSummand = true; break; } } - if(!hasSummand) + if (!hasSummand) continue; int channelIndex = ChannelHelper::getChannelIndex(assignment.targetChannel, channelNames, true); - if(channelIndex == -1) + if (channelIndex == -1) channelNames.push_back(assignment.targetChannel); } } @@ -102,29 +102,29 @@ void CopyFilterGUI::store(QString& command, QString& parameters) std::vector assignments; - if(ui->tabWidget->currentIndex() == 0) + if (ui->tabWidget->currentIndex() == 0) assignments = scene->buildAssignments(); else assignments = ui->form->buildAssignments(); bool firstAssignment = true; - for(const Assignment& assignment : assignments) + for (const Assignment& assignment : assignments) { - if(assignment.targetChannel == L"") + if (assignment.targetChannel == L"") continue; bool firstSummand = true; - for(const Assignment::Summand& summand : assignment.sourceSum) + for (const Assignment::Summand& summand : assignment.sourceSum) { // skip not yet filled row - if(summand.channel == L" ") + if (summand.channel == L" ") continue; - if(firstSummand) + if (firstSummand) { firstSummand = false; - if(firstAssignment) + if (firstAssignment) firstAssignment = false; else parameters += " "; @@ -140,25 +140,25 @@ void CopyFilterGUI::store(QString& command, QString& parameters) bool hasChannel = summand.channel != L""; bool hasFactor = !hasChannel || summand.factor != 1.0 || summand.isDecibel; - if(hasFactor) + if (hasFactor) { QString factorString; factorString.setNum(summand.factor); - if(factorString != "0" && !factorString.contains('.')) + if (factorString != "0" && !factorString.contains('.')) factorString += ".0"; parameters += factorString; - if(summand.isDecibel) + if (summand.isDecibel) parameters += "dB"; } - if(hasFactor && hasChannel) + if (hasFactor && hasChannel) parameters += "*"; - if(hasChannel) + if (hasChannel) parameters += QString::fromStdWString(summand.channel); } - if(ui->tabWidget->currentIndex() == 0) + if (ui->tabWidget->currentIndex() == 0) ui->form->load(assignments); else scene->load(inputChannelNames, assignments); @@ -173,8 +173,8 @@ void CopyFilterGUI::loadPreferences(const QVariantMap& prefs) void CopyFilterGUI::storePreferences(QVariantMap& prefs) { - if(ui->scrollArea->height() != DEFAULT_HEIGHT) + if (ui->scrollArea->height() != DEFAULT_HEIGHT) prefs.insert("height", ui->scrollArea->height()); - if(ui->tabWidget->currentIndex() != 0) + if (ui->tabWidget->currentIndex() != 0) prefs.insert("tabIndex", ui->tabWidget->currentIndex()); } diff --git a/Editor/guis/CopyFilterGUI.h b/Editor/guis/CopyFilterGUI.h index 718c19a..5be98c3 100644 --- a/Editor/guis/CopyFilterGUI.h +++ b/Editor/guis/CopyFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -44,7 +44,7 @@ public: void storePreferences(QVariantMap& prefs) override; private: - Ui::CopyFilterGUI *ui; + Ui::CopyFilterGUI* ui; CopyFilterGUIScene* scene; std::vector inputChannelNames; diff --git a/Editor/guis/CopyFilterGUIChannelItem.cpp b/Editor/guis/CopyFilterGUIChannelItem.cpp index c4e12f8..e2ae3e1 100644 --- a/Editor/guis/CopyFilterGUIChannelItem.cpp +++ b/Editor/guis/CopyFilterGUIChannelItem.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -22,8 +22,8 @@ #include "CopyFilterGUIScene.h" #include "CopyFilterGUIChannelItem.h" -CopyFilterGUIChannelItem::CopyFilterGUIChannelItem(const QString& name, bool output) : - ChannelGraphItem(name), output(output) +CopyFilterGUIChannelItem::CopyFilterGUIChannelItem(const QString& name, bool output) + : ChannelGraphItem(name), output(output) { setZValue(-1); } @@ -31,19 +31,19 @@ CopyFilterGUIChannelItem::CopyFilterGUIChannelItem(const QString& name, bool out void CopyFilterGUIChannelItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { QColor color; - if(output) + if (output) color = QColor(255, 194, 194); else color = QColor(176, 255, 176); - ChannelGraphItem::paint(painter, color) ; + ChannelGraphItem::paint(painter, color); } QPointF CopyFilterGUIChannelItem::getPerimeterPointTo(QPointF oppositePoint) { QRectF rect = boundingRect(); - if(output) + if (output) return scenePos() + QPointF(rect.center().x(), rect.top()); else return scenePos() + QPointF(rect.center().x(), rect.top() + rect.height()); @@ -54,10 +54,10 @@ CopyFilterGUIChannelItem* CopyFilterGUIChannelItem::findAt(QPointF mousePos) CopyFilterGUIChannelItem* result = NULL; QList items = scene()->items(mousePos); - for(QGraphicsItem* item : items) + for (QGraphicsItem* item : items) { CopyFilterGUIChannelItem* channelItem = qgraphicsitem_cast(item); - if(channelItem != NULL && channelItem->output != output) + if (channelItem != NULL && channelItem->output != output) { result = channelItem; break; @@ -74,7 +74,7 @@ QLineF CopyFilterGUIChannelItem::getLineTo(CopyFilterGUIChannelItem* item) QPointF startPoint = getPerimeterPointTo(endPoint); QLineF line; - if(output) + if (output) line = QLineF(endPoint, startPoint); else line = QLineF(startPoint, endPoint); @@ -88,23 +88,23 @@ void CopyFilterGUIChannelItem::mousePressEvent(QGraphicsSceneMouseEvent* event) void CopyFilterGUIChannelItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) { - if(currentConnection == NULL) + if (currentConnection == NULL) { - if( !boundingRect().contains(event->pos())) + if (!boundingRect().contains(event->pos())) { currentConnection = new CopyFilterGUIConnectionItem(); scene()->addItem(currentConnection); } } - if(currentConnection != NULL) + if (currentConnection != NULL) { CopyFilterGUIChannelItem* item = findAt(event->scenePos()); - if(item == NULL) + if (item == NULL) { QLineF line; - if(output) + if (output) line = QLineF(event->scenePos(), getPerimeterPointTo(event->scenePos())); else line = QLineF(getPerimeterPointTo(event->scenePos()), event->scenePos()); @@ -119,14 +119,14 @@ void CopyFilterGUIChannelItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) void CopyFilterGUIChannelItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { - if(currentConnection != NULL) + if (currentConnection != NULL) { CopyFilterGUIChannelItem* item = findAt(event->scenePos()); - if(item != NULL) + if (item != NULL) { CopyFilterGUIChannelItem* source; CopyFilterGUIChannelItem* target; - if(output) + if (output) { source = item; target = this; @@ -138,13 +138,13 @@ void CopyFilterGUIChannelItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event } double factor = 1.0; - if(source->getName() == "") + if (source->getName() == "") factor = 0.0; scene()->addItem(new CopyFilterGUIConnectionItem(source, target, factor, false)); - emit ((CopyFilterGUIScene*)scene())->updateModel(); - emit ((CopyFilterGUIScene*)scene())->updateChannels(); + emit((CopyFilterGUIScene*)scene())->updateModel(); + emit((CopyFilterGUIScene*)scene())->updateChannels(); } scene()->removeItem(currentConnection); @@ -155,12 +155,12 @@ void CopyFilterGUIChannelItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event { scene()->clearSelection(); QList items = scene()->items(); - for(QGraphicsItem* item : items) + for (QGraphicsItem* item : items) { CopyFilterGUIConnectionItem* connItem = qgraphicsitem_cast(item); - if(connItem != NULL) + if (connItem != NULL) { - if(connItem->getSource() == this || connItem->getTarget() == this) + if (connItem->getSource() == this || connItem->getTarget() == this) connItem->setSelected(true); } } diff --git a/Editor/guis/CopyFilterGUIChannelItem.h b/Editor/guis/CopyFilterGUIChannelItem.h index a9b5bdc..fcd3ffe 100644 --- a/Editor/guis/CopyFilterGUIChannelItem.h +++ b/Editor/guis/CopyFilterGUIChannelItem.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -30,7 +30,7 @@ class CopyFilterGUIChannelItem : public ChannelGraphItem public: CopyFilterGUIChannelItem(const QString& name, bool output); - enum { Type = UserType + 2 }; + enum {Type = UserType + 2}; virtual int type() const { return Type; diff --git a/Editor/guis/CopyFilterGUIConnectionItem.cpp b/Editor/guis/CopyFilterGUIConnectionItem.cpp index b3f9ed1..01dc468 100644 --- a/Editor/guis/CopyFilterGUIConnectionItem.cpp +++ b/Editor/guis/CopyFilterGUIConnectionItem.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -64,7 +64,7 @@ QPainterPath CopyFilterGUIConnectionItem::shape() const QPainterPath path; path.setFillRule(Qt::WindingFill); double length = line().length(); - if(length > 0) + if (length > 0) { double offset = min(length, maxArrowSize); QLineF unit = l.unitVector(); @@ -89,13 +89,13 @@ QPainterPath CopyFilterGUIConnectionItem::shape() const polygon2.append(p1 + 3 * n); path.addPolygon(polygon2); - if(factor != 1.0 || isDecibel) + if (factor != 1.0 || isDecibel) { QFont font; font.setPixelSize(10); QPointF center = (l.p1() + l.p2()) / 2; QString text = QString("%1").arg(factor); - if(isDecibel) + if (isDecibel) text += " dB"; QFontMetrics fontMetrics(font); @@ -119,10 +119,10 @@ bool CopyFilterGUIConnectionItem::contains(const QPointF& point) const void CopyFilterGUIConnectionItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { QLineF l = line(); - if(!l.isNull()) + if (!l.isNull()) { painter->setBrush(Qt::black); - if(isSelected()) + if (isSelected()) { painter->setBrush(Qt::blue); painter->setPen(QPen(Qt::blue, 1.5)); @@ -146,14 +146,14 @@ void CopyFilterGUIConnectionItem::paint(QPainter* painter, const QStyleOptionGra painter->drawPolygon(polygon); - if(factor != 1.0 || isDecibel) + if (factor != 1.0 || isDecibel) { QFont font = painter->font(); font.setPixelSize(10); painter->setFont(font); QPointF center = (l.p1() + l.p2()) / 2; QString text = QString("%1").arg(factor); - if(isDecibel) + if (isDecibel) text += " dB"; QSizeF size = painter->fontMetrics().size(0, text); @@ -171,7 +171,7 @@ void CopyFilterGUIConnectionItem::paint(QPainter* painter, const QStyleOptionGra void CopyFilterGUIConnectionItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) { QString text = QString("%1").arg(factor); - if(isDecibel) + if (isDecibel) text += " dB"; ResizingLineEdit* lineEdit = new ResizingLineEdit(""); @@ -199,7 +199,7 @@ void CopyFilterGUIConnectionItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* even QVariant CopyFilterGUIConnectionItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant& value) { - if(change == ItemSelectedHasChanged) + if (change == ItemSelectedHasChanged) { setZValue(isSelected() ? 1 : 0); } @@ -211,7 +211,7 @@ void CopyFilterGUIConnectionItem::lineEditEditingFinished() { QLineEdit* lineEdit = qobject_cast(QObject::sender()); // might be called twice - if(!lineEdit->isVisible()) + if (!lineEdit->isVisible()) return; QString text = lineEdit->text(); @@ -220,7 +220,7 @@ void CopyFilterGUIConnectionItem::lineEditEditingFinished() int lengthBefore = text.length(); text.replace("db", "", Qt::CaseInsensitive); double value = text.toDouble(&ok); - if(ok) + if (ok) { factor = value; isDecibel = text.length() < lengthBefore; @@ -229,7 +229,7 @@ void CopyFilterGUIConnectionItem::lineEditEditingFinished() lineEdit->setVisible(false); lineEdit->deleteLater(); - emit ((CopyFilterGUIScene*)scene())->updateModel(); + emit((CopyFilterGUIScene*)scene())->updateModel(); } CopyFilterGUIChannelItem* CopyFilterGUIConnectionItem::getSource() const diff --git a/Editor/guis/CopyFilterGUIConnectionItem.h b/Editor/guis/CopyFilterGUIConnectionItem.h index ff3b977..9e5036d 100644 --- a/Editor/guis/CopyFilterGUIConnectionItem.h +++ b/Editor/guis/CopyFilterGUIConnectionItem.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -31,7 +31,7 @@ public: CopyFilterGUIConnectionItem(); CopyFilterGUIConnectionItem(CopyFilterGUIChannelItem* source, CopyFilterGUIChannelItem* target, double factor, bool isDecibel); - enum { Type = UserType + 1 }; + enum {Type = UserType + 1}; virtual int type() const { return Type; diff --git a/Editor/guis/CopyFilterGUIFactory.cpp b/Editor/guis/CopyFilterGUIFactory.cpp index a1a06a4..eaa7b23 100644 --- a/Editor/guis/CopyFilterGUIFactory.cpp +++ b/Editor/guis/CopyFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "filters/CopyFilter.h" @@ -42,17 +42,17 @@ IFilterGUI* CopyFilterGUIFactory::createFilterGUI(QString& command, QString& par { CopyFilterGUI* result = NULL; - if(command == "Copy") + if (command == "Copy") { CopyFilterFactory factory; std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); - if(!filters.empty()) + if (!filters.empty()) { CopyFilter* filter = (CopyFilter*)filters[0]; result = new CopyFilterGUI(filter, filterTable); } - for(IFilter* f : filters) + for (IFilter* f : filters) { f->~IFilter(); MemoryHelper::free(f); diff --git a/Editor/guis/CopyFilterGUIFactory.h b/Editor/guis/CopyFilterGUIFactory.h index efd96dc..5a57f1e 100644 --- a/Editor/guis/CopyFilterGUIFactory.h +++ b/Editor/guis/CopyFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/CopyFilterGUIForm.cpp b/Editor/guis/CopyFilterGUIForm.cpp index 55f5401..1346722 100644 --- a/Editor/guis/CopyFilterGUIForm.cpp +++ b/Editor/guis/CopyFilterGUIForm.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -29,20 +29,20 @@ using namespace std; -CopyFilterGUIForm::CopyFilterGUIForm(QWidget *parent) : - QWidget(parent) +CopyFilterGUIForm::CopyFilterGUIForm(QWidget* parent) + : QWidget(parent) { } void CopyFilterGUIForm::load(vector assignments) { - if(gridLayout != NULL) + if (gridLayout != NULL) delete gridLayout; - for(QObject* object : children()) + for (QObject* object : children()) { QWidget* widget = qobject_cast(object); - if(widget != NULL) + if (widget != NULL) widget->setVisible(false); object->deleteLater(); } @@ -55,20 +55,20 @@ void CopyFilterGUIForm::load(vector assignments) gridLayout->setColumnStretch(5, 1); int row = 0; - for(Assignment assignment : assignments) + for (Assignment assignment : assignments) { QString oc = QString::fromStdWString(assignment.targetChannel); bool firstSummand = true; - for(Assignment::Summand summand : assignment.sourceSum) + for (Assignment::Summand summand : assignment.sourceSum) { - if(firstSummand) + if (firstSummand) { gridLayout->addWidget(new QLabel(tr("Channel"), this), row, 0); QComboBox* targetComboBox = new QComboBox(this); targetComboBox->setEditable(true); - for(wstring channelName : inputChannelNames) + for (wstring channelName : inputChannelNames) targetComboBox->addItem(QString::fromStdWString(channelName)); targetComboBox->setEditText(oc); connect(targetComboBox, SIGNAL(editTextChanged(QString)), this, SIGNAL(updateModel())); @@ -96,7 +96,7 @@ void CopyFilterGUIForm::load(vector assignments) connect(addSummandButton, SIGNAL(pressed()), this, SLOT(addSummand())); QPushButton* removeButton = new QPushButton(this); - if(assignment.sourceSum.size() == 1) + if (assignment.sourceSum.size() == 1) removeButton->setText(tr("Remove assignment")); else removeButton->setText(tr("Remove summand")); @@ -122,16 +122,16 @@ void CopyFilterGUIForm::setChannelNames(const vector& channelNames) { inputChannelNames = channelNames; - for(int row = 0; row < gridLayout->rowCount() - 1; row++) + for (int row = 0; row < gridLayout->rowCount() - 1; row++) { QLayoutItem* item = gridLayout->itemAtPosition(row, 1); - if(item != NULL) + if (item != NULL) { QComboBox* targetComboBox = qobject_cast(item->widget()); targetComboBox->blockSignals(true); QString text = targetComboBox->currentText(); targetComboBox->clear(); - for(wstring channelName : channelNames) + for (wstring channelName : channelNames) targetComboBox->addItem(QString::fromStdWString(channelName)); targetComboBox->setEditText(text); targetComboBox->blockSignals(false); @@ -148,10 +148,10 @@ vector CopyFilterGUIForm::buildAssignments(QWidget* pressedButton) vector assignments; Assignment* currentAssignment = NULL; - for(int row = 0; row < gridLayout->rowCount() - 1; row++) + for (int row = 0; row < gridLayout->rowCount() - 1; row++) { QLayoutItem* item = gridLayout->itemAtPosition(row, 1); - if(item != NULL) + if (item != NULL) { QComboBox* targetComboBox = qobject_cast(item->widget()); QString oc = targetComboBox->currentText().trimmed(); @@ -160,12 +160,12 @@ vector CopyFilterGUIForm::buildAssignments(QWidget* pressedButton) currentAssignment->targetChannel = oc.toStdWString(); } - if(currentAssignment != NULL) + if (currentAssignment != NULL) { - if(pressedButton != NULL) + if (pressedButton != NULL) { QWidget* removeButton = gridLayout->itemAtPosition(row, 5)->widget(); - if(removeButton == pressedButton) + if (removeButton == pressedButton) { continue; } @@ -175,10 +175,10 @@ vector CopyFilterGUIForm::buildAssignments(QWidget* pressedButton) CopyFilterGUIRow* summandWidget = qobject_cast(summandItem->widget()); currentAssignment->sourceSum.push_back(summandWidget->buildSummand()); - if(pressedButton != NULL) + if (pressedButton != NULL) { QWidget* addSummandButton = gridLayout->itemAtPosition(row, 4)->widget(); - if(addSummandButton == pressedButton) + if (addSummandButton == pressedButton) { Assignment::Summand newSummand; newSummand.channel = L" "; diff --git a/Editor/guis/CopyFilterGUIForm.h b/Editor/guis/CopyFilterGUIForm.h index 7cc325c..cbb7b92 100644 --- a/Editor/guis/CopyFilterGUIForm.h +++ b/Editor/guis/CopyFilterGUIForm.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -29,7 +29,7 @@ class CopyFilterGUIForm : public QWidget { Q_OBJECT public: - explicit CopyFilterGUIForm(QWidget *parent = 0); + explicit CopyFilterGUIForm(QWidget* parent = 0); void load(std::vector assignments); void setChannelNames(const std::vector& channelNames); diff --git a/Editor/guis/CopyFilterGUIRow.cpp b/Editor/guis/CopyFilterGUIRow.cpp index 3a6d681..ea5e852 100644 --- a/Editor/guis/CopyFilterGUIRow.cpp +++ b/Editor/guis/CopyFilterGUIRow.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "CopyFilterGUIRow.h" @@ -22,8 +22,8 @@ using namespace std; -CopyFilterGUIRow::CopyFilterGUIRow(Assignment::Summand summand, std::vector channelNames, QWidget *parent) : - QWidget(parent), +CopyFilterGUIRow::CopyFilterGUIRow(Assignment::Summand summand, std::vector channelNames, QWidget* parent) + : QWidget(parent), ui(new Ui::CopyFilterGUIRow) { ui->setupUi(this); @@ -34,11 +34,11 @@ CopyFilterGUIRow::CopyFilterGUIRow(Assignment::Summand summand, std::vectormodeComboBox->addItem(tr("Constant value"), 'v'); QChar mode; - if(summand.channel == L"") + if (summand.channel == L"") mode = 'v'; - else if(summand.isDecibel) + else if (summand.isDecibel) mode = 'd'; - else if(summand.factor != 1.0) + else if (summand.factor != 1.0) mode = 'f'; else mode = 'c'; @@ -47,7 +47,7 @@ CopyFilterGUIRow::CopyFilterGUIRow(Assignment::Summand summand, std::vectorfactorSpinBox->setValue(summand.factor); - for(wstring channelName : channelNames) + for (wstring channelName : channelNames) ui->channelComboBox->addItem(QString::fromStdWString(channelName)); ui->channelComboBox->setEditText(QString::fromStdWString(summand.channel).trimmed()); @@ -67,7 +67,7 @@ void CopyFilterGUIRow::setChannelNames(const vector& channelNames) ui->channelComboBox->blockSignals(true); QString text = ui->channelComboBox->currentText(); ui->channelComboBox->clear(); - for(wstring channelName : channelNames) + for (wstring channelName : channelNames) ui->channelComboBox->addItem(QString::fromStdWString(channelName)); ui->channelComboBox->setEditText(text); ui->channelComboBox->blockSignals(false); @@ -78,18 +78,18 @@ Assignment::Summand CopyFilterGUIRow::buildSummand() Assignment::Summand summand; QChar mode = ui->modeComboBox->currentData().toChar(); - if(mode != 'c') + if (mode != 'c') summand.factor = ui->factorSpinBox->value(); else summand.factor = 1.0; // fix for rounding error when using the spin buttons - if(abs(summand.factor) < 1e-10) + if (abs(summand.factor) < 1e-10) summand.factor = 0.0; - if(mode != 'v') + if (mode != 'v') summand.channel = ui->channelComboBox->currentText().trimmed().toStdWString(); // allow channel mode to be remembered when reloading - if(mode == 'c' && summand.channel == L"") + if (mode == 'c' && summand.channel == L"") summand.channel = L" "; summand.isDecibel = mode == 'd'; diff --git a/Editor/guis/CopyFilterGUIRow.h b/Editor/guis/CopyFilterGUIRow.h index 52a3e5a..0c0c68a 100644 --- a/Editor/guis/CopyFilterGUIRow.h +++ b/Editor/guis/CopyFilterGUIRow.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -32,7 +32,7 @@ class CopyFilterGUIRow : public QWidget Q_OBJECT public: - explicit CopyFilterGUIRow(Assignment::Summand summand, std::vector channelNames, QWidget *parent = 0); + explicit CopyFilterGUIRow(Assignment::Summand summand, std::vector channelNames, QWidget* parent = 0); ~CopyFilterGUIRow(); void setChannelNames(const std::vector& channelNames); @@ -46,5 +46,5 @@ private slots: void on_modeComboBox_currentIndexChanged(int index); private: - Ui::CopyFilterGUIRow *ui; + Ui::CopyFilterGUIRow* ui; }; diff --git a/Editor/guis/CopyFilterGUIScene.cpp b/Editor/guis/CopyFilterGUIScene.cpp index 9e71121..4587510 100644 --- a/Editor/guis/CopyFilterGUIScene.cpp +++ b/Editor/guis/CopyFilterGUIScene.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -39,7 +39,7 @@ void CopyFilterGUIScene::load(const vector& channelNames, vector& channelNames, vectorsetPos(getNextChannelPoint(lastOutputItem, true)); @@ -80,13 +80,13 @@ void CopyFilterGUIScene::load(const vector& channelNames, vectorsetPos(getNextChannelPoint(lastInputItem, false)); @@ -114,19 +114,19 @@ std::vector CopyFilterGUIScene::buildAssignments() { std::vector connItems; - for(QGraphicsItem* item : items()) + for (QGraphicsItem* item : items()) { CopyFilterGUIConnectionItem* connItem = qgraphicsitem_cast(item); - if(connItem != NULL && connItem->getTarget() != NULL) + if (connItem != NULL && connItem->getTarget() != NULL) { connItems.push_back(connItem); } } - std::sort(connItems.begin(), connItems.end(), [](CopyFilterGUIConnectionItem * a, CopyFilterGUIConnectionItem * b) + std::sort(connItems.begin(), connItems.end(), [](CopyFilterGUIConnectionItem* a, CopyFilterGUIConnectionItem* b) { double diff = a->getTarget()->x() - b->getTarget()->x(); - if(diff == 0.0) + if (diff == 0.0) diff = a->getSource()->x() - b->getSource()->x(); return diff < 0; @@ -134,11 +134,11 @@ std::vector CopyFilterGUIScene::buildAssignments() std::vector assignments; QHash channelAssignmentMap; - for(CopyFilterGUIConnectionItem* connItem : connItems) + for (CopyFilterGUIConnectionItem* connItem : connItems) { QString oc = connItem->getTarget()->getName(); Assignment* assignment = channelAssignmentMap.value(oc); - if(assignment == NULL) + if (assignment == NULL) { Assignment newAssignment; newAssignment.targetChannel = oc.toStdWString(); @@ -177,7 +177,7 @@ void CopyFilterGUIScene::lineEditEditingFinished() { QLineEdit* lineEdit = qobject_cast(QObject::sender()); // might be called twice - if(!lineEdit->isVisible()) + if (!lineEdit->isVisible()) return; QString text = lineEdit->text(); @@ -197,12 +197,12 @@ void CopyFilterGUIScene::lineEditEditingFinished() void CopyFilterGUIScene::keyPressEvent(QKeyEvent* event) { // focusItem != NULL means that the cursor is inside a line edit - if(event->key() == Qt::Key_Delete && focusItem() == NULL) + if (event->key() == Qt::Key_Delete && focusItem() == NULL) { - for(QGraphicsItem* item : selectedItems()) + for (QGraphicsItem* item : selectedItems()) { CopyFilterGUIConnectionItem* connectionItem = qgraphicsitem_cast(item); - if(connectionItem != NULL) + if (connectionItem != NULL) { removeItem(connectionItem); delete connectionItem; diff --git a/Editor/guis/CopyFilterGUIScene.h b/Editor/guis/CopyFilterGUIScene.h index dae8aec..1f4688b 100644 --- a/Editor/guis/CopyFilterGUIScene.h +++ b/Editor/guis/CopyFilterGUIScene.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/DelayFilterGUI.cpp b/Editor/guis/DelayFilterGUI.cpp index 1b84678..1773d3f 100644 --- a/Editor/guis/DelayFilterGUI.cpp +++ b/Editor/guis/DelayFilterGUI.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "DelayFilterGUI.h" @@ -24,8 +24,8 @@ static const double dialSteps = 1000; static const double dialMin = 1.0; static const double dialMax = 10000.0; -DelayFilterGUI::DelayFilterGUI(double delay, bool isMs) : - ui(new Ui::DelayFilterGUI) +DelayFilterGUI::DelayFilterGUI(double delay, bool isMs) + : ui(new Ui::DelayFilterGUI) { ui->setupUi(this); @@ -42,7 +42,7 @@ void DelayFilterGUI::store(QString& command, QString& parameters) { command = "Delay"; parameters = QString("%0").arg(ui->delaySpinBox->value()); - if(ui->unitComboBox->currentIndex() == 0) + if (ui->unitComboBox->currentIndex() == 0) parameters += " ms"; else parameters += " samples"; diff --git a/Editor/guis/DelayFilterGUI.h b/Editor/guis/DelayFilterGUI.h index 1107cd1..f0f2618 100644 --- a/Editor/guis/DelayFilterGUI.h +++ b/Editor/guis/DelayFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -43,5 +43,5 @@ private slots: void on_delaySpinBox_valueChanged(double value); private: - Ui::DelayFilterGUI *ui; + Ui::DelayFilterGUI* ui; }; diff --git a/Editor/guis/DelayFilterGUIFactory.cpp b/Editor/guis/DelayFilterGUIFactory.cpp index 1987547..fade3fa 100644 --- a/Editor/guis/DelayFilterGUIFactory.cpp +++ b/Editor/guis/DelayFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "filters/DelayFilter.h" @@ -37,17 +37,17 @@ IFilterGUI* DelayFilterGUIFactory::createFilterGUI(QString& command, QString& pa { DelayFilterGUI* result = NULL; - if(command == "Delay") + if (command == "Delay") { DelayFilterFactory factory; std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); - if(!filters.empty()) + if (!filters.empty()) { DelayFilter* filter = (DelayFilter*)filters[0]; result = new DelayFilterGUI(filter->getDelay(), filter->getIsMs()); } - for(IFilter* f : filters) + for (IFilter* f : filters) { f->~IFilter(); MemoryHelper::free(f); diff --git a/Editor/guis/DelayFilterGUIFactory.h b/Editor/guis/DelayFilterGUIFactory.h index 332dedc..26d1602 100644 --- a/Editor/guis/DelayFilterGUIFactory.h +++ b/Editor/guis/DelayFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -29,5 +29,5 @@ public: explicit DelayFilterGUIFactory(); QList createFilterTemplates() override; - IFilterGUI*createFilterGUI(QString& command, QString& parameters) override;; + IFilterGUI* createFilterGUI(QString& command, QString& parameters) override;; }; diff --git a/Editor/guis/DeviceFilterGUI.cpp b/Editor/guis/DeviceFilterGUI.cpp index 0d8919d..1641163 100644 --- a/Editor/guis/DeviceFilterGUI.cpp +++ b/Editor/guis/DeviceFilterGUI.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -25,8 +25,8 @@ using namespace std; -DeviceFilterGUI::DeviceFilterGUI(DeviceFilterGUIFactory* factory): - ui(new Ui::DeviceFilterGUI) +DeviceFilterGUI::DeviceFilterGUI(DeviceFilterGUIFactory* factory) + : ui(new Ui::DeviceFilterGUI) { ui->setupUi(this); this->factory = factory; @@ -52,7 +52,7 @@ void DeviceFilterGUI::load(const QString& parameters) QTreeWidgetItem* lastItem = NULL; - if(parameters.trimmed() == "all") + if (parameters.trimmed() == "all") { QStringList values; values.append(""); @@ -64,23 +64,23 @@ void DeviceFilterGUI::load(const QString& parameters) else { const QList& devices = factory->getDevices(); - for(const DeviceAPOInfo& apoInfo : devices) + for (const DeviceAPOInfo& apoInfo : devices) { - if(!apoInfo.isInstalled) + if (!apoInfo.isInstalled) continue; wstring deviceString = apoInfo.connectionName + L" " + apoInfo.deviceName + L" " + apoInfo.deviceGuid; - if(DeviceFilterFactory::matchDevice(deviceString, pattern.toStdWString())) + if (DeviceFilterFactory::matchDevice(deviceString, pattern.toStdWString())) { QStringList values; - if(apoInfo.isInput) + if (apoInfo.isInput) values.append(tr("Capture")); else values.append(tr("Playback")); values.append(QString::fromStdWString(apoInfo.connectionName)); values.append(QString::fromStdWString(apoInfo.deviceName)); QString state; - if(apoInfo.isInstalled) + if (apoInfo.isInstalled) state = tr("APO installed"); else state = tr("APO not installed"); @@ -89,7 +89,7 @@ void DeviceFilterGUI::load(const QString& parameters) } } - if(ui->treeWidget->topLevelItemCount() == 0) + if (ui->treeWidget->topLevelItemCount() == 0) { QStringList values; values.append(""); @@ -102,12 +102,12 @@ void DeviceFilterGUI::load(const QString& parameters) } } - for(int i = 0; i < ui->treeWidget->columnCount(); i++) + for (int i = 0; i < ui->treeWidget->columnCount(); i++) ui->treeWidget->resizeColumnToContents(i); int headerHeight = ui->treeWidget->header()->height(); int itemAreaHeight = 0; - if(lastItem != NULL) + if (lastItem != NULL) itemAreaHeight = ui->treeWidget->visualItemRect(lastItem).bottom() + 1; ui->treeWidget->setFixedHeight(headerHeight + itemAreaHeight + 3); } @@ -121,7 +121,7 @@ void DeviceFilterGUI::store(QString& command, QString& parameters) void DeviceFilterGUI::on_pushButton_clicked() { DeviceFilterGUIDialog dialog(this, factory, pattern); - if(dialog.exec() == QDialog::Accepted) + if (dialog.exec() == QDialog::Accepted) { load(dialog.getPattern()); emit updateModel(); diff --git a/Editor/guis/DeviceFilterGUI.h b/Editor/guis/DeviceFilterGUI.h index faaa119..28a8770 100644 --- a/Editor/guis/DeviceFilterGUI.h +++ b/Editor/guis/DeviceFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -40,7 +40,7 @@ private slots: void on_pushButton_clicked(); private: - Ui::DeviceFilterGUI *ui; + Ui::DeviceFilterGUI* ui; DeviceFilterGUIFactory* factory; QString pattern; }; diff --git a/Editor/guis/DeviceFilterGUIDialog.cpp b/Editor/guis/DeviceFilterGUIDialog.cpp index ab6dc87..cef7db6 100644 --- a/Editor/guis/DeviceFilterGUIDialog.cpp +++ b/Editor/guis/DeviceFilterGUIDialog.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "DeviceFilterGUIDialog.h" @@ -24,8 +24,8 @@ using namespace std; -DeviceFilterGUIDialog::DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterGUIFactory* factory, const QString& pattern) : - QDialog(gui), +DeviceFilterGUIDialog::DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterGUIFactory* factory, const QString& pattern) + : QDialog(gui), ui(new Ui::DeviceFilterGUIDialog) { ui->setupUi(this); @@ -43,13 +43,13 @@ DeviceFilterGUIDialog::DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterG QTreeWidgetItem* inputNode = new QTreeWidgetItem(ui->treeWidget, QStringList(tr("Capture devices"))); inputNode->setExpanded(true); const QList& devices = factory->getDevices(); - for(const DeviceAPOInfo& apoInfo : devices) + for (const DeviceAPOInfo& apoInfo : devices) { QStringList values; values.append(QString::fromStdWString(apoInfo.connectionName)); values.append(QString::fromStdWString(apoInfo.deviceName)); QString state; - if(apoInfo.isInstalled) + if (apoInfo.isInstalled) state = tr("APO installed"); else state = tr("APO not installed"); @@ -61,12 +61,12 @@ DeviceFilterGUIDialog::DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterG item->setCheckState(0, matches ? Qt::Checked : Qt::Unchecked); item->setData(0, Qt::UserRole, QVariant::fromValue(&apoInfo)); item->setHidden(!matches && !apoInfo.isInstalled && ui->showOnlyInstalledCheckBox->isChecked()); - if(!apoInfo.isInstalled) - for(int i = 0; i < ui->treeWidget->columnCount(); i++) + if (!apoInfo.isInstalled) + for (int i = 0; i < ui->treeWidget->columnCount(); i++) item->setForeground(i, QBrush(Qt::gray)); } - for(int i = 0; i < ui->treeWidget->columnCount(); i++) + for (int i = 0; i < ui->treeWidget->columnCount(); i++) ui->treeWidget->resizeColumnToContents(i); } @@ -77,22 +77,22 @@ DeviceFilterGUIDialog::~DeviceFilterGUIDialog() QString DeviceFilterGUIDialog::getPattern() { - if(ui->allDevicesCheckBox->isChecked()) + if (ui->allDevicesCheckBox->isChecked()) { return "all"; } else { QString pattern = ""; - for(int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) + for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) { QTreeWidgetItem* groupItem = ui->treeWidget->topLevelItem(i); - for(int j = 0; j < groupItem->childCount(); j++) + for (int j = 0; j < groupItem->childCount(); j++) { QTreeWidgetItem* item = groupItem->child(j); - if(item->checkState(0) == Qt::Checked) + if (item->checkState(0) == Qt::Checked) { - if(pattern != "") + if (pattern != "") pattern += "; "; const DeviceAPOInfo* apoInfo = item->data(0, Qt::UserRole).value(); wstring deviceString = apoInfo->connectionName + L" " + apoInfo->deviceName + L" " + apoInfo->deviceGuid; @@ -112,10 +112,10 @@ void DeviceFilterGUIDialog::on_allDevicesCheckBox_toggled(bool checked) void DeviceFilterGUIDialog::on_showOnlyInstalledCheckBox_toggled(bool checked) { - for(int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) + for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) { QTreeWidgetItem* groupItem = ui->treeWidget->topLevelItem(i); - for(int j = 0; j < groupItem->childCount(); j++) + for (int j = 0; j < groupItem->childCount(); j++) { QTreeWidgetItem* item = groupItem->child(j); const DeviceAPOInfo* apoInfo = item->data(0, Qt::UserRole).value(); @@ -123,6 +123,6 @@ void DeviceFilterGUIDialog::on_showOnlyInstalledCheckBox_toggled(bool checked) } } - for(int i = 0; i < ui->treeWidget->columnCount(); i++) + for (int i = 0; i < ui->treeWidget->columnCount(); i++) ui->treeWidget->resizeColumnToContents(i); } diff --git a/Editor/guis/DeviceFilterGUIDialog.h b/Editor/guis/DeviceFilterGUIDialog.h index b573b72..d775a44 100644 --- a/Editor/guis/DeviceFilterGUIDialog.h +++ b/Editor/guis/DeviceFilterGUIDialog.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -33,7 +33,7 @@ class DeviceFilterGUIDialog : public QDialog Q_OBJECT public: - explicit DeviceFilterGUIDialog( DeviceFilterGUI* gui, DeviceFilterGUIFactory* factory, const QString& pattern); + explicit DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterGUIFactory* factory, const QString& pattern); ~DeviceFilterGUIDialog(); QString getPattern(); @@ -44,7 +44,7 @@ private slots: void on_showOnlyInstalledCheckBox_toggled(bool checked); private: - Ui::DeviceFilterGUIDialog *ui; + Ui::DeviceFilterGUIDialog* ui; }; Q_DECLARE_METATYPE(const DeviceAPOInfo*) diff --git a/Editor/guis/DeviceFilterGUIFactory.cpp b/Editor/guis/DeviceFilterGUIFactory.cpp index 3174fc9..264c85f 100644 --- a/Editor/guis/DeviceFilterGUIFactory.cpp +++ b/Editor/guis/DeviceFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "Editor/FilterTable.h" @@ -42,7 +42,7 @@ IFilterGUI* DeviceFilterGUIFactory::createFilterGUI(QString& command, QString& p { DeviceFilterGUI* result = NULL; - if(command == "Device") + if (command == "Device") { result = new DeviceFilterGUI(this); result->load(parameters); diff --git a/Editor/guis/DeviceFilterGUIFactory.h b/Editor/guis/DeviceFilterGUIFactory.h index 1456558..7dfa65e 100644 --- a/Editor/guis/DeviceFilterGUIFactory.h +++ b/Editor/guis/DeviceFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/ExpressionFilterGUIFactory.cpp b/Editor/guis/ExpressionFilterGUIFactory.cpp index 9c564bd..7597103 100644 --- a/Editor/guis/ExpressionFilterGUIFactory.cpp +++ b/Editor/guis/ExpressionFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "ExpressionFilterGUIFactory.h" @@ -22,7 +22,7 @@ IFilterGUI* ExpressionFilterGUIFactory::createFilterGUI(QString& command, QString& parameters) { // do not create a gui if parameters contain expressions - if(parameters.contains('`')) + if (parameters.contains('`')) command = ""; return NULL; diff --git a/Editor/guis/ExpressionFilterGUIFactory.h b/Editor/guis/ExpressionFilterGUIFactory.h index 624b3a5..c68da20 100644 --- a/Editor/guis/ExpressionFilterGUIFactory.h +++ b/Editor/guis/ExpressionFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/GraphicEQFilterGUI.cpp b/Editor/guis/GraphicEQFilterGUI.cpp index edd849d..3ca45df 100644 --- a/Editor/guis/GraphicEQFilterGUI.cpp +++ b/Editor/guis/GraphicEQFilterGUI.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -36,8 +36,8 @@ using namespace std; QRegularExpression GraphicEQFilterGUI::numberRegEx("[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?"); -GraphicEQFilterGUI::GraphicEQFilterGUI(GraphicEQFilter* filter, QString configPath, FilterTable* filterTable) : - ui(new Ui::GraphicEQFilterGUI), configPath(configPath) +GraphicEQFilterGUI::GraphicEQFilterGUI(GraphicEQFilter* filter, QString configPath, FilterTable* filterTable) + : ui(new Ui::GraphicEQFilterGUI), configPath(configPath) { ui->setupUi(this); @@ -46,10 +46,10 @@ GraphicEQFilterGUI::GraphicEQFilterGUI(GraphicEQFilter* filter, QString configPa ResizeCorner* cornerWidget = new ResizeCorner(filterTable, QSize(0, ui->graphicsView->minimumHeight()), QSize(10000 - ui->tableWidget->minimumWidth(), INT_MAX), - [this]() { + [this]() { return QSize(10000 - ui->tableWidget->width(), ui->graphicsView->height()); }, - [this](QSize size) { + [this](QSize size) { ui->tableWidget->setFixedWidth(10000 - size.width()); ui->graphicsView->setFixedHeight(size.height()); }, ui->graphicsView); @@ -71,7 +71,7 @@ GraphicEQFilterGUI::GraphicEQFilterGUI(GraphicEQFilter* filter, QString configPa scene->setNodes(filter->getNodes()); int bandCount = scene->verifyBands(filter->getNodes()); - switch(bandCount) + switch (bandCount) { case 15: ui->radioButton15->click(); @@ -91,14 +91,14 @@ GraphicEQFilterGUI::~GraphicEQFilterGUI() delete ui; } -void GraphicEQFilterGUI::store(QString & command, QString & parameters) +void GraphicEQFilterGUI::store(QString& command, QString& parameters) { command = "GraphicEQ"; bool first = true; - for(FilterNode node : scene->getNodes()) + for (FilterNode node : scene->getNodes()) { - if(first) + if (first) first = false; else parameters += "; "; @@ -113,7 +113,7 @@ void GraphicEQFilterGUI::loadPreferences(const QVariantMap& prefs) ui->graphicsView->setFixedHeight(prefs.value("viewHeight", DEFAULT_VIEW_HEIGHT).toInt()); double zoomX = prefs.value("zoomX", 1.0).toDouble(); double zoomY = prefs.value("zoomY", 1.0).toDouble(); - if(zoomX != 1.0 || zoomY != 1.0) + if (zoomX != 1.0 || zoomY != 1.0) scene->setZoom(zoomX, zoomY); int scrollX = prefs.value("scrollX", round(scene->hzToX(20))).toInt(); int scrollY = prefs.value("scrollY", round(scene->dbToY(22))).toInt(); @@ -122,21 +122,21 @@ void GraphicEQFilterGUI::loadPreferences(const QVariantMap& prefs) void GraphicEQFilterGUI::storePreferences(QVariantMap& prefs) { - if(ui->tableWidget->width() != DEFAULT_TABLE_WIDTH) + if (ui->tableWidget->width() != DEFAULT_TABLE_WIDTH) prefs.insert("tableWidth", ui->tableWidget->width()); - if(ui->graphicsView->height() != DEFAULT_VIEW_HEIGHT) + if (ui->graphicsView->height() != DEFAULT_VIEW_HEIGHT) prefs.insert("viewHeight", ui->graphicsView->height()); - if(scene->getZoomX() != 1.0) + if (scene->getZoomX() != 1.0) prefs.insert("zoomX", scene->getZoomX()); - if(scene->getZoomY() != 1.0) + if (scene->getZoomY() != 1.0) prefs.insert("zoomY", scene->getZoomY()); QScrollBar* hScrollBar = ui->graphicsView->horizontalScrollBar(); int value = hScrollBar->value(); - if(value != round(scene->hzToX(20))) + if (value != round(scene->hzToX(20))) prefs.insert("scrollX", value); QScrollBar* vScrollBar = ui->graphicsView->verticalScrollBar(); value = vScrollBar->value(); - if(value != round(scene->dbToY(22))) + if (value != round(scene->dbToY(22))) prefs.insert("scrollY", value); } @@ -180,7 +180,7 @@ void GraphicEQFilterGUI::moveRow(int fromIndex, int toIndex) ui->tableWidget->insertRow(toIndex); ui->tableWidget->setItem(toIndex, 0, freqItem); ui->tableWidget->setItem(toIndex, 1, gainItem); - if(selected) + if (selected) { QModelIndex modelIndex = ui->tableWidget->model()->index(toIndex, 0); ui->tableWidget->selectionModel()->select(modelIndex, QItemSelectionModel::Rows | QItemSelectionModel::Select); @@ -193,7 +193,7 @@ void GraphicEQFilterGUI::selectRow(int index, bool select) { ui->tableWidget->blockSignals(true); QItemSelectionModel::SelectionFlags command = QItemSelectionModel::Rows; - if(select) + if (select) command |= QItemSelectionModel::Select; else command |= QItemSelectionModel::Deselect; @@ -205,12 +205,12 @@ void GraphicEQFilterGUI::selectRow(int index, bool select) void GraphicEQFilterGUI::on_tableWidget_cellChanged(int row, int column) { - if(column == 0) + if (column == 0) { QTableWidgetItem* freqItem = ui->tableWidget->item(row, 0); bool ok; double freq = freqItem->text().toDouble(&ok); - if(ok) + if (ok) { double gain = scene->getNodes()[row].dbGain; scene->setNode(row, freq, gain); @@ -221,12 +221,12 @@ void GraphicEQFilterGUI::on_tableWidget_cellChanged(int row, int column) freqItem->setText(QString("%0").arg(freq)); } } - else if(column == 1) + else if (column == 1) { QTableWidgetItem* gainItem = ui->tableWidget->item(row, 1); bool ok; double gain = gainItem->text().toDouble(&ok); - if(ok) + if (ok) { double freq = scene->getNodes()[row].freq; scene->setNode(row, freq, gain); @@ -242,7 +242,7 @@ void GraphicEQFilterGUI::on_tableWidget_cellChanged(int row, int column) void GraphicEQFilterGUI::on_tableWidget_itemSelectionChanged() { QSet selectedRows; - for(QTableWidgetItem* item : ui->tableWidget->selectedItems()) + for (QTableWidgetItem* item : ui->tableWidget->selectedItems()) selectedRows.insert(item->row()); scene->setSelectedNodes(selectedRows); @@ -250,7 +250,7 @@ void GraphicEQFilterGUI::on_tableWidget_itemSelectionChanged() void GraphicEQFilterGUI::on_radioButton15_toggled(bool checked) { - if(checked) + if (checked) { scene->setBandCount(15); setFreqEditable(false); @@ -259,7 +259,7 @@ void GraphicEQFilterGUI::on_radioButton15_toggled(bool checked) void GraphicEQFilterGUI::on_radioButton31_toggled(bool checked) { - if(checked) + if (checked) { scene->setBandCount(31); setFreqEditable(false); @@ -268,7 +268,7 @@ void GraphicEQFilterGUI::on_radioButton31_toggled(bool checked) void GraphicEQFilterGUI::on_radioButtonVar_toggled(bool checked) { - if(checked) + if (checked) { scene->setBandCount(-1); setFreqEditable(true); @@ -278,10 +278,10 @@ void GraphicEQFilterGUI::on_radioButtonVar_toggled(bool checked) void GraphicEQFilterGUI::setFreqEditable(bool editable) { ui->tableWidget->blockSignals(true); - for(int i = 0; i < ui->tableWidget->rowCount(); i++) + for (int i = 0; i < ui->tableWidget->rowCount(); i++) { QTableWidgetItem* item = ui->tableWidget->item(i, 0); - if(editable) + if (editable) item->setFlags(item->flags() | Qt::ItemIsEditable | Qt::ItemIsEnabled); else item->setFlags(item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsEnabled)); @@ -298,32 +298,32 @@ void GraphicEQFilterGUI::on_actionImport_triggered() nameFilters.append(tr("Frequency response (*.csv)")); nameFilters.append(tr("All files (*.*)")); dialog.setNameFilters(nameFilters); - if(dialog.exec() == QDialog::Accepted) + if (dialog.exec() == QDialog::Accepted) { vector newNodes; - for(QString path : dialog.selectedFiles()) + for (QString path : dialog.selectedFiles()) { QFile file(path); - if(file.open(QFile::ReadOnly)) + if (file.open(QFile::ReadOnly)) { QTextStream stream(&file); QString text = stream.readAll(); - if(!text.contains('.')) + if (!text.contains('.')) text = text.replace(',', '.'); QRegularExpressionMatchIterator it = numberRegEx.globalMatch(text); - while(it.hasNext()) + while (it.hasNext()) { QRegularExpressionMatch match = it.next(); QString freqString = match.captured(); bool ok; double freq = freqString.toDouble(&ok); - if(ok && it.hasNext()) + if (ok && it.hasNext()) { match = it.next(); QString gainString = match.captured(); double gain = gainString.toDouble(&ok); - if(ok) + if (ok) newNodes.push_back(FilterNode(freq, gain)); } } @@ -334,9 +334,9 @@ void GraphicEQFilterGUI::on_actionImport_triggered() scene->setNodes(newNodes); int bandCount = scene->verifyBands(newNodes); - if(bandCount != scene->getBandCount()) + if (bandCount != scene->getBandCount()) { - switch(bandCount) + switch (bandCount) { case 15: ui->radioButton15->click(); @@ -367,15 +367,15 @@ void GraphicEQFilterGUI::on_actionExport_triggered() dialog.setNameFilters(nameFilters); dialog.setDefaultSuffix(".csv"); - if(dialog.exec() == QDialog::Accepted) + if (dialog.exec() == QDialog::Accepted) { QString savePath = dialog.selectedFiles().first(); QFile file(savePath); - if(file.open(QFile::WriteOnly | QFile::Truncate)) + if (file.open(QFile::WriteOnly | QFile::Truncate)) { QTextStream stream(&file); - for(FilterNode node : scene->getNodes()) + for (FilterNode node : scene->getNodes()) { stream << node.freq << '\t' << node.dbGain << '\n'; } @@ -387,7 +387,7 @@ void GraphicEQFilterGUI::on_actionExport_triggered() void GraphicEQFilterGUI::on_actionInvertResponse_triggered() { vector newNodes = scene->getNodes(); - for(FilterNode& node : newNodes) + for (FilterNode& node : newNodes) node.dbGain = -node.dbGain; scene->setNodes(newNodes); @@ -399,15 +399,15 @@ void GraphicEQFilterGUI::on_actionNormalizeResponse_triggered() vector newNodes = scene->getNodes(); double maxGain = -DBL_MAX; - for(FilterNode node : newNodes) + for (FilterNode node : newNodes) { - if(node.dbGain > maxGain) + if (node.dbGain > maxGain) maxGain = node.dbGain; } - if(maxGain != 0) + if (maxGain != 0) { - for(FilterNode& node : newNodes) + for (FilterNode& node : newNodes) node.dbGain -= maxGain; scene->setNodes(newNodes); @@ -421,9 +421,9 @@ void GraphicEQFilterGUI::on_actionResetResponse_triggered() QSet selectedIndices = scene->getSelectedIndices(); int index = 0; - for(FilterNode& node : newNodes) + for (FilterNode& node : newNodes) { - if(selectedIndices.isEmpty() || selectedIndices.contains(index)) + if (selectedIndices.isEmpty() || selectedIndices.contains(index)) node.dbGain = 0.0; index++; } diff --git a/Editor/guis/GraphicEQFilterGUI.h b/Editor/guis/GraphicEQFilterGUI.h index ede3379..cab3773 100644 --- a/Editor/guis/GraphicEQFilterGUI.h +++ b/Editor/guis/GraphicEQFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -67,7 +67,7 @@ private slots: private: void setFreqEditable(bool editable); - Ui::GraphicEQFilterGUI *ui; + Ui::GraphicEQFilterGUI* ui; GraphicEQFilterGUIScene* scene; QString configPath; static QRegularExpression numberRegEx; diff --git a/Editor/guis/GraphicEQFilterGUIFactory.cpp b/Editor/guis/GraphicEQFilterGUIFactory.cpp index e58e60e..6cb1fbd 100644 --- a/Editor/guis/GraphicEQFilterGUIFactory.cpp +++ b/Editor/guis/GraphicEQFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "filters/GraphicEQFilter.h" @@ -49,17 +49,17 @@ IFilterGUI* GraphicEQFilterGUIFactory::createFilterGUI(QString& command, QString { GraphicEQFilterGUI* result = NULL; - if(command == "GraphicEQ") + if (command == "GraphicEQ") { GraphicEQFilterFactory factory; std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); - if(!filters.empty()) + if (!filters.empty()) { GraphicEQFilter* filter = (GraphicEQFilter*)filters[0]; result = new GraphicEQFilterGUI(filter, configPath, filterTable); } - for(IFilter* f : filters) + for (IFilter* f : filters) { f->~IFilter(); MemoryHelper::free(f); diff --git a/Editor/guis/GraphicEQFilterGUIFactory.h b/Editor/guis/GraphicEQFilterGUIFactory.h index 950b36d..4da42bb 100644 --- a/Editor/guis/GraphicEQFilterGUIFactory.h +++ b/Editor/guis/GraphicEQFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/GraphicEQFilterGUIItem.cpp b/Editor/guis/GraphicEQFilterGUIItem.cpp index f832325..c6ca76b 100644 --- a/Editor/guis/GraphicEQFilterGUIItem.cpp +++ b/Editor/guis/GraphicEQFilterGUIItem.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -46,12 +46,12 @@ QPainterPath GraphicEQFilterGUIItem::shape() const void GraphicEQFilterGUIItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { painter->setBrush(Qt::white); - if(isSelected()) + if (isSelected()) painter->setBrush(QColor(38, 147, 255)); painter->drawPath(shape()); - if(index < 99) + if (index < 99) { - if(isSelected()) + if (isSelected()) painter->setPen(Qt::white); QFont font; @@ -68,20 +68,20 @@ QVariant GraphicEQFilterGUIItem::itemChange(QGraphicsItem::GraphicsItemChange ch { QVariant result = QGraphicsItem::itemChange(change, value); - if(change == ItemScenePositionHasChanged) + if (change == ItemScenePositionHasChanged) { GraphicEQFilterGUIScene* s = qobject_cast(scene()); s->itemMoved(index); } - else if(change == ItemSelectedHasChanged) + else if (change == ItemSelectedHasChanged) { GraphicEQFilterGUIScene* s = qobject_cast(scene()); s->itemSelectionChanged(index, value.toBool()); } - else if(change == ItemPositionChange) + else if (change == ItemPositionChange) { GraphicEQFilterGUIScene* s = qobject_cast(scene()); - if(s->getBandCount() != -1) + if (s->getBandCount() != -1) { QPointF newPos = value.toPointF(); newPos.setX(s->hzToX(getHz())); diff --git a/Editor/guis/GraphicEQFilterGUIItem.h b/Editor/guis/GraphicEQFilterGUIItem.h index ed3397a..e455608 100644 --- a/Editor/guis/GraphicEQFilterGUIItem.h +++ b/Editor/guis/GraphicEQFilterGUIItem.h @@ -1,32 +1,32 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once #include "Editor/widgets/FrequencyPlotItem.h" -class GraphicEQFilterGUIItem: public FrequencyPlotItem +class GraphicEQFilterGUIItem : public FrequencyPlotItem { public: GraphicEQFilterGUIItem(int index, double hz, double db); - enum { Type = UserType + 2 }; + enum {Type = UserType + 2}; virtual int type() const { return Type; diff --git a/Editor/guis/GraphicEQFilterGUIScene.cpp b/Editor/guis/GraphicEQFilterGUIScene.cpp index 117efa9..fa20d81 100644 --- a/Editor/guis/GraphicEQFilterGUIScene.cpp +++ b/Editor/guis/GraphicEQFilterGUIScene.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -26,8 +26,8 @@ using namespace std; -GraphicEQFilterGUIScene::GraphicEQFilterGUIScene(QObject* parent) : - FrequencyPlotScene(parent) +GraphicEQFilterGUIScene::GraphicEQFilterGUIScene(QObject* parent) + : FrequencyPlotScene(parent) { } @@ -35,13 +35,13 @@ void GraphicEQFilterGUIScene::setNodes(const std::vector& nodes) { noUpdateModel = true; - for(int i = (int)this->nodes.size() - 1; i >= 0; i--) + for (int i = (int)this->nodes.size() - 1; i >= 0; i--) removeNode(i); this->nodes = nodes; int i = 0; - for(FilterNode node : nodes) + for (FilterNode node : nodes) { GraphicEQFilterGUIItem* item = new GraphicEQFilterGUIItem(i, node.freq, node.dbGain); addItem(item); @@ -67,20 +67,20 @@ void GraphicEQFilterGUIScene::addNode(double hz, double db) addItem(item); item->updatePos(); items.insert(index, item); - for(int i = index + 1; i < items.size(); i++) + for (int i = index + 1; i < items.size(); i++) items[i]->setIndex(i); emit nodeInserted(index, hz, db); QRectF rect = sceneRect(); - if(index > 0) + if (index > 0) rect.setLeft(items[index - 1]->x()); - if(index + 1 < items.size()) + if (index + 1 < items.size()) rect.setRight(items[index + 1]->x()); update(rect); - for(int i = index + 1; i < items.size(); i++) + for (int i = index + 1; i < items.size(); i++) items[i]->update(); - if(!noUpdateModel) + if (!noUpdateModel) emit updateModel(); } @@ -90,20 +90,20 @@ void GraphicEQFilterGUIScene::removeNode(int index) GraphicEQFilterGUIItem* item = items[index]; removeItem(item); items.removeAt(index); - for(int i = index; i < items.size(); i++) + for (int i = index; i < items.size(); i++) items[i]->setIndex(i); emit nodeRemoved(index); QRectF rect = sceneRect(); - if(index > 0) + if (index > 0) rect.setLeft(items[index - 1]->x()); - if(index < items.size()) + if (index < items.size()) rect.setRight(items[index]->x()); update(rect); - for(int i = index; i < items.size(); i++) + for (int i = index; i < items.size(); i++) items[i]->update(); - if(!noUpdateModel) + if (!noUpdateModel) emit updateModel(); } @@ -117,24 +117,24 @@ void GraphicEQFilterGUIScene::setNode(int index, double hz, double db) FilterNode node(hz, db); vector::iterator it = lower_bound(nodes.begin(), nodes.end(), node); int newIndex = it - nodes.begin(); - if(newIndex > index) + if (newIndex > index) newIndex--; - if(newIndex != index) + if (newIndex != index) { items.move(index, newIndex); - if(newIndex < index) + if (newIndex < index) { - for(int i = index; i > newIndex; i--) + for (int i = index; i > newIndex; i--) nodes[i] = nodes[i - 1]; - for(int i = newIndex; i <= index; i++) + for (int i = newIndex; i <= index; i++) items[i]->setIndex(i); emit nodeMoved(index, newIndex); } else { - for(int i = index; i < newIndex; i++) + for (int i = index; i < newIndex; i++) nodes[i] = nodes[i + 1]; - for(int i = index; i <= newIndex; i++) + for (int i = index; i <= newIndex; i++) items[i]->setIndex(i); emit nodeMoved(index, newIndex); } @@ -145,19 +145,19 @@ void GraphicEQFilterGUIScene::setNode(int index, double hz, double db) QRectF rect = sceneRect(); int lowerIndex = min(index, newIndex); int upperIndex = max(index, newIndex); - if(lowerIndex > 0) + if (lowerIndex > 0) rect.setLeft(items[lowerIndex - 1]->x()); - if(upperIndex + 1 < items.size()) + if (upperIndex + 1 < items.size()) rect.setRight(items[upperIndex + 1]->x()); update(rect); - if(!noUpdateModel) + if (!noUpdateModel) emit updateModel(); } void GraphicEQFilterGUIScene::setSelectedNodes(QSet indices) { - for(GraphicEQFilterGUIItem* item : items) + for (GraphicEQFilterGUIItem* item : items) item->setSelected(indices.contains(item->getIndex())); } @@ -165,8 +165,8 @@ QSet GraphicEQFilterGUIScene::getSelectedIndices() { QSet set; - for(GraphicEQFilterGUIItem* item : items) - if(item->isSelected()) + for (GraphicEQFilterGUIItem* item : items) + if (item->isSelected()) set.insert(item->getIndex()); return set; @@ -178,29 +178,29 @@ void GraphicEQFilterGUIScene::itemMoved(int index) double db = yToDb(item->scenePos().y()); double oldHz = item->getHz(); double hz; - if(getBandCount() != -1) + if (getBandCount() != -1) { hz = oldHz; } else { hz = xToHz(item->scenePos().x()); - if(hz >= 10000) + if (hz >= 10000) hz = round(hz); else hz = round(hz * 10) / 10; item->setHz(hz); } - if(getZoomY() < 4) + if (getZoomY() < 4) db = round(db * 10) / 10; else db = round(db * 100) / 100; item->setDb(db); int newIndex = index; - if(hz < oldHz) + if (hz < oldHz) { - while(newIndex > 0 && nodes[newIndex - 1].freq > hz) + while (newIndex > 0 && nodes[newIndex - 1].freq > hz) { nodes[newIndex] = nodes[newIndex - 1]; items[newIndex] = items[newIndex - 1]; @@ -208,9 +208,9 @@ void GraphicEQFilterGUIScene::itemMoved(int index) newIndex--; } } - else if(hz > oldHz) + else if (hz > oldHz) { - while(newIndex < (int)nodes.size() - 1 && nodes[newIndex + 1].freq < hz) + while (newIndex < (int)nodes.size() - 1 && nodes[newIndex + 1].freq < hz) { nodes[newIndex] = nodes[newIndex + 1]; items[newIndex] = items[newIndex + 1]; @@ -219,7 +219,7 @@ void GraphicEQFilterGUIScene::itemMoved(int index) } } nodes[newIndex] = FilterNode(hz, db); - if(newIndex != index) + if (newIndex != index) { items[newIndex] = item; item->setIndex(newIndex); @@ -230,13 +230,13 @@ void GraphicEQFilterGUIScene::itemMoved(int index) QRectF rect = sceneRect(); int lowerIndex = min(index, newIndex); int upperIndex = max(index, newIndex); - if(lowerIndex > 0) + if (lowerIndex > 0) rect.setLeft(items[lowerIndex - 1]->x()); - if(upperIndex + 1 < items.size()) + if (upperIndex + 1 < items.size()) rect.setRight(items[upperIndex + 1]->x()); update(rect); - if(!noUpdateModel) + if (!noUpdateModel) emit updateModel(); } @@ -247,7 +247,7 @@ void GraphicEQFilterGUIScene::itemSelectionChanged(int index, bool selected) void GraphicEQFilterGUIScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) { - if(getBandCount() != -1) + if (getBandCount() != -1) return; double hz = xToHz(event->scenePos().x()); @@ -257,15 +257,15 @@ void GraphicEQFilterGUIScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev void GraphicEQFilterGUIScene::keyPressEvent(QKeyEvent* event) { - switch(event->key()) + switch (event->key()) { case Qt::Key_Delete: - if(getBandCount() == -1) + if (getBandCount() == -1) { - for(QGraphicsItem* item : selectedItems()) + for (QGraphicsItem* item : selectedItems()) { GraphicEQFilterGUIItem* plotItem = qgraphicsitem_cast(item); - if(plotItem != NULL) + if (plotItem != NULL) { // this works for multiple items because the index of the other items is updated inside removeNode int index = plotItem->getIndex(); @@ -279,14 +279,14 @@ void GraphicEQFilterGUIScene::keyPressEvent(QKeyEvent* event) case Qt::Key_Down: case Qt::Key_Left: case Qt::Key_Right: - for(QGraphicsItem* item : selectedItems()) + for (QGraphicsItem* item : selectedItems()) { GraphicEQFilterGUIItem* plotItem = qgraphicsitem_cast(item); - if(plotItem != NULL) + if (plotItem != NULL) { int index = plotItem->getIndex(); FilterNode node = nodes[index]; - switch(event->key()) + switch (event->key()) { case Qt::Key_Up: node.dbGain += 1; @@ -307,7 +307,7 @@ void GraphicEQFilterGUIScene::keyPressEvent(QKeyEvent* event) break; case Qt::Key_A: - if(event->modifiers() & Qt::ControlModifier) + if (event->modifiers() & Qt::ControlModifier) { QPainterPath painterPath; painterPath.addRect(sceneRect()); @@ -327,12 +327,12 @@ int GraphicEQFilterGUIScene::verifyBands(const std::vector& nodes) const vector& bands = getBands((int)nodes.size()); int bandCount = -1; - if(!bands.empty()) + if (!bands.empty()) { bandCount = (int)nodes.size(); - for(unsigned i = 0; i < nodes.size(); i++) + for (unsigned i = 0; i < nodes.size(); i++) { - if(abs(nodes[i].freq - bands[i]) > 0.1) + if (abs(nodes[i].freq - bands[i]) > 0.1) { bandCount = -1; break; @@ -345,14 +345,14 @@ int GraphicEQFilterGUIScene::verifyBands(const std::vector& nodes) void GraphicEQFilterGUIScene::setBandCount(int value) { - if(value != getBandCount()) + if (value != getBandCount()) { const vector& bands = getBands(value); - if(!bands.empty()) + if (!bands.empty()) { vector newNodes; GainIterator gainIterator(nodes); - for(double band : bands) + for (double band : bands) { double dbGain = gainIterator.gainAt(band); dbGain = round(dbGain * 100) / 100; @@ -365,7 +365,7 @@ void GraphicEQFilterGUIScene::setBandCount(int value) FrequencyPlotScene::setBandCount(value); - if(!noUpdateModel) + if (!noUpdateModel) emit updateModel(); } } diff --git a/Editor/guis/GraphicEQFilterGUIScene.h b/Editor/guis/GraphicEQFilterGUIScene.h index 3e86a6f..c71896f 100644 --- a/Editor/guis/GraphicEQFilterGUIScene.h +++ b/Editor/guis/GraphicEQFilterGUIScene.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -29,7 +29,7 @@ class GraphicEQFilterGUIScene : public FrequencyPlotScene { Q_OBJECT public: - explicit GraphicEQFilterGUIScene(QObject *parent = 0); + explicit GraphicEQFilterGUIScene(QObject* parent = 0); void setNodes(const std::vector& nodes); void addNode(double hz, double db); void removeNode(int index); diff --git a/Editor/guis/GraphicEQFilterGUIView.cpp b/Editor/guis/GraphicEQFilterGUIView.cpp index 7334b5a..d948312 100644 --- a/Editor/guis/GraphicEQFilterGUIView.cpp +++ b/Editor/guis/GraphicEQFilterGUIView.cpp @@ -1,27 +1,27 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "GraphicEQFilterGUIScene.h" #include "GraphicEQFilterGUIView.h" -GraphicEQFilterGUIView::GraphicEQFilterGUIView(QWidget *parent) : - FrequencyPlotView(parent) +GraphicEQFilterGUIView::GraphicEQFilterGUIView(QWidget* parent) + : FrequencyPlotView(parent) { } @@ -36,15 +36,15 @@ void GraphicEQFilterGUIView::drawBackground(QPainter* painter, const QRectF& rec QPainterPath path; bool first = true; double lastDb = -1000; - for(int x = rect.left() - 1; x <= rect.right() + 1; x++) + for (int x = rect.left() - 1; x <= rect.right() + 1; x++) { double hz = s->xToHz(x); double db = gainIterator.gainAt(hz); double y = s->dbToY(db); - if(db == lastDb) + if (db == lastDb) y = floor(y) + 0.5; lastDb = db; - if(first) + if (first) { path.moveTo(x, y); first = false; diff --git a/Editor/guis/GraphicEQFilterGUIView.h b/Editor/guis/GraphicEQFilterGUIView.h index 2d0afc2..5ba3b68 100644 --- a/Editor/guis/GraphicEQFilterGUIView.h +++ b/Editor/guis/GraphicEQFilterGUIView.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -26,7 +26,7 @@ class GraphicEQFilterGUIView : public FrequencyPlotView Q_OBJECT public: - explicit GraphicEQFilterGUIView(QWidget *parent = 0); + explicit GraphicEQFilterGUIView(QWidget* parent = 0); protected: void drawBackground(QPainter* painter, const QRectF& rect) override; diff --git a/Editor/guis/IncludeFilterGUI.cpp b/Editor/guis/IncludeFilterGUI.cpp index 925738e..16fa320 100644 --- a/Editor/guis/IncludeFilterGUI.cpp +++ b/Editor/guis/IncludeFilterGUI.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -22,8 +22,8 @@ #include "IncludeFilterGUI.h" #include "ui_IncludeFilterGUI.h" -IncludeFilterGUI::IncludeFilterGUI(FilterTable* filterTable, const QString& path) : - ui(new Ui::IncludeFilterGUI), filterTable(filterTable) +IncludeFilterGUI::IncludeFilterGUI(FilterTable* filterTable, const QString& path) + : ui(new Ui::IncludeFilterGUI), filterTable(filterTable) { ui->setupUi(this); @@ -46,19 +46,19 @@ void IncludeFilterGUI::on_selectFileToolButton_clicked() QFileInfo fileInfo(filterTable->getConfigPath()); QDir configDir = fileInfo.absoluteDir(); QString path = ui->pathLineEdit->text(); - if(path.length() > 0) + if (path.length() > 0) fileInfo.setFile(configDir, path); QFileDialog dialog(this, tr("Include file"), fileInfo.absolutePath(), "*.txt"); dialog.setFileMode(QFileDialog::ExistingFile); dialog.setNameFilter(tr("E-APO configurations (*.txt)")); - if(path.length() > 0) + if (path.length() > 0) dialog.selectFile(fileInfo.fileName()); - if(dialog.exec() == QDialog::Accepted) + if (dialog.exec() == QDialog::Accepted) { QString absolutePath = dialog.selectedFiles().first(); QString relativePath = configDir.relativeFilePath(absolutePath); - if(relativePath.startsWith("../../")) + if (relativePath.startsWith("../../")) relativePath = absolutePath; ui->pathLineEdit->setText(QDir::toNativeSeparators(relativePath)); @@ -76,7 +76,7 @@ void IncludeFilterGUI::on_openFileToolButton_clicked() QFileInfo fileInfo(filterTable->getConfigPath()); QDir configDir = fileInfo.absoluteDir(); QString path = ui->pathLineEdit->text(); - if(path.length() > 0) + if (path.length() > 0) { fileInfo.setFile(configDir, path); diff --git a/Editor/guis/IncludeFilterGUI.h b/Editor/guis/IncludeFilterGUI.h index 261be2e..ce0aaac 100644 --- a/Editor/guis/IncludeFilterGUI.h +++ b/Editor/guis/IncludeFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -42,6 +42,6 @@ private slots: void on_openFileToolButton_clicked(); private: - Ui::IncludeFilterGUI *ui; + Ui::IncludeFilterGUI* ui; FilterTable* filterTable; }; diff --git a/Editor/guis/IncludeFilterGUIFactory.cpp b/Editor/guis/IncludeFilterGUIFactory.cpp index 7fda895..8cf2155 100644 --- a/Editor/guis/IncludeFilterGUIFactory.cpp +++ b/Editor/guis/IncludeFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "IncludeFilterGUI.h" @@ -40,7 +40,7 @@ IFilterGUI* IncludeFilterGUIFactory::createFilterGUI(QString& command, QString& { IncludeFilterGUI* result = NULL; - if(command == "Include") + if (command == "Include") { result = new IncludeFilterGUI(filterTable, parameters.trimmed()); } diff --git a/Editor/guis/IncludeFilterGUIFactory.h b/Editor/guis/IncludeFilterGUIFactory.h index 70a062a..c792231 100644 --- a/Editor/guis/IncludeFilterGUIFactory.h +++ b/Editor/guis/IncludeFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/PreampFilterGUI.cpp b/Editor/guis/PreampFilterGUI.cpp index 1f18e0a..a1fdc0f 100644 --- a/Editor/guis/PreampFilterGUI.cpp +++ b/Editor/guis/PreampFilterGUI.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 @@ -24,8 +24,8 @@ using namespace std; -PreampFilterGUI::PreampFilterGUI(double dbGain): - ui(new Ui::PreampFilterGUI) +PreampFilterGUI::PreampFilterGUI(double dbGain) + : ui(new Ui::PreampFilterGUI) { ui->setupUi(this); diff --git a/Editor/guis/PreampFilterGUI.h b/Editor/guis/PreampFilterGUI.h index 0f7df0b..b0228a4 100644 --- a/Editor/guis/PreampFilterGUI.h +++ b/Editor/guis/PreampFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once @@ -22,8 +22,7 @@ #include "Editor/IFilterGUI.h" #include -namespace Ui -{ +namespace Ui { class PreampFilterGUI; } diff --git a/Editor/guis/PreampFilterGUIFactory.cpp b/Editor/guis/PreampFilterGUIFactory.cpp index 21505e5..2ebddf5 100644 --- a/Editor/guis/PreampFilterGUIFactory.cpp +++ b/Editor/guis/PreampFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "PreampFilterGUI.h" @@ -32,17 +32,17 @@ IFilterGUI* PreampFilterGUIFactory::createFilterGUI(QString& command, QString& p { PreampFilterGUI* result = NULL; - if(command == "Preamp") + if (command == "Preamp") { PreampFilterFactory factory; std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); - if(!filters.empty()) + if (!filters.empty()) { PreampFilter* filter = (PreampFilter*)filters[0]; result = new PreampFilterGUI(filter->getDbGain()); } - for(IFilter* f : filters) + for (IFilter* f : filters) { f->~IFilter(); MemoryHelper::free(f); diff --git a/Editor/guis/PreampFilterGUIFactory.h b/Editor/guis/PreampFilterGUIFactory.h index 35aec7a..6a8e9da 100644 --- a/Editor/guis/PreampFilterGUIFactory.h +++ b/Editor/guis/PreampFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/guis/StageFilterGUI.cpp b/Editor/guis/StageFilterGUI.cpp index 3d91d44..ae44959 100644 --- a/Editor/guis/StageFilterGUI.cpp +++ b/Editor/guis/StageFilterGUI.cpp @@ -1,27 +1,27 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "StageFilterGUI.h" #include "ui_StageFilterGUI.h" -StageFilterGUI::StageFilterGUI(const QString& parameters) : - ui(new Ui::StageFilterGUI) +StageFilterGUI::StageFilterGUI(const QString& parameters) + : ui(new Ui::StageFilterGUI) { ui->setupUi(this); @@ -40,11 +40,11 @@ void StageFilterGUI::store(QString& command, QString& parameters) { command = "Stage"; QStringList list; - if(ui->preMixCheckBox->isChecked()) + if (ui->preMixCheckBox->isChecked()) list.append("pre-mix"); - if(ui->postMixCheckBox->isChecked()) + if (ui->postMixCheckBox->isChecked()) list.append("post-mix"); - if(ui->captureCheckBox->isChecked()) + if (ui->captureCheckBox->isChecked()) list.append("capture"); parameters = list.join(' '); diff --git a/Editor/guis/StageFilterGUI.h b/Editor/guis/StageFilterGUI.h index 7f85da3..90f7087 100644 --- a/Editor/guis/StageFilterGUI.h +++ b/Editor/guis/StageFilterGUI.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -43,5 +43,5 @@ private slots: void on_captureCheckBox_toggled(bool checked); private: - Ui::StageFilterGUI *ui; + Ui::StageFilterGUI* ui; }; diff --git a/Editor/guis/StageFilterGUIFactory.cpp b/Editor/guis/StageFilterGUIFactory.cpp index ca91e17..68896d9 100644 --- a/Editor/guis/StageFilterGUIFactory.cpp +++ b/Editor/guis/StageFilterGUIFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "StageFilterGUI.h" @@ -31,7 +31,7 @@ IFilterGUI* StageFilterGUIFactory::createFilterGUI(QString& command, QString& pa { StageFilterGUI* result = NULL; - if(command == "Stage") + if (command == "Stage") { result = new StageFilterGUI(parameters); } diff --git a/Editor/guis/StageFilterGUIFactory.h b/Editor/guis/StageFilterGUIFactory.h index 8ed231d..af686e8 100644 --- a/Editor/guis/StageFilterGUIFactory.h +++ b/Editor/guis/StageFilterGUIFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/helpers/DisableWheelFilter.cpp b/Editor/helpers/DisableWheelFilter.cpp index 34709f0..65d91fa 100644 --- a/Editor/helpers/DisableWheelFilter.cpp +++ b/Editor/helpers/DisableWheelFilter.cpp @@ -1,37 +1,37 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 #include "DisableWheelFilter.h" -DisableWheelFilter::DisableWheelFilter(QObject* scrollTarget, QObject *parent) : - QObject(parent), scrollTarget(scrollTarget) +DisableWheelFilter::DisableWheelFilter(QObject* scrollTarget, QObject* parent) + : QObject(parent), scrollTarget(scrollTarget) { } bool DisableWheelFilter::eventFilter(QObject* obj, QEvent* event) { - if(event->type() == QEvent::Wheel) + if (event->type() == QEvent::Wheel) { QWidget* widget = qobject_cast(obj); - if(widget == NULL || !widget->hasFocus()) + if (widget == NULL || !widget->hasFocus()) { QApplication::sendEvent(scrollTarget, event); return true; diff --git a/Editor/helpers/DisableWheelFilter.h b/Editor/helpers/DisableWheelFilter.h index ea23c6f..1f92e4a 100644 --- a/Editor/helpers/DisableWheelFilter.h +++ b/Editor/helpers/DisableWheelFilter.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -25,7 +25,7 @@ class DisableWheelFilter : public QObject { Q_OBJECT public: - explicit DisableWheelFilter(QObject* scrollTarget, QObject *parent = 0); + explicit DisableWheelFilter(QObject* scrollTarget, QObject* parent = 0); bool eventFilter(QObject* obj, QEvent* event) override; diff --git a/Editor/helpers/GUIChannelHelper.cpp b/Editor/helpers/GUIChannelHelper.cpp index ec78dff..b470e70 100644 --- a/Editor/helpers/GUIChannelHelper.cpp +++ b/Editor/helpers/GUIChannelHelper.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -26,7 +26,7 @@ GUIChannelHelper* GUIChannelHelper::instance = NULL; GUIChannelHelper* GUIChannelHelper::getInstance() { - if(instance == NULL) + if (instance == NULL) instance = new GUIChannelHelper(); return instance; diff --git a/Editor/helpers/GUIChannelHelper.h b/Editor/helpers/GUIChannelHelper.h index a0dec6f..81c72e2 100644 --- a/Editor/helpers/GUIChannelHelper.h +++ b/Editor/helpers/GUIChannelHelper.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -22,7 +22,7 @@ #include #include -class GUIChannelHelper: public QObject +class GUIChannelHelper : public QObject { Q_OBJECT diff --git a/Editor/main.cpp b/Editor/main.cpp index 4be4133..1429c63 100644 --- a/Editor/main.cpp +++ b/Editor/main.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -27,12 +27,12 @@ using namespace std; -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { int result = -1; #ifdef _DEBUG - //_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); - //_CrtSetBreakAlloc(3318); + // _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); + // _CrtSetBreakAlloc(3318); #endif QCoreApplication::addLibraryPath("qt"); @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat); QVariant languageValue = settings.value("language"); - if(languageValue.isValid()) + if (languageValue.isValid()) QLocale::setDefault(languageValue.toString()); else QLocale::setDefault(QLocale::system()); @@ -58,17 +58,17 @@ int main(int argc, char *argv[]) application.installTranslator(&editorTranslator); QString configPath = QDir::currentPath(); - if(RegistryHelper::keyExists(APP_REGPATH) && RegistryHelper::valueExists(APP_REGPATH, L"ConfigPath")) + if (RegistryHelper::keyExists(APP_REGPATH) && RegistryHelper::valueExists(APP_REGPATH, L"ConfigPath")) configPath = QString::fromStdWString(RegistryHelper::readValue(APP_REGPATH, L"ConfigPath")); QDir configDir(configPath); - if(!RegistryHelper::keyExists(USER_REGPATH)) + if (!RegistryHelper::keyExists(USER_REGPATH)) RegistryHelper::createKey(USER_REGPATH); - if(!RegistryHelper::keyExists(EDITOR_REGPATH)) + if (!RegistryHelper::keyExists(EDITOR_REGPATH)) RegistryHelper::createKey(EDITOR_REGPATH); - if(!RegistryHelper::keyExists(EDITOR_PER_FILE_REGPATH)) + if (!RegistryHelper::keyExists(EDITOR_PER_FILE_REGPATH)) RegistryHelper::createKey(EDITOR_PER_FILE_REGPATH); MainWindow w(configDir); @@ -77,10 +77,10 @@ int main(int argc, char *argv[]) QCommandLineParser parser; parser.process(application); QStringList args = parser.positionalArguments(); - if(args.isEmpty() && w.isEmpty()) + if (args.isEmpty() && w.isEmpty()) args = QStringList("config.txt"); - for(QString arg : args) + for (QString arg : args) w.load(configDir.absoluteFilePath(arg)); w.doChecks(); @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) restart = w.shouldRestart(); } - while(restart); + while (restart); return result; } diff --git a/Editor/widgets/ChannelGraphItem.cpp b/Editor/widgets/ChannelGraphItem.cpp index 5a4d48f..fd99924 100644 --- a/Editor/widgets/ChannelGraphItem.cpp +++ b/Editor/widgets/ChannelGraphItem.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -31,14 +31,14 @@ ChannelGraphItem::ChannelGraphItem(const QString& name) QRectF ChannelGraphItem::boundingRect() const { - if(cachedRect.isNull()) + if (cachedRect.isNull()) { QFontMetrics metrics(scene()->font()); int width = metrics.width(name); // we only use upper case characters and digits, so everything is above the baseline int height = metrics.ascent(); // make it at least quadratic - if(width < height) + if (width < height) width = height; // shift by 0.5 to have sharp lines cachedRect.setLeft(0.5); diff --git a/Editor/widgets/ChannelGraphItem.h b/Editor/widgets/ChannelGraphItem.h index 3d7c5df..2a215b9 100644 --- a/Editor/widgets/ChannelGraphItem.h +++ b/Editor/widgets/ChannelGraphItem.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/widgets/ChannelGraphScene.cpp b/Editor/widgets/ChannelGraphScene.cpp index a03b429..d63d4b6 100644 --- a/Editor/widgets/ChannelGraphScene.cpp +++ b/Editor/widgets/ChannelGraphScene.cpp @@ -1,35 +1,35 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 #include "ChannelGraphScene.h" -ChannelGraphScene::ChannelGraphScene(QWidget *parent) : - QGraphicsScene(parent) +ChannelGraphScene::ChannelGraphScene(QWidget* parent) + : QGraphicsScene(parent) { } QPointF ChannelGraphScene::getNextChannelPoint(QGraphicsItem* lastItem, bool output) { int x = 0; - if(lastItem != NULL) + if (lastItem != NULL) { QRectF lastRect = lastItem->sceneBoundingRect(); x = lastRect.left() + lastRect.width() + 1 + 10; diff --git a/Editor/widgets/ChannelGraphScene.h b/Editor/widgets/ChannelGraphScene.h index 8d385a7..21e7344 100644 --- a/Editor/widgets/ChannelGraphScene.h +++ b/Editor/widgets/ChannelGraphScene.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -25,7 +25,7 @@ class ChannelGraphScene : public QGraphicsScene { Q_OBJECT public: - explicit ChannelGraphScene(QWidget *parent = 0); + explicit ChannelGraphScene(QWidget* parent = 0); protected: QPointF getNextChannelPoint(QGraphicsItem* lastItem, bool output); diff --git a/Editor/widgets/CompactToolBar.cpp b/Editor/widgets/CompactToolBar.cpp index 28813b0..38454b3 100644 --- a/Editor/widgets/CompactToolBar.cpp +++ b/Editor/widgets/CompactToolBar.cpp @@ -1,26 +1,26 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "CompactToolBar.h" -CompactToolBar::CompactToolBar(QWidget *parent) : - QToolBar(parent) +CompactToolBar::CompactToolBar(QWidget* parent) + : QToolBar(parent) { setMinimumHeight(1); setOrientation(Qt::Vertical); diff --git a/Editor/widgets/CompactToolBar.h b/Editor/widgets/CompactToolBar.h index 2f03b81..e3f7afc 100644 --- a/Editor/widgets/CompactToolBar.h +++ b/Editor/widgets/CompactToolBar.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -25,7 +25,7 @@ class CompactToolBar : public QToolBar { Q_OBJECT public: - explicit CompactToolBar(QWidget *parent = 0); + explicit CompactToolBar(QWidget* parent = 0); QSize sizeHint() const override; void updateMaximumHeight(); diff --git a/Editor/widgets/EscapableLineEdit.cpp b/Editor/widgets/EscapableLineEdit.cpp index b3e7fe3..ec78b36 100644 --- a/Editor/widgets/EscapableLineEdit.cpp +++ b/Editor/widgets/EscapableLineEdit.cpp @@ -1,35 +1,35 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 #include "EscapableLineEdit.h" -EscapableLineEdit::EscapableLineEdit(QWidget *parent) : - QLineEdit(parent) +EscapableLineEdit::EscapableLineEdit(QWidget* parent) + : QLineEdit(parent) { } void EscapableLineEdit::keyPressEvent(QKeyEvent* event) { - if(event->key() == Qt::Key_Escape) + if (event->key() == Qt::Key_Escape) emit editingCanceled(); else QLineEdit::keyPressEvent(event); diff --git a/Editor/widgets/EscapableLineEdit.h b/Editor/widgets/EscapableLineEdit.h index b7f976a..e201c28 100644 --- a/Editor/widgets/EscapableLineEdit.h +++ b/Editor/widgets/EscapableLineEdit.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -25,7 +25,7 @@ class EscapableLineEdit : public QLineEdit { Q_OBJECT public: - explicit EscapableLineEdit(QWidget *parent = 0); + explicit EscapableLineEdit(QWidget* parent = 0); signals: void editingCanceled(); diff --git a/Editor/widgets/ExponentialSpinBox.cpp b/Editor/widgets/ExponentialSpinBox.cpp index e200afc..8e1f1cb 100644 --- a/Editor/widgets/ExponentialSpinBox.cpp +++ b/Editor/widgets/ExponentialSpinBox.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -31,16 +31,16 @@ ExponentialSpinBox::ExponentialSpinBox(QWidget* parent) void ExponentialSpinBox::stepBy(int steps) { qint64 v = value(); - if(steps > 0) + if (steps > 0) { v <<= steps; - if(v > maximum()) + if (v > maximum()) v = maximum(); } else { v >>= -steps; - if(v < minimum()) + if (v < minimum()) v = minimum(); } diff --git a/Editor/widgets/ExponentialSpinBox.h b/Editor/widgets/ExponentialSpinBox.h index e4ebd27..56610d8 100644 --- a/Editor/widgets/ExponentialSpinBox.h +++ b/Editor/widgets/ExponentialSpinBox.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 diff --git a/Editor/widgets/FrequencyPlotHRuler.cpp b/Editor/widgets/FrequencyPlotHRuler.cpp index 889f71a..96f7826 100644 --- a/Editor/widgets/FrequencyPlotHRuler.cpp +++ b/Editor/widgets/FrequencyPlotHRuler.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -26,8 +26,8 @@ using namespace std; -FrequencyPlotHRuler::FrequencyPlotHRuler(QWidget* parent) : - QWidget(parent) +FrequencyPlotHRuler::FrequencyPlotHRuler(QWidget* parent) + : QWidget(parent) { } @@ -46,43 +46,43 @@ void FrequencyPlotHRuler::paintEvent(QPaintEvent*) double fromHz = s->xToHz(topLeft.x()); double toHz = s->xToHz(bottomRight.x()); const vector& bands = s->getBands(); - if(bands.empty()) + if (bands.empty()) { double hzBase = pow(10, floor(log10(fromHz))); fromHz = floor(fromHz / hzBase) * hzBase; fromHz += hzBase; - if(round(fromHz / hzBase) >= 10) + if (round(fromHz / hzBase) >= 10) hzBase *= 10; - for(double hz = fromHz; hz <= toHz;) + for (double hz = fromHz; hz <= toHz;) { double x = s->hzToX(hz); - if(x != -1) + if (x != -1) { QString text; - if(hz < 1000) + if (hz < 1000) text = QString("%0").arg(hz); else text = QString("%0k").arg(hz / 1000); - if(metrics.width(text) + 2 < s->hzToX(hz + hzBase) - x) + if (metrics.width(text) + 2 < s->hzToX(hz + hzBase) - x) painter.drawText(x - topLeft.x() + offsetLeft + 1, 0, 0, height(), Qt::TextDontClip | Qt::AlignCenter, text); } hz += hzBase; - if(round(hz / hzBase) >= 10) + if (round(hz / hzBase) >= 10) hzBase *= 10; } } else { vector::const_iterator it = lower_bound(bands.cbegin(), bands.cend(), fromHz); - for(; it != bands.cend() && *it < toHz; it++) + for (; it != bands.cend() && *it < toHz; it++) { double hz = *it; double x = s->hzToX(hz); - if(x != -1) + if (x != -1) { QString text; - if(hz < 1000) + if (hz < 1000) text = QString("%0").arg(hz); else text = QString("%0k").arg(hz / 1000); @@ -92,13 +92,13 @@ void FrequencyPlotHRuler::paintEvent(QPaintEvent*) } QPoint mousePos = view->getLastMousePos(); - if(!mousePos.isNull()) + if (!mousePos.isNull()) { QPointF mouseScenePos = view->mapToScene(mousePos); double hz = s->xToHz(mouseScenePos.x()); double x = s->hzToX(hz); - if(x != -1) + if (x != -1) { QString text = QString("%0").arg(hz, 0, 'f', 1); QFontMetrics metrics = painter.fontMetrics(); diff --git a/Editor/widgets/FrequencyPlotHRuler.h b/Editor/widgets/FrequencyPlotHRuler.h index e4b685c..2a52800 100644 --- a/Editor/widgets/FrequencyPlotHRuler.h +++ b/Editor/widgets/FrequencyPlotHRuler.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/Editor/widgets/FrequencyPlotItem.cpp b/Editor/widgets/FrequencyPlotItem.cpp index d6ae64d..8301e0e 100644 --- a/Editor/widgets/FrequencyPlotItem.cpp +++ b/Editor/widgets/FrequencyPlotItem.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 diff --git a/Editor/widgets/FrequencyPlotItem.h b/Editor/widgets/FrequencyPlotItem.h index 1e07dfd..dde402c 100644 --- a/Editor/widgets/FrequencyPlotItem.h +++ b/Editor/widgets/FrequencyPlotItem.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -26,7 +26,7 @@ class FrequencyPlotItem : public QGraphicsItem public: FrequencyPlotItem(double hz, double db); - enum { Type = UserType + 1 }; + enum {Type = UserType + 1}; virtual int type() const { return Type; diff --git a/Editor/widgets/FrequencyPlotScene.cpp b/Editor/widgets/FrequencyPlotScene.cpp index aae0cb4..0dcabea 100644 --- a/Editor/widgets/FrequencyPlotScene.cpp +++ b/Editor/widgets/FrequencyPlotScene.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "FrequencyPlotView.h" @@ -31,12 +31,11 @@ static double maxDb = 100; vector FrequencyPlotScene::bands15 = {25, 40, 63, 100, 160, 250, 400, 630, 1000, 1600, 2500, 4000, 6300, 10000, 16000}; vector FrequencyPlotScene::bands31 = {20, 25, 31.5, 40, 50, 63, 80, 100, 125, 160, 200, 250, 315, 400, 500, 630, 800, - 1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000, 6300, 8000, 10000, 12500, 16000, 20000 - }; + 1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000, 6300, 8000, 10000, 12500, 16000, 20000}; vector FrequencyPlotScene::bandsVar; -FrequencyPlotScene::FrequencyPlotScene(QObject *parent) : - QGraphicsScene(parent) +FrequencyPlotScene::FrequencyPlotScene(QObject* parent) + : QGraphicsScene(parent) { updateSceneRect(); } @@ -53,7 +52,7 @@ double FrequencyPlotScene::xToHz(double x) double FrequencyPlotScene::hzToX(double hz) { - if(hz < minHz || hz > maxHz) + if (hz < minHz || hz > maxHz) return -1; return log(hz / minHz) / log(maxHz / minHz) * maxX * zoomX; @@ -61,12 +60,12 @@ double FrequencyPlotScene::hzToX(double hz) double FrequencyPlotScene::yToDb(double y) { - return (minDb + (1 - y / zoomY / maxY) * (maxDb - minDb)); + return(minDb + (1 - y / zoomY / maxY) * (maxDb - minDb)); } double FrequencyPlotScene::dbToY(double db) { - if(db < minDb || db > maxDb) + if (db < minDb || db > maxDb) return -1; return (1 - (db - minDb) / (maxDb - minDb)) * maxY * zoomY; @@ -88,7 +87,7 @@ void FrequencyPlotScene::setZoom(double zoomX, double zoomY) this->zoomY = zoomY; updateSceneRect(); - for(QGraphicsItem* item : items()) + for (QGraphicsItem* item : items()) { FrequencyPlotItem* plotItem = (FrequencyPlotItem*)item; plotItem->updatePos(); @@ -107,7 +106,7 @@ int FrequencyPlotScene::getBandCount() const void FrequencyPlotScene::setBandCount(int value) { - if(value != bandCount) + if (value != bandCount) { bandCount = value; update(); @@ -121,9 +120,9 @@ const vector& FrequencyPlotScene::getBands() return getBands(bandCount); } -const std::vector&FrequencyPlotScene::getBands(int count) +const std::vector& FrequencyPlotScene::getBands(int count) { - switch(count) + switch (count) { case 15: return bands15; diff --git a/Editor/widgets/FrequencyPlotScene.h b/Editor/widgets/FrequencyPlotScene.h index 9b0264d..278013a 100644 --- a/Editor/widgets/FrequencyPlotScene.h +++ b/Editor/widgets/FrequencyPlotScene.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -28,9 +28,9 @@ class FrequencyPlotScene : public QGraphicsScene { Q_OBJECT public: - explicit FrequencyPlotScene(QObject *parent = 0); + explicit FrequencyPlotScene(QObject* parent = 0); - void addItem(FrequencyPlotItem *item); + void addItem(FrequencyPlotItem* item); double xToHz(double x); double hzToX(double hz); diff --git a/Editor/widgets/FrequencyPlotVRuler.cpp b/Editor/widgets/FrequencyPlotVRuler.cpp index d55e1e8..17e5033 100644 --- a/Editor/widgets/FrequencyPlotVRuler.cpp +++ b/Editor/widgets/FrequencyPlotVRuler.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -23,8 +23,8 @@ #include "FrequencyPlotScene.h" #include "FrequencyPlotVRuler.h" -FrequencyPlotVRuler::FrequencyPlotVRuler(QWidget *parent) : - QWidget(parent) +FrequencyPlotVRuler::FrequencyPlotVRuler(QWidget* parent) + : QWidget(parent) { } @@ -40,9 +40,9 @@ void FrequencyPlotVRuler::paintEvent(QPaintEvent*) double dbStep = abs(s->yToDb(0) - s->yToDb(30)); double dbBase = pow(10, floor(log10(dbStep))); - if(dbStep >= 5 * dbBase) + if (dbStep >= 5 * dbBase) dbStep = 5 * dbBase; - else if(dbStep >= 2 * dbBase) + else if (dbStep >= 2 * dbBase) dbStep = 2 * dbBase; else dbStep = dbBase; @@ -51,23 +51,23 @@ void FrequencyPlotVRuler::paintEvent(QPaintEvent*) double toDb = ceil(s->yToDb(bottomRight.y()) / dbStep) * dbStep; painter.setPen(QColor(50, 50, 50)); - for(double db = toDb; db <= fromDb; db += dbStep) + for (double db = toDb; db <= fromDb; db += dbStep) { - if(abs(db) < 1e-6) + if (abs(db) < 1e-6) db = 0; double y = s->dbToY(db); - if(y != -1) + if (y != -1) painter.drawText(0, y - topLeft.y() - 1, width(), 0, Qt::TextDontClip | Qt::AlignCenter, QString("%0").arg(db)); } QPoint mousePos = view->getLastMousePos(); - if(!mousePos.isNull()) + if (!mousePos.isNull()) { QPointF mouseScenePos = view->mapToScene(mousePos); double db = s->yToDb(mouseScenePos.y()); double y = s->dbToY(db); - if(y != -1) + if (y != -1) { QString text = QString("%0").arg(db, 0, 'f', 1); QFontMetrics metrics = painter.fontMetrics(); diff --git a/Editor/widgets/FrequencyPlotVRuler.h b/Editor/widgets/FrequencyPlotVRuler.h index b245f30..53daf23 100644 --- a/Editor/widgets/FrequencyPlotVRuler.h +++ b/Editor/widgets/FrequencyPlotVRuler.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -25,7 +25,7 @@ class FrequencyPlotVRuler : public QWidget { Q_OBJECT public: - explicit FrequencyPlotVRuler(QWidget *parent = 0); + explicit FrequencyPlotVRuler(QWidget* parent = 0); protected: void paintEvent(QPaintEvent*) override; diff --git a/Editor/widgets/FrequencyPlotView.cpp b/Editor/widgets/FrequencyPlotView.cpp index 44faacf..64944f4 100644 --- a/Editor/widgets/FrequencyPlotView.cpp +++ b/Editor/widgets/FrequencyPlotView.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 @@ -26,8 +26,8 @@ using namespace std; -FrequencyPlotView::FrequencyPlotView(QWidget *parent) : - QGraphicsView(parent) +FrequencyPlotView::FrequencyPlotView(QWidget* parent) + : QGraphicsView(parent) { setViewportMargins(32, 0, 0, 20); hRuler = new FrequencyPlotHRuler(this); @@ -51,7 +51,7 @@ void FrequencyPlotView::drawBackground(QPainter* painter, const QRectF& drawRect painter->setRenderHint(QPainter::Antialiasing, false); QRectF rect = drawRect; - if(!sceneRect().contains(rect)) + if (!sceneRect().contains(rect)) { rect = rect.intersected(sceneRect()); painter->setClipRect(rect); @@ -63,9 +63,9 @@ void FrequencyPlotView::drawBackground(QPainter* painter, const QRectF& drawRect double dbStep = abs(s->yToDb(0) - s->yToDb(30)); double dbBase = pow(10, floor(log10(dbStep))); - if(dbStep >= 5 * dbBase) + if (dbStep >= 5 * dbBase) dbStep = 5 * dbBase; - else if(dbStep >= 2 * dbBase) + else if (dbStep >= 2 * dbBase) dbStep = 2 * dbBase; else dbStep = dbBase; @@ -74,10 +74,10 @@ void FrequencyPlotView::drawBackground(QPainter* painter, const QRectF& drawRect double toDb = ceil(s->yToDb(rect.top()) / dbStep) * dbStep; painter->setPen(QColor(200, 200, 200)); - for(double db = fromDb; db <= toDb; db += dbStep) + for (double db = fromDb; db <= toDb; db += dbStep) { double y = floor(s->dbToY(db)) + 0.5; - if(y != -1) + if (y != -1) painter->drawLine(topLeft.x(), y, bottomRight.x(), y); } @@ -85,32 +85,32 @@ void FrequencyPlotView::drawBackground(QPainter* painter, const QRectF& drawRect double toHz = s->xToHz(rect.left() + rect.width()); const vector& bands = s->getBands(); - if(bands.empty()) + if (bands.empty()) { double hzBase = pow(10, floor(log10(fromHz))); fromHz = floor(fromHz / hzBase) * hzBase; fromHz += hzBase; - if(round(fromHz / hzBase) >= 10) + if (round(fromHz / hzBase) >= 10) hzBase *= 10; - for(double hz = fromHz; hz <= toHz;) + for (double hz = fromHz; hz <= toHz;) { double x = floor(s->hzToX(hz)) + 0.5; - if(x >= 0) + if (x >= 0) painter->drawLine(x, topLeft.y(), x, bottomRight.y()); hz += hzBase; - if(round(hz / hzBase) >= 10) + if (round(hz / hzBase) >= 10) hzBase *= 10; } } else { vector::const_iterator it = lower_bound(bands.cbegin(), bands.cend(), fromHz); - for(; it != bands.cend() && *it < toHz; it++) + for (; it != bands.cend() && *it < toHz; it++) { double hz = *it; double x = floor(s->hzToX(hz)) + 0.5; - if(x >= 0) + if (x >= 0) painter->drawLine(x, topLeft.y(), x, bottomRight.y()); } } @@ -146,25 +146,25 @@ void FrequencyPlotView::zoom(int deltaX, int deltaY, int mouseX, int mouseY) double zoomY = max(0.5, min(30.0, s->getZoomY() * zoomFactorY)); s->setZoom(zoomX, zoomY); - if(deltaX != 0) + if (deltaX != 0) { double x = s->hzToX(hz); - if(x != -1) + if (x != -1) horizontalScrollBar()->setValue(horizontalScrollBar()->value() + round(x - scenePos.x())); } - if(deltaY != 0) + if (deltaY != 0) { double y = s->dbToY(db); - if(y != -1) + if (y != -1) verticalScrollBar()->setValue(verticalScrollBar()->value() + round(y - scenePos.y())); } resetCachedContent(); viewport()->update(); - if(deltaX != 0) + if (deltaX != 0) hRuler->update(); - if(deltaY != 0) + if (deltaY != 0) vRuler->update(); } @@ -184,9 +184,9 @@ void FrequencyPlotView::scrollContentsBy(int dx, int dy) { QGraphicsView::scrollContentsBy(dx, dy); - if(dx != 0) + if (dx != 0) hRuler->update(); - if(dy != 0) + if (dy != 0) vRuler->update(); } @@ -209,7 +209,7 @@ void FrequencyPlotView::mousePressEvent(QMouseEvent* event) void FrequencyPlotView::mouseMoveEvent(QMouseEvent* event) { - if(event->buttons() & Qt::RightButton) + if (event->buttons() & Qt::RightButton) { horizontalScrollBar()->setValue(horizontalScrollBar()->value() - (event->x() - lastMousePos.x())); verticalScrollBar()->setValue(verticalScrollBar()->value() - (event->y() - lastMousePos.y())); @@ -230,13 +230,13 @@ void FrequencyPlotView::showEvent(QShowEvent* event) { QGraphicsView::showEvent(event); - if(presetScrollX != -1) + if (presetScrollX != -1) { horizontalScrollBar()->setValue(presetScrollX); presetScrollX = -1; } - if(presetScrollY != -1) + if (presetScrollY != -1) { verticalScrollBar()->setValue(presetScrollY); presetScrollY = -1; diff --git a/Editor/widgets/FrequencyPlotView.h b/Editor/widgets/FrequencyPlotView.h index 98fac58..f641c63 100644 --- a/Editor/widgets/FrequencyPlotView.h +++ b/Editor/widgets/FrequencyPlotView.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -29,7 +29,7 @@ class FrequencyPlotView : public QGraphicsView { Q_OBJECT public: - explicit FrequencyPlotView(QWidget *parent = 0); + explicit FrequencyPlotView(QWidget* parent = 0); FrequencyPlotScene* scene() const; void setScene(FrequencyPlotScene* scene); diff --git a/Editor/widgets/ResizeCorner.cpp b/Editor/widgets/ResizeCorner.cpp index be78412..f955025 100644 --- a/Editor/widgets/ResizeCorner.cpp +++ b/Editor/widgets/ResizeCorner.cpp @@ -1,27 +1,27 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 #include "ResizeCorner.h" -ResizeCorner::ResizeCorner(FilterTable* filterTable, QSize minimumSize, QSize maximumSize, std::function getFunc, std::function setFunc, QWidget *parent) +ResizeCorner::ResizeCorner(FilterTable* filterTable, QSize minimumSize, QSize maximumSize, std::function getFunc, std::function setFunc, QWidget* parent) : QLabel(parent), minimumSize(minimumSize), maximumSize(maximumSize), getFunc(getFunc), setFunc(setFunc), filterTable(filterTable) { setPixmap(QPixmap(":/icons/resize_corner.png")); diff --git a/Editor/widgets/ResizeCorner.h b/Editor/widgets/ResizeCorner.h index 74e703a..3b36128 100644 --- a/Editor/widgets/ResizeCorner.h +++ b/Editor/widgets/ResizeCorner.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -30,7 +30,7 @@ class ResizeCorner : public QLabel public: explicit ResizeCorner(FilterTable* filterTable, QSize minimumSize, QSize maximumSize, - std::function getFunc, std::function setFunc, QWidget *parent = 0); + std::function getFunc, std::function setFunc, QWidget* parent = 0); protected: void mousePressEvent(QMouseEvent* event) override; diff --git a/Editor/widgets/ResizingLineEdit.cpp b/Editor/widgets/ResizingLineEdit.cpp index bb5d576..c71447b 100644 --- a/Editor/widgets/ResizingLineEdit.cpp +++ b/Editor/widgets/ResizingLineEdit.cpp @@ -1,34 +1,34 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "ResizingLineEdit.h" -ResizingLineEdit::ResizingLineEdit(QWidget *parent) : - QLineEdit(parent) +ResizingLineEdit::ResizingLineEdit(QWidget* parent) + : QLineEdit(parent) { connect(this, SIGNAL(textChanged(QString)), this, SLOT(readjustSize())); readjustSize(); } -ResizingLineEdit::ResizingLineEdit(const QString& text, QWidget* parent) : - QLineEdit(text, parent) +ResizingLineEdit::ResizingLineEdit(const QString& text, QWidget* parent) + : QLineEdit(text, parent) { connect(this, SIGNAL(textChanged(QString)), this, SLOT(readjustSize())); diff --git a/Editor/widgets/ResizingLineEdit.h b/Editor/widgets/ResizingLineEdit.h index 717f543..15304c7 100644 --- a/Editor/widgets/ResizingLineEdit.h +++ b/Editor/widgets/ResizingLineEdit.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -25,8 +25,8 @@ class ResizingLineEdit : public QLineEdit { Q_OBJECT public: - explicit ResizingLineEdit(QWidget *parent = 0); - explicit ResizingLineEdit(const QString& text, QWidget* parent=0); + explicit ResizingLineEdit(QWidget* parent = 0); + explicit ResizingLineEdit(const QString& text, QWidget* parent = 0); QSize sizeHint() const override; diff --git a/EqualizerAPO.cpp b/EqualizerAPO.cpp index e3e623d..1e28597 100644 --- a/EqualizerAPO.cpp +++ b/EqualizerAPO.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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 "stdafx.h" @@ -33,16 +33,16 @@ using namespace std; long EqualizerAPO::instCount = 0; 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)); + (APO_FLAG)(APO_FLAG_FRAMESPERSECOND_MUST_MATCH | APO_FLAG_BITSPERSAMPLE_MUST_MATCH | APO_FLAG_INPLACE)); 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)); + (APO_FLAG)(APO_FLAG_FRAMESPERSECOND_MUST_MATCH | APO_FLAG_BITSPERSAMPLE_MUST_MATCH | APO_FLAG_INPLACE)); EqualizerAPO::EqualizerAPO(IUnknown* pUnkOuter) - :CBaseAudioProcessingObject(regPostMixProperties) + : CBaseAudioProcessingObject(regPostMixProperties) { refCount = 1; - if(pUnkOuter != NULL) + if (pUnkOuter != NULL) this->pUnkOuter = pUnkOuter; else this->pUnkOuter = reinterpret_cast(static_cast(this)); @@ -78,50 +78,50 @@ ULONG EqualizerAPO::Release() HRESULT EqualizerAPO::GetLatency(HNSTIME* pTime) { - if(!pTime) - return E_POINTER; + if (!pTime) + return E_POINTER; - if(!m_bIsLocked) - return APOERR_ALREADY_UNLOCKED; + if (!m_bIsLocked) + return APOERR_ALREADY_UNLOCKED; - *pTime = 0; - if(childAPO) + *pTime = 0; + if (childAPO) childAPO->GetLatency(pTime); - return S_OK; + return S_OK; } HRESULT EqualizerAPO::Initialize(UINT32 cbDataSize, BYTE* pbyData) { LogHelper::reset(); - TraceF(L"Initialize"); + TraceF(L"Initialize"); - if((NULL == pbyData) && (0 != cbDataSize)) + if ((NULL == pbyData) && (0 != cbDataSize)) return E_INVALIDARG; - if((NULL != pbyData) && (0 == cbDataSize)) + if ((NULL != pbyData) && (0 == cbDataSize)) return E_POINTER; - if(cbDataSize != sizeof(APOInitSystemEffects) ) + if (cbDataSize != sizeof(APOInitSystemEffects)) return E_INVALIDARG; resetChild(); - APOInitSystemEffects* initStruct = (APOInitSystemEffects*)pbyData; + APOInitSystemEffects* initStruct = (APOInitSystemEffects*)pbyData; GUID apoGuid = initStruct->APOInit.clsid; try { TraceF(L"APO GUID: %s", RegistryHelper::getGuidString(apoGuid).c_str()); } - catch(RegistryException e) + catch (RegistryException e) { LogF(L"Could not convert apo guid to guid string"); } engine.setPreMix((apoGuid == EQUALIZERAPO_PRE_MIX_GUID) != 0); - PROPVARIANT var; - PropVariantInit(&var); + PROPVARIANT var; + PropVariantInit(&var); HRESULT hr = initStruct->pAPOEndpointProperties->GetValue(PKEY_AudioEndpoint_GUID, &var); - if(FAILED(hr)) + if (FAILED(hr)) { LogF(L"Can't read endpoint guid"); return hr; @@ -134,35 +134,35 @@ HRESULT EqualizerAPO::Initialize(UINT32 cbDataSize, BYTE* pbyData) try { DeviceAPOInfo apoInfo; - if(apoInfo.load(deviceGuid)) + if (apoInfo.load(deviceGuid)) { engine.setDeviceInfo(apoInfo.isInput, apoInfo.currentInstallState.installPostMix, apoInfo.deviceName, apoInfo.connectionName, apoInfo.deviceGuid); - if(apoGuid == EQUALIZERAPO_PRE_MIX_GUID) + if (apoGuid == EQUALIZERAPO_PRE_MIX_GUID) childApoGuid = apoInfo.preMixChildGuid; else childApoGuid = apoInfo.postMixChildGuid; } } - catch(RegistryException e) + catch (RegistryException e) { LogF(L"Could not read endpoint device info because of: %s", e.getMessage().c_str()); } TraceF(L"Child APO GUID: %s", childApoGuid.c_str()); - if(childApoGuid != L"" && childApoGuid != APOGUID_NULL && childApoGuid != APOGUID_NOKEY && childApoGuid != APOGUID_NOVALUE) + if (childApoGuid != L"" && childApoGuid != APOGUID_NULL && childApoGuid != APOGUID_NOKEY && childApoGuid != APOGUID_NOVALUE) { GUID childGuid; hr = CLSIDFromString(childApoGuid.c_str(), &childGuid); - if(FAILED(hr)) + if (FAILED(hr)) { LogF(L"Can't convert child apo guid string to guid"); return S_OK; } hr = CoCreateInstance(childGuid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IAudioProcessingObject), (void**)&childAPO); - if(FAILED(hr)) + if (FAILED(hr)) { LogF(L"Error in CoCreateInstance for child apo"); resetChild(); @@ -170,7 +170,7 @@ HRESULT EqualizerAPO::Initialize(UINT32 cbDataSize, BYTE* pbyData) } hr = childAPO->QueryInterface(__uuidof(IAudioProcessingObjectRT), (void**)&childRT); - if(FAILED(hr)) + if (FAILED(hr)) { LogF(L"Error in QueryInterface for child apo RT"); resetChild(); @@ -178,7 +178,7 @@ HRESULT EqualizerAPO::Initialize(UINT32 cbDataSize, BYTE* pbyData) } hr = childAPO->QueryInterface(__uuidof(IAudioProcessingObjectConfiguration), (void**)&childCfg); - if(FAILED(hr)) + if (FAILED(hr)) { LogF(L"Error in QueryInterface for child apo configuration"); resetChild(); @@ -186,7 +186,7 @@ HRESULT EqualizerAPO::Initialize(UINT32 cbDataSize, BYTE* pbyData) } hr = childAPO->Initialize(cbDataSize, pbyData); - if(FAILED(hr)) + if (FAILED(hr)) { LogF(L"Error in Initialize of child apo"); resetChild(); @@ -200,66 +200,66 @@ HRESULT EqualizerAPO::Initialize(UINT32 cbDataSize, BYTE* pbyData) } HRESULT EqualizerAPO::IsInputFormatSupported(IAudioMediaType* pOutputFormat, - IAudioMediaType* pRequestedInputFormat, IAudioMediaType** ppSupportedInputFormat) + IAudioMediaType* pRequestedInputFormat, IAudioMediaType** ppSupportedInputFormat) { - if(!pRequestedInputFormat) + if (!pRequestedInputFormat) return E_POINTER; - UNCOMPRESSEDAUDIOFORMAT inFormat; - HRESULT hr = pRequestedInputFormat->GetUncompressedAudioFormat(&inFormat); - if(FAILED(hr)) + UNCOMPRESSEDAUDIOFORMAT inFormat; + HRESULT hr = pRequestedInputFormat->GetUncompressedAudioFormat(&inFormat); + if (FAILED(hr)) { LogF(L"Error in GetUncompressedAudioFormat"); return hr; } - TraceF(L"RequestedInputFormat = { %08X, %u, %u, %u, %f, %08X }", + TraceF(L"RequestedInputFormat = { %08X, %u, %u, %u, %f, %08X }", inFormat.guidFormatType.Data1, inFormat.dwSamplesPerFrame, inFormat.dwBytesPerSampleContainer, inFormat.dwValidBitsPerSample, inFormat.fFramesPerSecond, inFormat.dwChannelMask); - UNCOMPRESSEDAUDIOFORMAT outFormat; - hr = pOutputFormat->GetUncompressedAudioFormat(&outFormat); - if(FAILED(hr)) + UNCOMPRESSEDAUDIOFORMAT outFormat; + hr = pOutputFormat->GetUncompressedAudioFormat(&outFormat); + if (FAILED(hr)) { LogF(L"Error in second GetUncompressedAudioFormat"); return hr; } - TraceF(L"Output format = { %08X, %u, %u, %u, %f, %08X }", + TraceF(L"Output format = { %08X, %u, %u, %u, %f, %08X }", outFormat.guidFormatType.Data1, outFormat.dwSamplesPerFrame, outFormat.dwBytesPerSampleContainer, outFormat.dwValidBitsPerSample, outFormat.fFramesPerSecond, outFormat.dwChannelMask); - if(childAPO) - { - hr = childAPO->IsInputFormatSupported(pOutputFormat, pRequestedInputFormat, ppSupportedInputFormat); - if(SUCCEEDED(hr)) - { - TraceF(L"Success in IsInputFormatSupported of child apo"); - } + if (childAPO) + { + hr = childAPO->IsInputFormatSupported(pOutputFormat, pRequestedInputFormat, ppSupportedInputFormat); + if (SUCCEEDED(hr)) + { + TraceF(L"Success in IsInputFormatSupported of child apo"); + } else { LogF(L"Failure in IsInputFormatSupported of child apo"); resetChild(); } - } + } - if(!childAPO || !SUCCEEDED(hr)) + if (!childAPO || !SUCCEEDED(hr)) { hr = CBaseAudioProcessingObject::IsInputFormatSupported(pOutputFormat, pRequestedInputFormat, ppSupportedInputFormat); // we do not support downmixing currently - if(hr == S_OK && inFormat.dwSamplesPerFrame > 2 && inFormat.dwSamplesPerFrame > outFormat.dwSamplesPerFrame) + if (hr == S_OK && inFormat.dwSamplesPerFrame > 2 && inFormat.dwSamplesPerFrame > outFormat.dwSamplesPerFrame) { CreateAudioMediaTypeFromUncompressedAudioFormat(&outFormat, ppSupportedInputFormat); hr = S_FALSE; } } - if(hr == S_FALSE) + if (hr == S_FALSE) { UNCOMPRESSEDAUDIOFORMAT supportedFormat; HRESULT hr2 = (*ppSupportedInputFormat)->GetUncompressedAudioFormat(&supportedFormat); - if(FAILED(hr2)) + if (FAILED(hr2)) { LogF(L"Error in third GetUncompressedAudioFormat"); return hr2; @@ -269,7 +269,7 @@ HRESULT EqualizerAPO::IsInputFormatSupported(IAudioMediaType* pOutputFormat, supportedFormat.guidFormatType.Data1, supportedFormat.dwSamplesPerFrame, supportedFormat.dwBytesPerSampleContainer, supportedFormat.dwValidBitsPerSample, supportedFormat.fFramesPerSecond, supportedFormat.dwChannelMask); } - else if(hr == S_OK) + else if (hr == S_OK) { TraceF(L"InputFormat accepted"); } @@ -278,14 +278,14 @@ HRESULT EqualizerAPO::IsInputFormatSupported(IAudioMediaType* pOutputFormat, } HRESULT EqualizerAPO::LockForProcess(UINT32 u32NumInputConnections, - APO_CONNECTION_DESCRIPTOR** ppInputConnections, UINT32 u32NumOutputConnections, - APO_CONNECTION_DESCRIPTOR** ppOutputConnections) + APO_CONNECTION_DESCRIPTOR** ppInputConnections, UINT32 u32NumOutputConnections, + APO_CONNECTION_DESCRIPTOR** ppOutputConnections) { HRESULT hr; - UNCOMPRESSEDAUDIOFORMAT inFormat; - hr = ppInputConnections[0]->pFormat->GetUncompressedAudioFormat(&inFormat); - if(FAILED(hr)) + UNCOMPRESSEDAUDIOFORMAT inFormat; + hr = ppInputConnections[0]->pFormat->GetUncompressedAudioFormat(&inFormat); + if (FAILED(hr)) { LogF(L"Error in GetUncompressedAudioFormat in LockForProcess"); return hr; @@ -293,13 +293,13 @@ HRESULT EqualizerAPO::LockForProcess(UINT32 u32NumInputConnections, unsigned maxInputFrameCount = ppInputConnections[0]->u32MaxFrameCount; - TraceF(L"Input format in LockForProcess = { %08X, %u, %u, %u, %f, %08X, %u }", + TraceF(L"Input format in LockForProcess = { %08X, %u, %u, %u, %f, %08X, %u }", inFormat.guidFormatType.Data1, inFormat.dwSamplesPerFrame, inFormat.dwBytesPerSampleContainer, inFormat.dwValidBitsPerSample, inFormat.fFramesPerSecond, inFormat.dwChannelMask, maxInputFrameCount); - UNCOMPRESSEDAUDIOFORMAT outFormat; - hr = ppOutputConnections[0]->pFormat->GetUncompressedAudioFormat(&outFormat); - if(FAILED(hr)) + UNCOMPRESSEDAUDIOFORMAT outFormat; + hr = ppOutputConnections[0]->pFormat->GetUncompressedAudioFormat(&outFormat); + if (FAILED(hr)) { LogF(L"Error in second GetUncompressedAudioFormat in LockForProcess"); return hr; @@ -307,89 +307,89 @@ HRESULT EqualizerAPO::LockForProcess(UINT32 u32NumInputConnections, unsigned maxOutputFrameCount = ppOutputConnections[0]->u32MaxFrameCount; - TraceF(L"Output format in LockForProcess = { %08X, %u, %u, %u, %f, %08X, %u }", + TraceF(L"Output format in LockForProcess = { %08X, %u, %u, %u, %f, %08X, %u }", outFormat.guidFormatType.Data1, outFormat.dwSamplesPerFrame, outFormat.dwBytesPerSampleContainer, outFormat.dwValidBitsPerSample, outFormat.fFramesPerSecond, outFormat.dwChannelMask, maxOutputFrameCount); - if(childCfg != NULL) + if (childCfg != NULL) { hr = childCfg->LockForProcess(u32NumInputConnections, ppInputConnections, u32NumOutputConnections, - ppOutputConnections); - if(SUCCEEDED(hr)) + ppOutputConnections); + if (SUCCEEDED(hr)) TraceF(L"Success in LockForProcess of child apo"); } - hr = CBaseAudioProcessingObject::LockForProcess(u32NumInputConnections, ppInputConnections, - u32NumOutputConnections, ppOutputConnections); - if(FAILED(hr)) + hr = CBaseAudioProcessingObject::LockForProcess(u32NumInputConnections, ppInputConnections, + u32NumOutputConnections, ppOutputConnections); + if (FAILED(hr)) { LogF(L"Error in CBaseAudioProcessingObject::LockForProcess"); return hr; } - else if(hr == S_OK) + else if (hr == S_OK) { TraceF(L"LockForProcess successful"); } unsigned maxFrameCount = maxInputFrameCount; - if(maxFrameCount == 0) + if (maxFrameCount == 0) maxFrameCount = maxOutputFrameCount; unsigned realChannelCount; - if(childCfg != NULL) + if (childCfg != NULL) realChannelCount = outFormat.dwSamplesPerFrame; else realChannelCount = inFormat.dwSamplesPerFrame; unsigned channelMask; - if(engine.isCapture()) + if (engine.isCapture()) { channelMask = inFormat.dwChannelMask; - if(channelMask == 0 && inFormat.dwSamplesPerFrame == outFormat.dwSamplesPerFrame) + if (channelMask == 0 && inFormat.dwSamplesPerFrame == outFormat.dwSamplesPerFrame) channelMask = outFormat.dwChannelMask; } else { channelMask = outFormat.dwChannelMask; - if(channelMask == 0 && inFormat.dwSamplesPerFrame == outFormat.dwSamplesPerFrame) + if (channelMask == 0 && inFormat.dwSamplesPerFrame == outFormat.dwSamplesPerFrame) channelMask = inFormat.dwChannelMask; } engine.initialize(outFormat.fFramesPerSecond, inFormat.dwSamplesPerFrame, realChannelCount, outFormat.dwSamplesPerFrame, channelMask, maxFrameCount); - return hr; + return hr; } HRESULT EqualizerAPO::UnlockForProcess() { - if(childCfg) + if (childCfg) { HRESULT hr = childCfg->UnlockForProcess(); - if(FAILED(hr)) + if (FAILED(hr)) { LogF(L"Error in UnlockForProcess"); return hr; } } - return CBaseAudioProcessingObject::UnlockForProcess(); + return CBaseAudioProcessingObject::UnlockForProcess(); } void EqualizerAPO::resetChild() { - if(childAPO != NULL) + if (childAPO != NULL) { childAPO->Release(); childAPO = NULL; } - if(childRT != NULL) + if (childRT != NULL) { childRT->Release(); childRT = NULL; } - if(childCfg != NULL) + if (childCfg != NULL) { childCfg->Release(); childCfg = NULL; @@ -401,46 +401,46 @@ void EqualizerAPO::APOProcess(UINT32 u32NumInputConnections, APO_CONNECTION_PROPERTY** ppInputConnections, UINT32 u32NumOutputConnections, APO_CONNECTION_PROPERTY** ppOutputConnections) { - switch( ppInputConnections[0]->u32BufferFlags ) - { - case BUFFER_VALID: - case BUFFER_SILENT: - { - float* inputFrames = reinterpret_cast(ppInputConnections[0]->pBuffer); - float* outputFrames = reinterpret_cast(ppOutputConnections[0]->pBuffer); + switch (ppInputConnections[0]->u32BufferFlags) + { + case BUFFER_VALID: + case BUFFER_SILENT: + { + float* inputFrames = reinterpret_cast(ppInputConnections[0]->pBuffer); + float* outputFrames = reinterpret_cast(ppOutputConnections[0]->pBuffer); - if(ppInputConnections[0]->u32BufferFlags == BUFFER_SILENT) + if (ppInputConnections[0]->u32BufferFlags == BUFFER_SILENT) memset(inputFrames, 0, ppInputConnections[0]->u32ValidFrameCount * engine.getInputChannelCount() * sizeof(float)); - if(childRT) - { - childRT->APOProcess(u32NumInputConnections, ppInputConnections, u32NumOutputConnections, ppOutputConnections); + if (childRT) + { + childRT->APOProcess(u32NumInputConnections, ppInputConnections, u32NumOutputConnections, ppOutputConnections); engine.process(outputFrames, outputFrames, ppInputConnections[0]->u32ValidFrameCount); - } - else - engine.process(outputFrames, inputFrames, ppInputConnections[0]->u32ValidFrameCount); + } + else + engine.process(outputFrames, inputFrames, ppInputConnections[0]->u32ValidFrameCount); - ppOutputConnections[0]->u32ValidFrameCount = ppInputConnections[0]->u32ValidFrameCount; + ppOutputConnections[0]->u32ValidFrameCount = ppInputConnections[0]->u32ValidFrameCount; ppOutputConnections[0]->u32BufferFlags = BUFFER_VALID; - break; - } - } + break; + } + } } #pragma AVRT_CODE_END HRESULT EqualizerAPO::NonDelegatingQueryInterface(const IID& iid, void** ppv) { - if(iid == __uuidof(IUnknown)) + if (iid == __uuidof(IUnknown)) *ppv = static_cast(this); - else if(iid == __uuidof(IAudioProcessingObject)) + else if (iid == __uuidof(IAudioProcessingObject)) *ppv = static_cast(this); - else if(iid == __uuidof(IAudioProcessingObjectRT)) + else if (iid == __uuidof(IAudioProcessingObjectRT)) *ppv = static_cast(this); - else if(iid == __uuidof(IAudioProcessingObjectConfiguration)) + else if (iid == __uuidof(IAudioProcessingObjectConfiguration)) *ppv = static_cast(this); - else if(iid == __uuidof(IAudioSystemEffects)) + else if (iid == __uuidof(IAudioSystemEffects)) *ppv = static_cast(this); else { @@ -459,7 +459,7 @@ ULONG EqualizerAPO::NonDelegatingAddRef() ULONG EqualizerAPO::NonDelegatingRelease() { - if(InterlockedDecrement(&refCount) == 0) + if (InterlockedDecrement(&refCount) == 0) { delete this; return 0; diff --git a/EqualizerAPO.h b/EqualizerAPO.h index 073a524..2089fbf 100644 --- a/EqualizerAPO.h +++ b/EqualizerAPO.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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. */ #pragma once @@ -31,8 +31,7 @@ class INonDelegatingUnknown virtual ULONG __stdcall NonDelegatingRelease() = 0; }; -class EqualizerAPO - : public CBaseAudioProcessingObject, public IAudioSystemEffects, public INonDelegatingUnknown +class EqualizerAPO : public CBaseAudioProcessingObject, public IAudioSystemEffects, public INonDelegatingUnknown { public: EqualizerAPO(IUnknown* pUnkOuter); @@ -53,7 +52,7 @@ public: virtual HRESULT __stdcall LockForProcess(UINT32 u32NumInputConnections, APO_CONNECTION_DESCRIPTOR** ppInputConnections, UINT32 u32NumOutputConnections, APO_CONNECTION_DESCRIPTOR** ppOutputConnections); - virtual HRESULT __stdcall UnlockForProcess(void); + virtual HRESULT __stdcall UnlockForProcess(void); // IAudioProcessingObjectRT virtual void __stdcall APOProcess(UINT32 u32NumInputConnections, diff --git a/FilterConfiguration.cpp b/FilterConfiguration.cpp index 7e5df39..b2a24cc 100644 --- a/FilterConfiguration.cpp +++ b/FilterConfiguration.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -34,17 +34,17 @@ FilterConfiguration::FilterConfiguration(FilterEngine* engine, const vectorgetMaxFrameCount(); allSamples = (float**)MemoryHelper::alloc(allChannelCount * sizeof(float*)); - for(size_t i=0; ifilterInfos = (FilterInfo**)MemoryHelper::alloc(filterCount * sizeof(FilterInfo*)); - for(size_t i=0; ifilterInfos[i] = filterInfos[i]; } @@ -53,21 +53,21 @@ FilterConfiguration::~FilterConfiguration() MemoryHelper::free(currentSamples2); MemoryHelper::free(currentSamples); - for(size_t i=0; ifilter->~IFilter(); MemoryHelper::free(filterInfos[i]->filter); - if(filterInfos[i]->inChannels != NULL) + if (filterInfos[i]->inChannels != NULL) MemoryHelper::free(filterInfos[i]->inChannels); - if(filterInfos[i]->outChannels != NULL) + if (filterInfos[i]->outChannels != NULL) MemoryHelper::free(filterInfos[i]->outChannels); MemoryHelper::free(filterInfos[i]); } @@ -77,20 +77,20 @@ FilterConfiguration::~FilterConfiguration() #pragma AVRT_CODE_BEGIN void FilterConfiguration::process(float* input, unsigned frameCount) { -#define DEINTERLEAVE_MACRO(ccount) \ +#define DEINTERLEAVE_MACRO(ccount)\ {\ - for (size_t c=0; c= stereo output, upmix to stereo as the Windows audio system would do automatically if no APO was present - if(realChannelCount == 1 && outputChannelCount >= 2) + if (realChannelCount == 1 && outputChannelCount >= 2) memcpy(allSamples[1], allSamples[0], frameCount * sizeof(float)); - for(size_t i=0; iinChannelCount; j++) + for (size_t j = 0; j < filterInfo->inChannelCount; j++) currentSamples[j] = allSamples[filterInfo->inChannels[j]]; - if(filterInfo->inPlace) + if (filterInfo->inPlace) { - for(size_t j=0; joutChannelCount; j++) + for (size_t j = 0; j < filterInfo->outChannelCount; j++) currentSamples2[j] = allSamples[filterInfo->outChannels[j]]; } else { - for(size_t j=0; joutChannelCount; j++) + for (size_t j = 0; j < filterInfo->outChannelCount; j++) currentSamples2[j] = allSamples2[filterInfo->outChannels[j]]; } filterInfo->filter->process(currentSamples2, currentSamples, frameCount); - if(!filterInfo->inPlace) + if (!filterInfo->inPlace) { - for(size_t j=0; joutChannelCount; j++) + for (size_t j = 0; j < filterInfo->outChannelCount; j++) swap(allSamples[filterInfo->outChannels[j]], allSamples2[filterInfo->outChannels[j]]); swap(currentSamples, currentSamples2); } @@ -144,18 +144,18 @@ void FilterConfiguration::process(float* input, unsigned frameCount) void FilterConfiguration::write(float* output, unsigned frameCount) { -#define INTERLEAVE_MACRO(ccount) \ - for (size_t c=0; c::iterator it = factories.begin(); it != factories.end(); it++) - delete *it; + for (vector::iterator it = factories.begin(); it != factories.end(); it++) + delete*it; CloseHandle(loadSemaphore); DeleteCriticalSection(&loadSection); @@ -142,12 +142,12 @@ void FilterEngine::initialize(float sampleRate, unsigned inputChannelCount, unsi this->transitionLength = (unsigned)(sampleRate / 100); unsigned deviceChannelCount; - if(capture) + if (capture) deviceChannelCount = inputChannelCount; else deviceChannelCount = outputChannelCount; - if(channelMask == 0) + if (channelMask == 0) channelMask = ChannelHelper::getDefaultChannelMask(deviceChannelCount); this->channelMask = channelMask; @@ -159,7 +159,7 @@ void FilterEngine::initialize(float sampleRate, unsigned inputChannelCount, unsi { configPath = RegistryHelper::readValue(APP_REGPATH, L"ConfigPath"); } - catch(RegistryException e) + catch (RegistryException e) { LogF(L"Can't read config path because of: %s", e.getMessage().c_str()); LeaveCriticalSection(&loadSection); @@ -176,21 +176,21 @@ void FilterEngine::initialize(float sampleRate, unsigned inputChannelCount, unsi parser.AddPackage(PackageStr::Instance()); parser.AddPackage(PackageMatrix::Instance()); - for(vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) + for (vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) { IFilterFactory* factory = *it; factory->initialize(this); } - if(configPath != L"") + if (configPath != L"") { loadConfig(customPath); - if(threadHandle == NULL && customPath.empty()) + if (threadHandle == NULL && customPath.empty()) { shutdownEvent = CreateEventW(NULL, true, false, NULL); threadHandle = CreateThread(NULL, 0, notificationThread, this, 0, NULL); - if(threadHandle == INVALID_HANDLE_VALUE) + if (threadHandle == INVALID_HANDLE_VALUE) threadHandle = NULL; else TraceF(L"Successfully created directory change notification thread %d for %s and its subtree", GetThreadId(threadHandle), configPath.c_str()); @@ -203,7 +203,7 @@ void FilterEngine::loadConfig(const wstring& customPath) { EnterCriticalSection(&loadSection); timer.start(); - if(previousConfig != NULL) + if (previousConfig != NULL) { previousConfig->~FilterConfiguration(); MemoryHelper::free(previousConfig); @@ -218,36 +218,36 @@ void FilterEngine::loadConfig(const wstring& customPath) watchRegistryKeys.clear(); parser.ClearVar(); - for(vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) + for (vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) { IFilterFactory* factory = *it; vector newFilters = factory->startOfConfiguration(); - if(!newFilters.empty()) + if (!newFilters.empty()) addFilters(newFilters); } - if(customPath.empty()) + if (customPath.empty()) loadConfigFile(configPath + L"\\config.txt"); else loadConfigFile(customPath); - for(vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) + for (vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) { IFilterFactory* factory = *it; vector newFilters = factory->endOfConfiguration(); - if(!newFilters.empty()) + if (!newFilters.empty()) addFilters(newFilters); } void* mem = MemoryHelper::alloc(sizeof(FilterConfiguration)); - FilterConfiguration* config = new (mem) FilterConfiguration(this, filterInfos, (unsigned)allChannelNames.size()); + FilterConfiguration* config = new(mem) FilterConfiguration(this, filterInfos, (unsigned)allChannelNames.size()); filterInfos.clear(); double loadTime = timer.stop(); TraceF(L"Finished loading configuration after %lf milliseconds", loadTime * 1000.0); - if(currentConfig == NULL) + if (currentConfig == NULL) currentConfig = config; else nextConfig = config; @@ -260,13 +260,13 @@ void FilterEngine::loadConfigFile(const wstring& path) TraceF(L"Loading configuration from %s", path.c_str()); HANDLE hFile = INVALID_HANDLE_VALUE; - while(hFile == INVALID_HANDLE_VALUE) + while (hFile == INVALID_HANDLE_VALUE) { hFile = CreateFile(path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if(hFile == INVALID_HANDLE_VALUE) + if (hFile == INVALID_HANDLE_VALUE) { DWORD error = GetLastError(); - if(error != ERROR_SHARING_VIOLATION) + if (error != ERROR_SHARING_VIOLATION) { LogF(L"Error while reading configuration file: %s", StringHelper::getSystemErrorString(error).c_str()); return; @@ -281,7 +281,7 @@ void FilterEngine::loadConfigFile(const wstring& path) char buf[8192]; unsigned long bytesRead = -1; - while(ReadFile(hFile, buf, sizeof(buf), &bytesRead, NULL) && bytesRead != 0) + while (ReadFile(hFile, buf, sizeof(buf), &bytesRead, NULL) && bytesRead != 0) { inputStream.write(buf, bytesRead); } @@ -292,27 +292,27 @@ void FilterEngine::loadConfigFile(const wstring& path) vector savedChannelNames = currentChannelNames; - for(vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) + for (vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) { IFilterFactory* factory = *it; vector newFilters = factory->startOfFile(path); - if(!newFilters.empty()) + if (!newFilters.empty()) addFilters(newFilters); } - while(inputStream.good()) + while (inputStream.good()) { string encodedLine; getline(inputStream, encodedLine); - if(encodedLine.size() > 0 && encodedLine[encodedLine.size()-1] == '\r') - encodedLine.resize(encodedLine.size()-1); + if (encodedLine.size() > 0 && encodedLine[encodedLine.size() - 1] == '\r') + encodedLine.resize(encodedLine.size() - 1); wstring line = StringHelper::toWString(encodedLine, CP_UTF8); - if(line.find(L'\uFFFD') != -1) + if (line.find(L'\uFFFD') != -1) line = StringHelper::toWString(encodedLine, CP_ACP); size_t pos = line.find(L':'); - if(pos != -1) + if (pos != -1) { wstring key = line.substr(0, pos); wstring value = line.substr(pos + 1); @@ -320,7 +320,7 @@ void FilterEngine::loadConfigFile(const wstring& path) // allow to use indentation key = StringHelper::trim(key); - for(vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) + for (vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) { IFilterFactory* factory = *it; @@ -329,14 +329,14 @@ void FilterEngine::loadConfigFile(const wstring& path) { newFilters = factory->createFilter(path, key, value); } - catch(exception e) + catch (exception e) { LogF(L"%S", e.what()); } - if(key == L"") + if (key == L"") break; - if(!newFilters.empty()) + if (!newFilters.empty()) { addFilters(newFilters); break; @@ -345,11 +345,11 @@ void FilterEngine::loadConfigFile(const wstring& path) } } - for(vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) + for (vector::const_iterator it = factories.cbegin(); it != factories.cend(); it++) { IFilterFactory* factory = *it; vector newFilters = factory->endOfFile(path); - if(!newFilters.empty()) + if (!newFilters.empty()) addFilters(newFilters); } @@ -363,14 +363,14 @@ void FilterEngine::watchRegistryKey(const std::wstring& key) } #pragma AVRT_CODE_BEGIN -void FilterEngine::process(float *output, float *input, unsigned frameCount) +void FilterEngine::process(float* output, float* input, unsigned frameCount) { - if(currentConfig->isEmpty() && nextConfig == NULL) + if (currentConfig->isEmpty() && nextConfig == NULL) { // avoid (de-)interleaving cost if no processing will happen anyway - if(realChannelCount == outputChannelCount) + if (realChannelCount == outputChannelCount) { - if(input != output) + if (input != output) memcpy(output, input, outputChannelCount * frameCount * sizeof(float)); return; @@ -379,20 +379,20 @@ void FilterEngine::process(float *output, float *input, unsigned frameCount) currentConfig->process(input, frameCount); - if(nextConfig != NULL) + if (nextConfig != NULL) { nextConfig->process(input, frameCount); float** currentSamples = currentConfig->getOutputSamples(); float** nextSamples = nextConfig->getOutputSamples(); - for(unsigned f=0; f= transitionLength) + if (transitionCounter >= transitionLength) factor = 1.0f; - for(unsigned c=0; cwrite(output, frameCount); - if(nextConfig != NULL && transitionCounter >= transitionLength) + if (nextConfig != NULL && transitionCounter >= transitionLength) { previousConfig = currentConfig; currentConfig = nextConfig; @@ -413,7 +413,7 @@ void FilterEngine::process(float *output, float *input, unsigned frameCount) void FilterEngine::addFilters(vector filters) { - for(vector::iterator it = filters.begin(); it != filters.end(); it++) + for (vector::iterator it = filters.begin(); it != filters.end(); it++) { IFilter* filter = *it; FilterInfo* filterInfo = (FilterInfo*)MemoryHelper::alloc(sizeof(FilterInfo)); @@ -421,10 +421,10 @@ void FilterEngine::addFilters(vector filters) filterInfo->inPlace = filter->getInPlace(); vector savedChannelNames = currentChannelNames; bool allChannels = filter->getAllChannels(); - if(allChannels) + if (allChannels) currentChannelNames = allChannelNames; - if(lastChannelNames == currentChannelNames) + if (lastChannelNames == currentChannelNames) { filterInfo->inChannelCount = 0; filterInfo->inChannels = NULL; @@ -435,7 +435,7 @@ void FilterEngine::addFilters(vector filters) filterInfo->inChannels = (size_t*)MemoryHelper::alloc(filterInfo->inChannelCount * sizeof(size_t)); size_t c = 0; - for(vector::iterator it2 = currentChannelNames.begin(); it2 != currentChannelNames.end(); it2++) + for (vector::iterator it2 = currentChannelNames.begin(); it2 != currentChannelNames.end(); it2++) { vector::iterator pos = find(allChannelNames.begin(), allChannelNames.end(), *it2); filterInfo->inChannels[c++] = pos - allChannelNames.begin(); @@ -446,7 +446,7 @@ void FilterEngine::addFilters(vector filters) vector newChannelNames = filter->initialize(sampleRate, maxFrameCount, currentChannelNames); - if(filterInfo->inPlace && lastInPlace && lastNewChannelNames == newChannelNames) + if (filterInfo->inPlace && lastInPlace && lastNewChannelNames == newChannelNames) { filterInfo->outChannelCount = 0; filterInfo->outChannels = NULL; @@ -457,10 +457,10 @@ void FilterEngine::addFilters(vector filters) filterInfo->outChannels = (size_t*)MemoryHelper::alloc(filterInfo->outChannelCount * sizeof(size_t)); size_t c = 0; - for(vector::iterator it2 = newChannelNames.begin(); it2 != newChannelNames.end(); it2++) + for (vector::iterator it2 = newChannelNames.begin(); it2 != newChannelNames.end(); it2++) { vector::iterator pos = find(allChannelNames.begin(), allChannelNames.end(), *it2); - if(pos == allChannelNames.end()) + if (pos == allChannelNames.end()) { filterInfo->outChannels[c++] = allChannelNames.size(); allChannelNames.push_back(*it2); @@ -474,12 +474,12 @@ void FilterEngine::addFilters(vector filters) lastNewChannelNames = newChannelNames; lastInPlace = filterInfo->inPlace; - if(!lastInPlace) + if (!lastInPlace) swap(lastChannelNames, lastNewChannelNames); filterInfos.push_back(filterInfo); - if(filter->getSelectChannels()) + if (filter->getSelectChannels()) currentChannelNames = newChannelNames; else currentChannelNames = savedChannelNames; @@ -488,21 +488,21 @@ void FilterEngine::addFilters(vector filters) void FilterEngine::cleanupConfigurations() { - if(currentConfig != NULL) + if (currentConfig != NULL) { currentConfig->~FilterConfiguration(); MemoryHelper::free(currentConfig); currentConfig = NULL; } - if(nextConfig != NULL) + if (nextConfig != NULL) { nextConfig->~FilterConfiguration(); MemoryHelper::free(nextConfig); nextConfig = NULL; } - if(previousConfig != NULL) + if (previousConfig != NULL) { previousConfig->~FilterConfiguration(); MemoryHelper::free(previousConfig); @@ -515,16 +515,16 @@ unsigned long __stdcall FilterEngine::notificationThread(void* parameter) FilterEngine* engine = (FilterEngine*)parameter; HANDLE notificationHandle = FindFirstChangeNotificationW(engine->configPath.c_str(), true, FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE); - if(notificationHandle == INVALID_HANDLE_VALUE) + if (notificationHandle == INVALID_HANDLE_VALUE) notificationHandle = NULL; HANDLE registryEvent = CreateEventW(NULL, true, false, NULL); HANDLE handles[3] = {engine->shutdownEvent, notificationHandle, registryEvent}; - while(true) + while (true) { vector keyHandles; - for(auto it = engine->watchRegistryKeys.begin(); it != engine->watchRegistryKeys.end(); it++) + for (auto it = engine->watchRegistryKeys.begin(); it != engine->watchRegistryKeys.end(); it++) { try { @@ -532,7 +532,7 @@ unsigned long __stdcall FilterEngine::notificationThread(void* parameter) keyHandles.push_back(keyHandle); RegNotifyChangeKeyValue(keyHandle, false, REG_NOTIFY_CHANGE_LAST_SET, registryEvent, true); } - catch(RegistryException e) + catch (RegistryException e) { LogFStatic(L"%s", e.getMessage().c_str()); } @@ -540,30 +540,30 @@ unsigned long __stdcall FilterEngine::notificationThread(void* parameter) DWORD which = WaitForMultipleObjects(3, handles, false, INFINITE); - for(auto it = keyHandles.begin(); it != keyHandles.end(); it++) + for (auto it = keyHandles.begin(); it != keyHandles.end(); it++) { RegCloseKey(*it); } - if(which == WAIT_OBJECT_0) + if (which == WAIT_OBJECT_0) { - //Shutdown + // Shutdown break; } else { - if(which == WAIT_OBJECT_0 + 1) + if (which == WAIT_OBJECT_0 + 1) { FindNextChangeNotification(notificationHandle); - //Wait for second event within 10 milliseconds to avoid loading twice + // Wait for second event within 10 milliseconds to avoid loading twice WaitForMultipleObjects(1, ¬ificationHandle, false, 10); } HANDLE handles[2] = {engine->shutdownEvent, engine->loadSemaphore}; DWORD which = WaitForMultipleObjects(2, handles, false, INFINITE); - if(which == WAIT_OBJECT_0) + if (which == WAIT_OBJECT_0) { - //Shutdown + // Shutdown break; } diff --git a/FilterEngine.h b/FilterEngine.h index dc64602..554df36 100644 --- a/FilterEngine.h +++ b/FilterEngine.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once @@ -44,7 +44,7 @@ public: void loadConfig(const std::wstring& customPath = L""); void loadConfigFile(const std::wstring& path); void watchRegistryKey(const std::wstring& key); - void process(float *output, float *input, unsigned frameCount); + void process(float* output, float* input, unsigned frameCount); bool isPreMix() const {return preMix;} bool isCapture() const {return capture;} diff --git a/IFilter.cpp b/IFilter.cpp index 674045e..d3c715e 100644 --- a/IFilter.cpp +++ b/IFilter.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" diff --git a/IFilter.h b/IFilter.h index 41e8aa5..c8b38d3 100644 --- a/IFilter.h +++ b/IFilter.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/IFilterFactory.h b/IFilterFactory.h index f73eff9..6a819d3 100644 --- a/IFilterFactory.h +++ b/IFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/BiQuad.cpp b/filters/BiQuad.cpp index 1172ae7..cda15d3 100644 --- a/filters/BiQuad.cpp +++ b/filters/BiQuad.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2013 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2013 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 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. + 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. + 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 "stdafx.h" @@ -25,7 +25,7 @@ using namespace std; BiQuad::BiQuad(Type type, double dbGain, double freq, double srate, double bandwidthOrQOrS, bool isBandwidth) { double A; - if(type == PEAKING || type == LOW_SHELF || type == HIGH_SHELF) + if (type == PEAKING || type == LOW_SHELF || type == HIGH_SHELF) A = pow(10, dbGain / 40); else A = pow(10, dbGain / 20); @@ -37,30 +37,30 @@ BiQuad::BiQuad(Type type, double dbGain, double freq, double srate, double bandw if (type == LOW_SHELF || type == HIGH_SHELF) // S { - alpha = sn/2 * sqrt((A + 1/A) * (1/bandwidthOrQOrS - 1) + 2); + alpha = sn / 2 * sqrt((A + 1 / A) * (1 / bandwidthOrQOrS - 1) + 2); beta = 2 * sqrt(A) * alpha; } - else if(isBandwidth) // BW - alpha = sn * sinh(M_LN2/2 * bandwidthOrQOrS * omega / sn); + else if (isBandwidth) // BW + alpha = sn * sinh(M_LN2 / 2 * bandwidthOrQOrS * omega / sn); else // Q alpha = sn / (2 * bandwidthOrQOrS); double b0, b1, b2, a0, a1, a2; - switch(type) + switch (type) { case LOW_PASS: - b0 = (1 - cs) /2; + b0 = (1 - cs) / 2; b1 = 1 - cs; - b2 = (1 - cs) /2; + b2 = (1 - cs) / 2; a0 = 1 + alpha; a1 = -2 * cs; a2 = 1 - alpha; break; case HIGH_PASS: - b0 = (1 + cs) /2; + b0 = (1 + cs) / 2; b1 = -(1 + cs); - b2 = (1 + cs) /2; + b2 = (1 + cs) / 2; a0 = 1 + alpha; a1 = -2 * cs; a2 = 1 - alpha; @@ -130,7 +130,7 @@ BiQuad::BiQuad(Type type, double dbGain, double freq, double srate, double bandw double BiQuad::gainAt(double freq, double srate) { double omega = 2 * M_PI * freq / srate; - double sn = sin(omega/2.0); + double sn = sin(omega / 2.0); double phi = sn * sn; double b0 = this->a0; double b1 = this->a[0]; @@ -139,8 +139,8 @@ double BiQuad::gainAt(double freq, double srate) double a1 = this->a[2]; double a2 = this->a[3]; - double dbGain = 10*log10( pow(b0+b1+b2, 2) - 4*(b0*b1 + 4*b0*b2 + b1*b2)*phi + 16*b0*b2*phi*phi ) - -10*log10( pow(a0+a1+a2, 2) - 4*(a0*a1 + 4*a0*a2 + a1*a2)*phi + 16*a0*a2*phi*phi ); + double dbGain = 10 * log10(pow(b0 + b1 + b2, 2) - 4 * (b0 * b1 + 4 * b0 * b2 + b1 * b2) * phi + 16 * b0 * b2 * phi * phi) + - 10 * log10(pow(a0 + a1 + a2, 2) - 4 * (a0 * a1 + 4 * a0 * a2 + a1 * a2) * phi + 16 * a0 * a2 * phi * phi); return dbGain; } diff --git a/filters/BiQuad.h b/filters/BiQuad.h index f34d2d6..a3a960e 100644 --- a/filters/BiQuad.h +++ b/filters/BiQuad.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2013 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2013 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 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. + 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. + 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. */ #pragma once @@ -40,13 +40,13 @@ public: __forceinline void removeDenormals() { - if(IS_DENORMAL(x1)) + if (IS_DENORMAL(x1)) x1 = 0.0; - if(IS_DENORMAL(x2)) + if (IS_DENORMAL(x2)) x2 = 0.0; - if(IS_DENORMAL(y1)) + if (IS_DENORMAL(y1)) y1 = 0.0; - if(IS_DENORMAL(y2)) + if (IS_DENORMAL(y2)) y2 = 0.0; } diff --git a/filters/BiQuadFilter.cpp b/filters/BiQuadFilter.cpp index a72e7a2..1711b3a 100644 --- a/filters/BiQuadFilter.cpp +++ b/filters/BiQuadFilter.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -24,7 +24,7 @@ using namespace std; BiQuadFilter::BiQuadFilter(BiQuad::Type type, double dbGain, double freq, double bandwidthOrQOrS, bool isBandwidth, bool isCornerFreq) - :type(type), dbGain(dbGain), freq(freq), bandwidthOrQOrS(bandwidthOrQOrS), isBandwidth(isBandwidth), isCornerFreq(isCornerFreq) + : type(type), dbGain(dbGain), freq(freq), bandwidthOrQOrS(bandwidthOrQOrS), isBandwidth(isBandwidth), isCornerFreq(isCornerFreq) { channelCount = 0; biquads = NULL; @@ -32,7 +32,7 @@ BiQuadFilter::BiQuadFilter(BiQuad::Type type, double dbGain, double freq, double BiQuadFilter::~BiQuadFilter() { - if(biquads != NULL) + if (biquads != NULL) { MemoryHelper::free(biquads); biquads = NULL; @@ -44,19 +44,19 @@ vector BiQuadFilter::initialize(float sampleRate, unsigned maxFrameCoun this->channelCount = channelNames.size(); biquads = (BiQuad*)MemoryHelper::alloc(channelCount * sizeof(BiQuad)); double biquadFreq = freq; - if(isCornerFreq && (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)) + if (isCornerFreq && (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)) { // frequency adjustment for DCX2496 double centerFreqFactor = pow(10.0, abs(dbGain) / 80.0 / bandwidthOrQOrS); - if(type == BiQuad::LOW_SHELF) + if (type == BiQuad::LOW_SHELF) biquadFreq *= centerFreqFactor; else biquadFreq /= centerFreqFactor; } - for(unsigned i=0; i BiQuadFilter::initialize(float sampleRate, unsigned maxFrameCoun #pragma AVRT_CODE_BEGIN void BiQuadFilter::process(float** output, float** input, unsigned frameCount) { - for(unsigned i=0; i BiQuadFilterFactory::createFilter(const wstring& configPath, ws { BiQuadFilter* filter = NULL; - if(command.find(L"Filter") == 0) + if (command.find(L"Filter") == 0) { - //Conversion to period as decimal mark, if needed + // Conversion to period as decimal mark, if needed parameters = StringHelper::replaceCharacters(parameters, L",", L"."); wsmatch match; wstring typeString; bool found = regex_search(parameters, match, regexType); - if(found) + if (found) { typeString = match.str(1); - if(filterNameToTypeMap.find(typeString) != filterNameToTypeMap.end()) + if (filterNameToTypeMap.find(typeString) != filterNameToTypeMap.end()) { BiQuad::Type type = filterNameToTypeMap[typeString]; wstring typeDescription = filterTypeToDescriptionMap[type]; @@ -98,7 +98,7 @@ vector BiQuadFilterFactory::createFilter(const wstring& configPath, ws bool error = false; found = regex_search(parameters, match, regexFreq); - if(found) + if (found) { wstring freqString = match.str(1); freq = getFreq(freqString); @@ -111,30 +111,30 @@ vector BiQuadFilterFactory::createFilter(const wstring& configPath, ws } found = regex_search(parameters, match, regexGain); - if(found) + if (found) { - if(type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::NOTCH || type == BiQuad::ALL_PASS) + if (type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::NOTCH || type == BiQuad::ALL_PASS) TraceF(L"Ignoring gain for filter of type %s", typeDescription.c_str()); else { wstring gainString = match.str(1); gain = wcstod(gainString.c_str(), NULL); - if(type == BiQuad::PEAKING) + if (type == BiQuad::PEAKING) stream << ", gain " << gain << " dB"; else stream << " and gain " << gain << " dB"; } } - else if(type == BiQuad::PEAKING || type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) + else if (type == BiQuad::PEAKING || type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) { LogF(L"No gain given in filter string %s%s", typeString.c_str(), parameters.c_str()); error = true; } found = regex_search(parameters, match, regexQ); - if(found) + if (found) { - if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) + if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) TraceF(L"Ignoring Q for filter of type %s", typeDescription.c_str()); else { @@ -145,9 +145,9 @@ vector BiQuadFilterFactory::createFilter(const wstring& configPath, ws } found = regex_search(parameters, match, regexBW); - if(found) + if (found) { - if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) + if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) TraceF(L"Ignoring bandwidth for filter of type %s", typeDescription.c_str()); else { @@ -159,9 +159,9 @@ vector BiQuadFilterFactory::createFilter(const wstring& configPath, ws } found = regex_search(parameters, match, regexSlope); - if(found) + if (found) { - if(!(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)) + if (!(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)) TraceF(L"Ignoring slope for filter of type %s", typeDescription.c_str()); else { @@ -171,35 +171,35 @@ vector BiQuadFilterFactory::createFilter(const wstring& configPath, ws } } - if(bandwidthOrQOrS == 0) + if (bandwidthOrQOrS == 0) { - if(type == BiQuad::PEAKING || type == BiQuad::ALL_PASS) + if (type == BiQuad::PEAKING || type == BiQuad::ALL_PASS) { LogF(L"No Q or bandwidth given in filter string %s%s", typeString.c_str(), parameters.c_str()); error = true; } - else if(type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS) + else if (type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS) { bandwidthOrQOrS = M_SQRT1_2; } - else if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) + else if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) { bandwidthOrQOrS = 0.9; // found out by experimentation with RoomEQWizard } - else if(type == BiQuad::NOTCH) + else if (type == BiQuad::NOTCH) { bandwidthOrQOrS = 30.0; // found out by experimentation with RoomEQWizard } } - else if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) + else if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) { // Maximum S is 1 for 12 dB bandwidthOrQOrS /= 12.0; - if(typeString[typeString.length()-1] != L'C') + if (typeString[typeString.length() - 1] != L'C') isCornerFreq = true; } - if(!error) + if (!error) { TraceF(L"%s", stream.str().c_str()); @@ -207,14 +207,14 @@ vector BiQuadFilterFactory::createFilter(const wstring& configPath, ws filter = new(mem) BiQuadFilter(type, gain, freq, bandwidthOrQOrS, isBandwidth, isCornerFreq); } } - else if(typeString != L"None") + else if (typeString != L"None") { LogF(L"Invalid filter type %s", typeString.c_str()); } } } - if(filter == NULL) + if (filter == NULL) return vector(0); return vector(1, filter); } @@ -225,13 +225,13 @@ double BiQuadFilterFactory::getFreq(const wstring& freqString) // remove thousand's separator for locales utilizing non-breaking space wstring s = StringHelper::replaceCharacters(freqString, L"\u00A0", L""); int matched = swscanf_s(s.c_str(), L"%lf", &result); - if(matched == 1) + if (matched == 1) { - if(s.length() >= 5 && s.find_first_of(L"eE") == wstring::npos) + if (s.length() >= 5 && s.find_first_of(L"eE") == wstring::npos) { - if(s[s.length() - 4] == L'.') + if (s[s.length() - 4] == L'.') { - //Interpret as thousands separator because of Room EQ Wizard + // Interpret as thousands separator because of Room EQ Wizard result *= 1000.0; } } diff --git a/filters/BiQuadFilterFactory.h b/filters/BiQuadFilterFactory.h index 9015a91..1d63214 100644 --- a/filters/BiQuadFilterFactory.h +++ b/filters/BiQuadFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/ChannelFilter.cpp b/filters/ChannelFilter.cpp index cf71477..59a53c3 100644 --- a/filters/ChannelFilter.cpp +++ b/filters/ChannelFilter.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -29,7 +29,7 @@ using namespace std; ChannelFilter::ChannelFilter(const vector& words) - :words(words) + : words(words) { } @@ -42,38 +42,38 @@ vector ChannelFilter::initialize(float sampleRate, unsigned maxFrameCou size_t channelCount = channelNames.size(); vector selectedChannels = vector(channelCount, false); - for(vector::iterator it = words.begin(); it != words.end(); it++) + for (vector::iterator it = words.begin(); it != words.end(); it++) { wstring currentWord = *it; int channelNr = -1; - if(currentWord == L"ALL") + if (currentWord == L"ALL") selectedChannels = vector(channelCount, true); else channelNr = ChannelHelper::getChannelIndex(currentWord, channelNames); - if(channelNr != -1 && channelNr < (int)channelCount) + if (channelNr != -1 && channelNr < (int)channelCount) { selectedChannels[channelNr] = true; } } vector selectedChannelNames; - for(unsigned i=0; i 0) + if (channelNumbers.tellp() > 0) channelNumbers << L", "; - channelNumbers << c+1; + channelNumbers << c + 1; } } diff --git a/filters/ChannelFilter.h b/filters/ChannelFilter.h index 2693ef4..704b02e 100644 --- a/filters/ChannelFilter.h +++ b/filters/ChannelFilter.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/ChannelFilterFactory.cpp b/filters/ChannelFilterFactory.cpp index 81238f1..c7855bf 100644 --- a/filters/ChannelFilterFactory.cpp +++ b/filters/ChannelFilterFactory.cpp @@ -30,19 +30,19 @@ vector ChannelFilterFactory::createFilter(const wstring& configPath, w { ChannelFilter* filter = NULL; - if(command == L"Channel") + if (command == L"Channel") { wstring value = parameters + L" "; vector words; wstring currentWord; - for(unsigned i=0; i 0) + if (currentWord.length() > 0) { words.push_back(currentWord); @@ -59,7 +59,7 @@ vector ChannelFilterFactory::createFilter(const wstring& configPath, w filter = new(mem) ChannelFilter(words); } - if(filter == NULL) + if (filter == NULL) return vector(0); return vector(1, filter); } \ No newline at end of file diff --git a/filters/ChannelFilterFactory.h b/filters/ChannelFilterFactory.h index d1ea348..3bb8cd2 100644 --- a/filters/ChannelFilterFactory.h +++ b/filters/ChannelFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/ConvolutionFilter.cpp b/filters/ConvolutionFilter.cpp index d75c8e0..b781fb2 100644 --- a/filters/ConvolutionFilter.cpp +++ b/filters/ConvolutionFilter.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "stdafx.h" @@ -51,11 +51,11 @@ vector ConvolutionFilter::initialize(float sampleRate, unsigned maxFram SF_INFO info; SNDFILE* inFile = sf_wchar_open(filename.c_str(), SFM_READ, &info); - if(inFile == NULL) + if (inFile == NULL) { LogF(L"Error while reading impulse response file: %S", sf_strerror(inFile)); } - else if(abs(sampleRate - info.samplerate) > 1.0f) + else if (abs(sampleRate - info.samplerate) > 1.0f) { LogF(L"Impulse response sample rate (%d Hz) does not match device sample rate (%f Hz)", info.samplerate, sampleRate); } @@ -68,34 +68,34 @@ vector ConvolutionFilter::initialize(float sampleRate, unsigned maxFram float* interleavedBuf = new float[frameCount * fileChannelCount]; sf_count_t numRead = 0; - while(numRead < frameCount) + while (numRead < frameCount) numRead += sf_readf_float(inFile, interleavedBuf + numRead * fileChannelCount, frameCount - numRead); sf_close(inFile); inFile = NULL; float** bufs = new float*[fileChannelCount]; - for(unsigned i=0; i ConvolutionFilter::initialize(float sampleRate, unsigned maxFram #pragma AVRT_CODE_BEGIN void ConvolutionFilter::process(float** output, float** input, unsigned frameCount) { - if(filters == NULL) + if (filters == NULL) return; - for(unsigned i=0; i ConvolutionFilterFactory::createFilter(const wstring& configPat { ConvolutionFilter* filter = NULL; - if(command == L"Convolution") + if (command == L"Convolution") { wstring value = parameters; - while(value.length() > 0 && iswspace(value[0])) + while (value.length() > 0 && iswspace(value[0])) value = value.substr(1); wstring absolutePath; - if(PathIsRelativeW(value.c_str())) + if (PathIsRelativeW(value.c_str())) { wchar_t filePath[MAX_PATH]; - configPath._Copy_s(filePath, sizeof(filePath)/sizeof(wchar_t), MAX_PATH); - if(configPath.size() < MAX_PATH) + configPath._Copy_s(filePath, sizeof(filePath) / sizeof(wchar_t), MAX_PATH); + if (configPath.size() < MAX_PATH) filePath[configPath.size()] = L'\0'; else filePath[MAX_PATH - 1] = L'\0'; @@ -58,7 +58,7 @@ vector ConvolutionFilterFactory::createFilter(const wstring& configPat filter = new(mem) ConvolutionFilter(absolutePath); } - if(filter == NULL) + if (filter == NULL) return vector(0); return vector(1, filter); } diff --git a/filters/ConvolutionFilterFactory.h b/filters/ConvolutionFilterFactory.h index 727821b..21d3a85 100644 --- a/filters/ConvolutionFilterFactory.h +++ b/filters/ConvolutionFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/filters/CopyFilter.cpp b/filters/CopyFilter.cpp index fb702b3..ed91794 100644 --- a/filters/CopyFilter.cpp +++ b/filters/CopyFilter.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -50,34 +50,34 @@ vector CopyFilter::initialize(float sampleRate, unsigned maxFrameCount, vector outChannelNames; - for(unsigned i=0; i::const_iterator it = find(outChannelNames.begin(), outChannelNames.end(), channelName); - ia.targetChannel = (int)(it-outChannelNames.begin()); - if(it == outChannelNames.end()) + ia.targetChannel = (int)(it - outChannelNames.begin()); + if (it == outChannelNames.end()) outChannelNames.push_back(channelName); ia.sourceCount = (unsigned)a.sourceSum.size(); ia.sourceSum = (InternalAssignment::InternalSummand*)MemoryHelper::alloc(ia.sourceCount * sizeof(InternalAssignment::InternalSummand)); - for(unsigned j=0; j CopyFilter::initialize(float sampleRate, unsigned maxFrameCount, wstringstream stream; stream << "Copying "; - for(unsigned i=0; i 0) + if (i > 0) stream << ", "; stream << L"to channel " << outChannelNames[ia.targetChannel].c_str() << " "; - for(unsigned j=0; j 0) + if (j > 0) stream << ", "; - if(is.channel != -1) + if (is.channel != -1) stream << L"from channel " << channelNames[is.channel].c_str() << L" with factor " << is.factor; else stream << L"value " << is.factor; @@ -111,38 +111,38 @@ vector CopyFilter::initialize(float sampleRate, unsigned maxFrameCount, #pragma AVRT_CODE_BEGIN void CopyFilter::process(float** output, float** input, unsigned frameCount) { - for(unsigned i=0; i CopyFilterFactory::createFilter(const wstring& configPath, wstr { CopyFilter* filter = NULL; - if(command == L"Copy") + if (command == L"Copy") { vector assignments; vector assignmentStrings = StringHelper::split(parameters, L' '); - for(vector::iterator it=assignmentStrings.begin(); it!=assignmentStrings.end(); it++) + for (vector::iterator it = assignmentStrings.begin(); it != assignmentStrings.end(); it++) { Assignment assignment; vector parts = StringHelper::split(*it, L'='); - if(parts.size() == 2) + if (parts.size() == 2) { wstring target = parts[0]; wstring source = parts[1]; @@ -48,26 +48,26 @@ vector CopyFilterFactory::createFilter(const wstring& configPath, wstr assignment.targetChannel = target; vector summands = StringHelper::split(source, '+'); - for(vector::iterator it2=summands.begin(); it2!=summands.end(); it2++) + for (vector::iterator it2 = summands.begin(); it2 != summands.end(); it2++) { vector factors = StringHelper::split(*it2, '*'); wstring factor; wstring channel; - if(factors.size() == 2) + if (factors.size() == 2) { factor = factors[0]; channel = factors[1]; } - else if(factors.size() == 1) + else if (factors.size() == 1) { - if(factors[0] == L"0" || factors[0].find(L'.') != wstring::npos) + if (factors[0] == L"0" || factors[0].find(L'.') != wstring::npos) factor = factors[0]; else channel = factors[0]; } Assignment::Summand summand; - if(factor == L"") + if (factor == L"") { summand.factor = 1.0; summand.isDecibel = false; @@ -75,7 +75,7 @@ vector CopyFilterFactory::createFilter(const wstring& configPath, wstr else { summand.factor = wcstod(factor.c_str(), NULL); - summand.isDecibel = factor.size() > 2 && StringHelper::toLowerCase(factor.substr(factor.size()-2)) == L"db"; + summand.isDecibel = factor.size() > 2 && StringHelper::toLowerCase(factor.substr(factor.size() - 2)) == L"db"; } summand.channel = channel; @@ -83,7 +83,7 @@ vector CopyFilterFactory::createFilter(const wstring& configPath, wstr } } - if(assignment.targetChannel != L"" && !assignment.sourceSum.empty()) + if (assignment.targetChannel != L"" && !assignment.sourceSum.empty()) assignments.push_back(assignment); } @@ -91,7 +91,7 @@ vector CopyFilterFactory::createFilter(const wstring& configPath, wstr filter = new(mem) CopyFilter(assignments); } - if(filter == NULL) + if (filter == NULL) return vector(0); return vector(1, filter); } \ No newline at end of file diff --git a/filters/CopyFilterFactory.h b/filters/CopyFilterFactory.h index 3ca1a5e..5537939 100644 --- a/filters/CopyFilterFactory.h +++ b/filters/CopyFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/DelayFilter.cpp b/filters/DelayFilter.cpp index b10249e..b356ab9 100644 --- a/filters/DelayFilter.cpp +++ b/filters/DelayFilter.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -26,7 +26,7 @@ using namespace std; DelayFilter::DelayFilter(double delay, bool isMs) - :delay(delay), isMs(isMs) + : delay(delay), isMs(isMs) { buffers = NULL; } @@ -42,14 +42,14 @@ vector DelayFilter::initialize(float sampleRate, unsigned maxFrameCount channelCount = (unsigned)channelNames.size(); - if(isMs) + if (isMs) bufferLength = (unsigned)(sampleRate * delay / 1000.0 + 0.5); else bufferLength = (unsigned)(delay + 0.5); buffers = (float**)MemoryHelper::alloc(sizeof(float*) * channelCount); - for(unsigned i=0; i DelayFilter::initialize(float sampleRate, unsigned maxFrameCount #pragma AVRT_CODE_BEGIN void DelayFilter::process(float** output, float** input, unsigned frameCount) { - for(unsigned i=0; i DelayFilterFactory::createFilter(const wstring& configPath, wst { DelayFilter* filter = NULL; - if(command == L"Delay") + if (command == L"Delay") { - //Conversion to period as decimal mark, if needed + // Conversion to period as decimal mark, if needed wstring value = StringHelper::replaceCharacters(parameters, L",", L"."); double delay = -1; @@ -42,15 +42,15 @@ vector DelayFilterFactory::createFilter(const wstring& configPath, wst wstringstream stream(value); stream >> delay >> unit; - if(delay >= 0) + if (delay >= 0) { - if(StringHelper::toLowerCase(unit) == L"ms") + if (StringHelper::toLowerCase(unit) == L"ms") { TraceF(L"Delaying by %g ms", delay); void* mem = MemoryHelper::alloc(sizeof(DelayFilter)); filter = new(mem) DelayFilter(delay, true); } - else if(StringHelper::toLowerCase(unit) == L"samples") + else if (StringHelper::toLowerCase(unit) == L"samples") { TraceF(L"Delaying by %g samples", delay); void* mem = MemoryHelper::alloc(sizeof(DelayFilter)); @@ -59,7 +59,7 @@ vector DelayFilterFactory::createFilter(const wstring& configPath, wst } } - if(filter == NULL) + if (filter == NULL) return vector(0); return vector(1, filter); } diff --git a/filters/DelayFilterFactory.h b/filters/DelayFilterFactory.h index 1444ea3..a40a80c 100644 --- a/filters/DelayFilterFactory.h +++ b/filters/DelayFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/DeviceFilterFactory.cpp b/filters/DeviceFilterFactory.cpp index e0f3174..d4f3d60 100644 --- a/filters/DeviceFilterFactory.cpp +++ b/filters/DeviceFilterFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -48,7 +48,7 @@ vector DeviceFilterFactory::startOfConfiguration() vector DeviceFilterFactory::createFilter(const wstring& configPath, wstring& command, wstring& parameters) { - if(command == L"Device") + if (command == L"Device") { bool matches = matchDevice(deviceString, parameters); @@ -56,7 +56,7 @@ vector DeviceFilterFactory::createFilter(const wstring& configPath, ws deviceMatches = matches; } - if(!deviceMatches) + if (!deviceMatches) // skip line for further factories command = L""; @@ -75,21 +75,21 @@ bool DeviceFilterFactory::matchDevice(const std::wstring& deviceString, const st { wstring value = StringHelper::trim(pattern) + L";"; - vector> fullList; + vector > fullList; vector currentList; wstring currentWord; - for(unsigned i=0; i 0) + if (currentWord.length() > 0) { currentList.push_back(currentWord); currentWord.clear(); } - if(c == L';' && currentList.size() > 0) + if (c == L';' && currentList.size() > 0) { fullList.push_back(currentList); currentList.clear(); @@ -103,24 +103,24 @@ bool DeviceFilterFactory::matchDevice(const std::wstring& deviceString, const st bool matches = false; - for(unsigned i=0; i ExpressionFilterFactory::createFilter(const wstring& configPath, wstring& command, wstring& parameters) { - if(command.length() > 0 && command[0] == L'#') + if (command.length() > 0 && command[0] == L'#') return vector(); bool inExpression = false; @@ -57,14 +57,14 @@ vector ExpressionFilterFactory::createFilter(const wstring& configPath wstring output; wstring expression; - for(unsigned i=0; i ExpressionFilterFactory::createFilter(const wstring& configPath } else { - if(lastWasBackslash) + if (lastWasBackslash) { expression += c; } @@ -87,14 +87,14 @@ vector ExpressionFilterFactory::createFilter(const wstring& configPath parser->SetExpr(expression); Value result = parser->Eval(); wstring resultString; - if(result.GetType() == L's') + if (result.GetType() == L's') resultString = result.GetString(); else resultString = result.ToString().c_str(); output += resultString; TraceF(L"Inline expression %s evaluated to %s", expression.c_str(), resultString.c_str()); } - catch(ParserError e) + catch (ParserError e) { LogF(L"Error while evaluating inline expression %s: %s", expression.c_str(), e.GetMsg().c_str()); } @@ -103,11 +103,11 @@ vector ExpressionFilterFactory::createFilter(const wstring& configPath } lastWasBackslash = false; } - else if(c == L'\\') + else if (c == L'\\') { - if(i >= parameters.size()-1 || parameters[i+1] != L'`') + if (i >= parameters.size() - 1 || parameters[i + 1] != L'`') { - if(inExpression) + if (inExpression) expression += c; else output += c; @@ -116,7 +116,7 @@ vector ExpressionFilterFactory::createFilter(const wstring& configPath } else { - if(inExpression) + if (inExpression) expression += c; else output += c; @@ -126,7 +126,7 @@ vector ExpressionFilterFactory::createFilter(const wstring& configPath parameters = output; - if(command == L"Eval") + if (command == L"Eval") { try { @@ -134,13 +134,13 @@ vector ExpressionFilterFactory::createFilter(const wstring& configPath parser->SetExpr(expression); Value result = parser->Eval(); wstring resultString; - if(result.GetType() == L's') + if (result.GetType() == L's') resultString = result.GetString(); else resultString = result.ToString().c_str(); TraceF(L"Expression %s evaluated to %s", expression.c_str(), resultString.c_str()); } - catch(ParserError e) + catch (ParserError e) { LogF(L"Error while evaluating expression %s: %s", expression.c_str(), e.GetMsg().c_str()); } diff --git a/filters/ExpressionFilterFactory.h b/filters/ExpressionFilterFactory.h index db76fae..4092ba6 100644 --- a/filters/ExpressionFilterFactory.h +++ b/filters/ExpressionFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/GraphicEQFilter.cpp b/filters/GraphicEQFilter.cpp index 7e90845..c0ca925 100644 --- a/filters/GraphicEQFilter.cpp +++ b/filters/GraphicEQFilter.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "stdafx.h" @@ -32,7 +32,7 @@ using namespace std; GraphicEQFilter::GraphicEQFilter(const std::vector& nodes, unsigned filterLength) - :nodes(nodes), filterLength(filterLength) + : nodes(nodes), filterLength(filterLength) { filters = NULL; } @@ -54,37 +54,37 @@ vector GraphicEQFilter::initialize(float sampleRate, unsigned maxFrameC fftwf_plan planReverse = fftwf_plan_dft_1d(filterLength * 2, freqData, timeData, FFTW_BACKWARD, FFTW_ESTIMATE); GainIterator gainIterator(nodes); - for(unsigned i=0; i GraphicEQFilter::initialize(float sampleRate, unsigned maxFrameC fftwf_destroy_plan(planReverse); filters = (HConvSingle*)MemoryHelper::alloc(sizeof(HConvSingle) * channelCount); - for(unsigned i=0; i GraphicEQFilter::initialize(float sampleRate, unsigned maxFrameC #pragma AVRT_CODE_BEGIN void GraphicEQFilter::process(float** output, float** input, unsigned frameCount) { - if(filters == NULL) + if (filters == NULL) return; - for(unsigned i=0; i& GraphicEQFilter::getNodes() void GraphicEQFilter::cleanup() { - if(filters != NULL) + if (filters != NULL) { - for(unsigned i=0; i GraphicEQFilterFactory::createFilter(const wstring& configPath, { GraphicEQFilter* filter = NULL; - if(command == L"GraphicEQ") + if (command == L"GraphicEQ") { wstring value = parameters; - if(value.find(L'.') == wstring::npos) + if (value.find(L'.') == wstring::npos) value = StringHelper::replaceCharacters(value, L",", L"."); wsregex_iterator begin(value.begin(), value.end(), regexNumber); wsregex_iterator end; vector nodes; - for(wsregex_iterator it = begin; it != end; it++) + for (wsregex_iterator it = begin; it != end; it++) { wsmatch freqMatch = *it++; - if(it != end) + if (it != end) { wsmatch gainMatch = *it; double freq = wcstod(freqMatch.str(0).c_str(), NULL); @@ -64,7 +64,7 @@ vector GraphicEQFilterFactory::createFilter(const wstring& configPath, filter = new(mem) GraphicEQFilter(nodes, 16384); } - if(filter == NULL) + if (filter == NULL) return vector(0); return vector(1, filter); } diff --git a/filters/GraphicEQFilterFactory.h b/filters/GraphicEQFilterFactory.h index f771d6d..9ad583a 100644 --- a/filters/GraphicEQFilterFactory.h +++ b/filters/GraphicEQFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/filters/IIRFilter.cpp b/filters/IIRFilter.cpp index d35a6eb..01c0348 100644 --- a/filters/IIRFilter.cpp +++ b/filters/IIRFilter.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -33,12 +33,12 @@ IIRFilter::IIRFilter(const vector& coefficients) x = NULL; y = NULL; - double a0 = coefficients[order+1]; + double a0 = coefficients[order + 1]; b0 = coefficients[0] / a0; - for(unsigned i=0; i IIRFilter::initialize(float sampleRate, unsigned maxFrameCount, { channelCount = (unsigned)channelNames.size(); - if(x != NULL) + if (x != NULL) MemoryHelper::free(x); - if(y != NULL) + if (y != NULL) MemoryHelper::free(y); x = (double*)MemoryHelper::alloc(order * channelCount * sizeof(double)); @@ -73,31 +73,31 @@ vector IIRFilter::initialize(float sampleRate, unsigned maxFrameCount, #pragma AVRT_CODE_BEGIN void IIRFilter::process(float** output, float** input, unsigned frameCount) { - for(unsigned i=0; i0; k--) + for (unsigned k = order - 1; k > 0; k--) { sum += b[k] * xo[k]; - xo[k] = xo[k-1]; + xo[k] = xo[k - 1]; } sum += b[0] * xo[0]; - for(unsigned k=order-1; k>0; k--) + for (unsigned k = order - 1; k > 0; k--) { sum += a[k] * yo[k]; - yo[k] = yo[k-1]; + yo[k] = yo[k - 1]; } sum += a[0] * yo[0]; @@ -109,11 +109,11 @@ void IIRFilter::process(float** output, float** input, unsigned frameCount) } } - for(unsigned i=0; i IIRFilterFactory::createFilter(const wstring& configPath, wstri { IIRFilter* filter = NULL; - if(command.find(L"Filter") == 0) + if (command.find(L"Filter") == 0) { wsmatch match; wstring typeString; bool found = regex_search(parameters, match, regexType); - if(found) + if (found) { typeString = match.str(1); - if(typeString == L"IIR") + if (typeString == L"IIR") { bool found = regex_search(parameters, match, regexOrder); - if(found) + if (found) { wstring orderString = match.str(1); unsigned order = wcstol(orderString.c_str(), NULL, 10); - if(order<1) + if (order < 1) { LogF(L"Order %d not supported, must at least be 1", order); } @@ -68,27 +68,27 @@ vector IIRFilterFactory::createFilter(const wstring& configPath, wstri { found = regex_search(parameters, match, regexCoefficients); - if(found) + if (found) { wstring coefficientsString = match.str(1); vector coefficientStrings = StringHelper::split(coefficientsString, L' '); - if(coefficientStrings.size() != (order + 1) * 2) + if (coefficientStrings.size() != (order + 1) * 2) { LogF(L"Invalid number of coefficients. Expected %d coefficients instead of %d", (order + 1) * 2, coefficientStrings.size()); } else { vector coefficients; - for(auto it = coefficientStrings.begin(); it!=coefficientStrings.end(); it++) + for (auto it = coefficientStrings.begin(); it != coefficientStrings.end(); it++) { coefficients.push_back(wcstod(it->c_str(), NULL)); } wstringstream stream; stream << L"Adding IIR filter of order " << order << " with coefficients"; - for(unsigned i=0; i<=order; i++) + for (unsigned i = 0; i <= order; i++) stream << L" b" << i << L"=" << coefficients[i]; - for(unsigned i=0; i<=order; i++) + for (unsigned i = 0; i <= order; i++) stream << L" a" << i << L"=" << coefficients[i + order + 1]; TraceF(L"%s", stream.str().c_str()); @@ -103,7 +103,7 @@ vector IIRFilterFactory::createFilter(const wstring& configPath, wstri } } - if(filter == NULL) + if (filter == NULL) return vector(0); return vector(1, filter); } diff --git a/filters/IIRFilterFactory.h b/filters/IIRFilterFactory.h index e59302c..1109b24 100644 --- a/filters/IIRFilterFactory.h +++ b/filters/IIRFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/IfFilterFactory.cpp b/filters/IfFilterFactory.cpp index 96eb189..b51a0a6 100644 --- a/filters/IfFilterFactory.cpp +++ b/filters/IfFilterFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -37,7 +37,7 @@ vector IfFilterFactory::startOfConfiguration() { trueCount = 0; falseCount = 0; - while(!trueCountStack.empty()) + while (!trueCountStack.empty()) trueCountStack.pop(); return vector(); @@ -48,7 +48,7 @@ std::vector IfFilterFactory::startOfFile(const std::wstring& configPat trueCountStack.push(trueCount); trueCount = 0; executeElse = false; - if(falseCount != 0) + if (falseCount != 0) { LogF(L"File was included inside If that evaluated to false!"); falseCount = 0; @@ -61,21 +61,21 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin { wstring expression = StringHelper::trim(parameters); - if(command == L"If") + if (command == L"If") { - if(falseCount == 0) + if (falseCount == 0) { try { parser->SetExpr(expression); Value result = parser->Eval(); bool isTrue = toBoolean(result); - if(result.GetType() == L'b') + if (result.GetType() == L'b') TraceF(L"If(%s) evaluated to %s", expression.c_str(), result.ToString().c_str()); else TraceF(L"If(%s) evaluated to %s (%s)", expression.c_str(), result.ToString().c_str(), isTrue ? L"true" : L"false"); - if(isTrue) + if (isTrue) { trueCount++; } @@ -85,7 +85,7 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin executeElse = true; } } - catch(ParserError e) + catch (ParserError e) { LogF(L"Error while evaluating If(%s): %s", expression.c_str(), e.GetMsg().c_str()); falseCount++; @@ -96,11 +96,11 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin falseCount++; } } - else if(command == L"ElseIf") + else if (command == L"ElseIf") { - if(falseCount == 0) + if (falseCount == 0) { - if(trueCount == 0) + if (trueCount == 0) { LogF(L"ElseIf without If!"); } @@ -110,36 +110,36 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin trueCount--; } } - else if(falseCount == 1 && executeElse) + else if (falseCount == 1 && executeElse) { try { parser->SetExpr(expression); Value result = parser->Eval(); bool isTrue = toBoolean(result); - if(result.GetType() == L'b') + if (result.GetType() == L'b') TraceF(L"ElseIf(%s) evaluated to %s", expression.c_str(), result.ToString().c_str()); else TraceF(L"ElseIf(%s) evaluated to %s (%s)", expression.c_str(), result.ToString().c_str(), isTrue ? L"true" : L"false"); - if(isTrue) + if (isTrue) { falseCount--; trueCount++; executeElse = false; } } - catch(ParserError e) + catch (ParserError e) { LogF(L"Error while evaluating ElseIf(%s): %s", expression.c_str(), e.GetMsg().c_str()); } } } - else if(command == L"Else") + else if (command == L"Else") { - if(falseCount == 0) + if (falseCount == 0) { - if(trueCount == 0) + if (trueCount == 0) { LogF(L"Else without If!"); } @@ -149,18 +149,18 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin trueCount--; } } - else if(falseCount == 1 && executeElse) + else if (falseCount == 1 && executeElse) { falseCount--; trueCount++; executeElse = false; } } - else if(command == L"EndIf") + else if (command == L"EndIf") { - if(falseCount == 0) + if (falseCount == 0) { - if(trueCount == 0) + if (trueCount == 0) LogF(L"EndIf without If!"); else trueCount--; @@ -170,11 +170,11 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin falseCount--; } - if(falseCount == 0) + if (falseCount == 0) executeElse = false; } - if(falseCount > 0) + if (falseCount > 0) // skip line for further factories command = L""; @@ -183,7 +183,7 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin std::vector IfFilterFactory::endOfFile(const std::wstring& configPath) { - if(trueCount != 0 || falseCount != 0) + if (trueCount != 0 || falseCount != 0) { LogF(L"If was not closed by EndIf!"); falseCount = 0; @@ -199,7 +199,7 @@ bool IfFilterFactory::toBoolean(const Value& value) bool result = false; wchar_t type = value.GetType(); - switch(type) + switch (type) { case 'i': { diff --git a/filters/IfFilterFactory.h b/filters/IfFilterFactory.h index 59bf353..b355a6f 100644 --- a/filters/IfFilterFactory.h +++ b/filters/IfFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/IncludeFilterFactory.cpp b/filters/IncludeFilterFactory.cpp index 9a3c3aa..4bfb8d3 100644 --- a/filters/IncludeFilterFactory.cpp +++ b/filters/IncludeFilterFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -34,18 +34,18 @@ void IncludeFilterFactory::initialize(FilterEngine* engine) vector IncludeFilterFactory::createFilter(const wstring& configPath, wstring& command, wstring& parameters) { - if(command == L"Include") + if (command == L"Include") { wstring value = parameters; - while(value.length() > 0 && iswspace(value[0])) + while (value.length() > 0 && iswspace(value[0])) value = value.substr(1); wstring includePath; - if(PathIsRelativeW(value.c_str())) + if (PathIsRelativeW(value.c_str())) { wchar_t filePath[MAX_PATH]; - configPath._Copy_s(filePath, sizeof(filePath)/sizeof(wchar_t), MAX_PATH); - if(configPath.size() < MAX_PATH) + configPath._Copy_s(filePath, sizeof(filePath) / sizeof(wchar_t), MAX_PATH); + if (configPath.size() < MAX_PATH) filePath[configPath.size()] = L'\0'; else filePath[MAX_PATH - 1] = L'\0'; diff --git a/filters/IncludeFilterFactory.h b/filters/IncludeFilterFactory.h index f773cd8..4900770 100644 --- a/filters/IncludeFilterFactory.h +++ b/filters/IncludeFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/PreampFilter.cpp b/filters/PreampFilter.cpp index 34e8499..afead32 100644 --- a/filters/PreampFilter.cpp +++ b/filters/PreampFilter.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -26,7 +26,7 @@ using namespace std; PreampFilter::PreampFilter(double dbGain) - :dbGain(dbGain) + : dbGain(dbGain) { gain = (float)pow(10.0, dbGain / 20.0); } @@ -41,11 +41,11 @@ vector PreampFilter::initialize(float sampleRate, unsigned maxFrameCoun #pragma AVRT_CODE_BEGIN void PreampFilter::process(float** output, float** input, unsigned frameCount) { - for(size_t i=0; i PreampFilterFactory::createFilter(const wstring& configPath, ws { PreampFilter* filter = NULL; - if(command == L"Preamp") + if (command == L"Preamp") { - //Conversion to period as decimal mark, if needed + // Conversion to period as decimal mark, if needed wstring value = StringHelper::replaceCharacters(parameters, L",", L"."); double preamp_dB; int matched = swscanf_s(value.c_str(), L" %lf dB", &preamp_dB); - if(matched == 1) + if (matched == 1) { TraceF(L"Adjusting preamp by %g dB", preamp_dB); @@ -46,7 +46,7 @@ vector PreampFilterFactory::createFilter(const wstring& configPath, ws } } - if(filter == NULL) + if (filter == NULL) return vector(0); return vector(1, filter); } diff --git a/filters/PreampFilterFactory.h b/filters/PreampFilterFactory.h index 7d86331..26dc030 100644 --- a/filters/PreampFilterFactory.h +++ b/filters/PreampFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/filters/StageFilterFactory.cpp b/filters/StageFilterFactory.cpp index 2a35e7d..f80f0a5 100644 --- a/filters/StageFilterFactory.cpp +++ b/filters/StageFilterFactory.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -37,7 +37,7 @@ void StageFilterFactory::initialize(FilterEngine* engine) vector StageFilterFactory::startOfConfiguration() { stageMatches = capture || !preMix || !postMixInstalled; - while(!stageMatchesStack.empty()) + while (!stageMatchesStack.empty()) stageMatchesStack.pop(); return vector(); @@ -52,35 +52,35 @@ std::vector StageFilterFactory::startOfFile(const std::wstring& config vector StageFilterFactory::createFilter(const wstring& configPath, wstring& command, wstring& parameters) { - if(command == L"Stage") + if (command == L"Stage") { stageMatches = false; wstring stageString = StringHelper::toLowerCase(StringHelper::trim(parameters)); vector parts = StringHelper::split(stageString, L' '); wstring matchingPart; - for(auto it=parts.begin(); it!=parts.end(); it++) + for (auto it = parts.begin(); it != parts.end(); it++) { const wstring& part = *it; - if(part == L"pre-mix") + if (part == L"pre-mix") { - if(!capture && preMix) + if (!capture && preMix) { stageMatches = true; matchingPart = part; } } - else if(part == L"post-mix") + else if (part == L"post-mix") { - if(!capture && !preMix) + if (!capture && !preMix) { stageMatches = true; matchingPart = part; } } - else if(part == L"capture") + else if (part == L"capture") { - if(capture) + if (capture) { stageMatches = true; matchingPart = part; @@ -92,13 +92,13 @@ vector StageFilterFactory::createFilter(const wstring& configPath, wst } } - if(stageMatches) + if (stageMatches) TraceF(L"Matching stage \"%s\"", matchingPart.c_str()); else TraceF(L"Not matching stage set \"%s\"", stageString.c_str()); } - if(!stageMatches) + if (!stageMatches) // skip line for further factories command = L""; diff --git a/filters/StageFilterFactory.h b/filters/StageFilterFactory.h index 3bfa632..89cac66 100644 --- a/filters/StageFilterFactory.h +++ b/filters/StageFilterFactory.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once diff --git a/helpers/ChannelHelper.cpp b/helpers/ChannelHelper.cpp index a1ef4dc..28ef767 100644 --- a/helpers/ChannelHelper.cpp +++ b/helpers/ChannelHelper.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "stdafx.h" @@ -46,7 +46,7 @@ ChannelHelper::ChannelHelper() channelNameToPosMap[L"SL"] = SPEAKER_SIDE_LEFT; channelNameToPosMap[L"SR"] = SPEAKER_SIDE_RIGHT; - for(unordered_map::iterator it=channelNameToPosMap.begin(); it!=channelNameToPosMap.end(); it++) + for (unordered_map::iterator it = channelNameToPosMap.begin(); it != channelNameToPosMap.end(); it++) channelPosToNameMap[it->second] = it->first; } @@ -54,7 +54,7 @@ int ChannelHelper::getDefaultChannelMask(int channelCount) { int channelMask; - switch(channelCount) + switch (channelCount) { case 1: channelMask = KSAUDIO_SPEAKER_MONO; @@ -81,13 +81,13 @@ int ChannelHelper::getDefaultChannelMask(int channelCount) vector ChannelHelper::getChannelNames(int channelCount, int channelMask) { vector channelNames; - int c=1; - for(int i=0; i<31; i++) + int c = 1; + for (int i = 0; i < 31; i++) { - int channelPos = 1< ChannelHelper::getChannelNames(int channelCount, int channelMask } // handle channels not covered by channelMask - for(; c<=channelCount; c++) + for (; c <= channelCount; c++) channelNames.push_back(to_wstring((unsigned long long)c)); return channelNames; @@ -106,11 +106,11 @@ int ChannelHelper::getChannelIndex(std::wstring word, const std::vector= (int)channelNames.size()) + if (channelIndex < 0 || channelIndex >= (int)channelNames.size()) { LogFStatic(L"Channel number %s out of range (1 - %d)", word.c_str(), channelNames.size()); channelIndex = -1; @@ -120,22 +120,22 @@ int ChannelHelper::getChannelIndex(std::wstring word, const std::vector::const_iterator pos = find(channelNames.begin(), channelNames.end(), word); - if(pos == channelNames.end()) + if (pos == channelNames.end()) { - //Special handling to accept "wrong", but unambiguous positions - if(word == L"SL") + // Special handling to accept "wrong", but unambiguous positions + if (word == L"SL") pos = find(channelNames.begin(), channelNames.end(), L"RL"); - else if(word == L"SR") + else if (word == L"SR") pos = find(channelNames.begin(), channelNames.end(), L"RR"); - else if(word == L"RL") + else if (word == L"RL") pos = find(channelNames.begin(), channelNames.end(), L"SL"); - else if(word == L"RR") + else if (word == L"RR") pos = find(channelNames.begin(), channelNames.end(), L"SR"); } - if(pos != channelNames.end()) + if (pos != channelNames.end()) channelIndex = (int)(pos - channelNames.begin()); - else if(!allowNew) + else if (!allowNew) LogFStatic(L"Invalid channel position %s", word.c_str()); } diff --git a/helpers/ChannelHelper.h b/helpers/ChannelHelper.h index 4307122..889c67a 100644 --- a/helpers/ChannelHelper.h +++ b/helpers/ChannelHelper.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once diff --git a/helpers/GainIterator.cpp b/helpers/GainIterator.cpp index dc9b1b3..40d5c03 100644 --- a/helpers/GainIterator.cpp +++ b/helpers/GainIterator.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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 "stdafx.h" @@ -33,37 +33,37 @@ GainIterator::GainIterator(const vector& nodes) double GainIterator::gainAt(double freq) { - if(nodeLeft == NULL && nodeRight == NULL || nodeLeft != NULL && freq < nodeLeft->freq) + if (nodeLeft == NULL && nodeRight == NULL || nodeLeft != NULL && freq < nodeLeft->freq) { FilterNode findNode(freq, 0); vector::iterator it = lower_bound(nodes.begin(), nodes.end(), findNode); - if(it != nodes.begin()) + if (it != nodes.begin()) nodeLeft = &*(it - 1); - if(it != nodes.end()) + if (it != nodes.end()) nodeRight = &*it; - if(nodeLeft != NULL && nodeRight != NULL) + if (nodeLeft != NULL && nodeRight != NULL) { logLeft = log(nodeLeft->freq); logRightMinusLeft = log(nodeRight->freq) - logLeft; } } - else if(nodeRight != NULL && freq > nodeRight->freq) + else if (nodeRight != NULL && freq > nodeRight->freq) { vector::iterator it = nodes.begin() + (nodeRight - &*nodes.begin()); - while(it != nodes.end() && freq > it->freq) + while (it != nodes.end() && freq > it->freq) { it++; } - if(it == nodes.end()) + if (it == nodes.end()) nodeRight = NULL; else nodeRight = &*it; - if(it != nodes.begin()) + if (it != nodes.begin()) nodeLeft = &*(it - 1); - if(nodeLeft != NULL && nodeRight != NULL) + if (nodeLeft != NULL && nodeRight != NULL) { logLeft = log(nodeLeft->freq); logRightMinusLeft = log(nodeRight->freq) - logLeft; @@ -71,14 +71,14 @@ double GainIterator::gainAt(double freq) } double dbGain; - if(nodeLeft == NULL) + if (nodeLeft == NULL) { - if(nodeRight == NULL) + if (nodeRight == NULL) dbGain = 0.0; else dbGain = nodeRight->dbGain; } - else if(nodeRight == NULL) + else if (nodeRight == NULL) { dbGain = nodeLeft->dbGain; } diff --git a/helpers/GainIterator.h b/helpers/GainIterator.h index 7afa98e..2cc0d45 100644 --- a/helpers/GainIterator.h +++ b/helpers/GainIterator.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2015 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2015 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 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. + 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. + 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. */ #pragma once @@ -32,7 +32,7 @@ struct FilterNode this->dbGain = dbGain; } - bool operator < (FilterNode other) + bool operator<(FilterNode other) { return freq < other.freq; } diff --git a/helpers/LogHelper.cpp b/helpers/LogHelper.cpp index c2324ea..9a8b013 100644 --- a/helpers/LogHelper.cpp +++ b/helpers/LogHelper.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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 "stdafx.h" @@ -36,36 +36,36 @@ bool LogHelper::useConsoleColors = false; void LogHelper::log(const char* file, int line, const void* caller, bool trace, const wchar_t* format, ...) { - if(!initialized) + if (!initialized) { - //Do not try to initialize again, even in case of error + // Do not try to initialize again, even in case of error initialized = true; wchar_t temp[255]; - GetTempPathW(sizeof(temp)/sizeof(wchar_t), temp); + GetTempPathW(sizeof(temp) / sizeof(wchar_t), temp); logPath = temp; logPath += L"EqualizerAPO.log"; try { - if(RegistryHelper::readValue(APP_REGPATH, L"EnableTrace") != L"false") + if (RegistryHelper::readValue(APP_REGPATH, L"EnableTrace") != L"false") enableTrace = true; } - catch(RegistryException e) + catch (RegistryException e) { LogFStatic(L"%s", e.getMessage()); } } - if(trace && !enableTrace) + if (trace && !enableTrace) return; FILE* fp; - if(presetFP == NULL) + if (presetFP == NULL) { errno_t err = _wfopen_s(&fp, logPath.c_str(), L"at"); - if(err != 0) + if (err != 0) return; } else @@ -73,16 +73,16 @@ void LogHelper::log(const char* file, int line, const void* caller, bool trace, fp = presetFP; } - if(useConsoleColors) + if (useConsoleColors) { HANDLE con = GetStdHandle(STD_OUTPUT_HANDLE); - if(trace) + if (trace) SetConsoleTextAttribute(con, 2); // Set console color to green else SetConsoleTextAttribute(con, 12); // Set console color to red } - if(!compact) + if (!compact) { SYSTEMTIME ___st; GetLocalTime(&___st); @@ -91,7 +91,7 @@ void LogHelper::log(const char* file, int line, const void* caller, bool trace, ___st.wYear, ___st.wMonth, ___st.wDay, ___st.wHour, ___st.wMinute, ___st.wSecond, ___st.wMilliseconds, threadId, (DWORD)(unsigned long long)caller, file, line); } - if(trace) + if (trace) fwprintf(fp, L"(TRACE) "); va_list varArgs; @@ -101,13 +101,13 @@ void LogHelper::log(const char* file, int line, const void* caller, bool trace, fwprintf(fp, L"\n"); - if(useConsoleColors) + if (useConsoleColors) { HANDLE con = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(con, 7); // Set console color to light grey (default) } - if(presetFP == NULL) + if (presetFP == NULL) fclose(fp); } diff --git a/helpers/LogHelper.h b/helpers/LogHelper.h index 3a22411..753c0bd 100644 --- a/helpers/LogHelper.h +++ b/helpers/LogHelper.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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. */ #pragma once diff --git a/helpers/MemoryHelper.cpp b/helpers/MemoryHelper.cpp index f4c0b2b..ee2bfb1 100644 --- a/helpers/MemoryHelper.cpp +++ b/helpers/MemoryHelper.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2013 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2013 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 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. + 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. + 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 "stdafx.h" @@ -40,8 +40,8 @@ // someone forgot to add the __stdcall/WINAPI modifier to BaseAudioProcessingObject.h, so we can't use the existing declarations extern "C" { - HRESULT __stdcall AERT_Allocate(size_t size, void **pMemory); - HRESULT __stdcall AERT_Free(void *pMemory); +HRESULT __stdcall AERT_Allocate(size_t size, void** pMemory); +HRESULT __stdcall AERT_Free(void* pMemory); } #endif @@ -52,7 +52,7 @@ void* MemoryHelper::alloc(size_t size) size += 16; #ifdef USE_WINDDK HRESULT hr = AERT_Allocate(size, &memory); - if(FAILED(hr)) + if (FAILED(hr)) { size += 16; memory = malloc(size); @@ -61,19 +61,19 @@ void* MemoryHelper::alloc(size_t size) } #else #ifdef _DEBUG - memory = _malloc_dbg(size,_NORMAL_BLOCK, __FILE__, __LINE__); + memory = _malloc_dbg(size, _NORMAL_BLOCK, __FILE__, __LINE__); #else memory = malloc(size); #endif #endif - if(memory == NULL) + if (memory == NULL) { LogFStatic(L"Allocation of %d bytes failed.", size); return NULL; } size_t offset = 16 - ((size_t)memory) % 16; - if(alternative) + if (alternative) offset += 16; void* ptr = ((char*)memory) + offset; ((char*)ptr)[-1] = (char)offset; @@ -85,27 +85,27 @@ void MemoryHelper::free(void* ptr) { bool alternative = false; char offset = ((char*)ptr)[-1]; - if(offset > 16) + if (offset > 16) alternative = true; void* memory = ((char*)ptr) - offset; #ifdef USE_WINDDK - if(alternative) + if (alternative) { ::free(memory); } else { HRESULT hr = AERT_Free(memory); - if(FAILED(hr)) + if (FAILED(hr)) { LogFStatic(L"Memory release failed. Error code %X", hr); } } #else #ifdef _DEBUG - _free_dbg(memory,_NORMAL_BLOCK); + _free_dbg(memory, _NORMAL_BLOCK); #else ::free(memory); #endif diff --git a/helpers/MemoryHelper.h b/helpers/MemoryHelper.h index 5f053a6..5c83767 100644 --- a/helpers/MemoryHelper.h +++ b/helpers/MemoryHelper.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2013 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2013 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 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. + 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. + 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. */ #pragma once diff --git a/helpers/PrecisionTimer.h b/helpers/PrecisionTimer.h index 378c8f8..8d64010 100644 --- a/helpers/PrecisionTimer.h +++ b/helpers/PrecisionTimer.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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. */ #pragma once diff --git a/helpers/RegistryHelper.cpp b/helpers/RegistryHelper.cpp index 11f680b..265e269 100644 --- a/helpers/RegistryHelper.cpp +++ b/helpers/RegistryHelper.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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 "stdafx.h" @@ -40,13 +40,13 @@ wstring RegistryHelper::readValue(wstring key, wstring valuename) DWORD type; DWORD bufSize; status = RegQueryValueExW(keyHandle, valuename.c_str(), NULL, &type, NULL, &bufSize); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) { RegCloseKey(keyHandle); throw RegistryException(L"Error while reading registry value " + key + L"\\" + valuename + L": " + StringHelper::getSystemErrorString(status)); } - if(type != REG_SZ) + if (type != REG_SZ) { RegCloseKey(keyHandle); throw RegistryException(L"Registry value " + key + L"\\" + valuename + L" has wrong type"); @@ -57,14 +57,14 @@ wstring RegistryHelper::readValue(wstring key, wstring valuename) RegCloseKey(keyHandle); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) { delete buf; throw RegistryException(L"Error while reading registry value " + key + L"\\" + valuename + L": " + StringHelper::getSystemErrorString(status)); } - //Remove zero-termination - if(buf[bufSize / sizeof(wchar_t) - 1] == L'\0') + // Remove zero-termination + if (buf[bufSize / sizeof(wchar_t) - 1] == L'\0') bufSize -= sizeof(wchar_t); result = wstring((wchar_t*)buf, (wstring::size_type)bufSize / sizeof(wchar_t)); delete buf; @@ -82,13 +82,13 @@ unsigned long RegistryHelper::readDWORDValue(wstring key, wstring valuename) DWORD type; DWORD bufSize; status = RegQueryValueExW(keyHandle, valuename.c_str(), NULL, &type, NULL, &bufSize); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) { RegCloseKey(keyHandle); throw RegistryException(L"Error while reading registry value " + key + L"\\" + valuename + L": " + StringHelper::getSystemErrorString(status)); } - if(type != REG_DWORD) + if (type != REG_DWORD) { RegCloseKey(keyHandle); throw RegistryException(L"Registry value " + key + L"\\" + valuename + L" has wrong type"); @@ -99,7 +99,7 @@ unsigned long RegistryHelper::readDWORDValue(wstring key, wstring valuename) RegCloseKey(keyHandle); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) { delete buf; throw RegistryException(L"Error while reading registry value " + key + L"\\" + valuename + L": " + StringHelper::getSystemErrorString(status)); @@ -121,13 +121,13 @@ vector RegistryHelper::readMultiValue(wstring key, wstring valuename) DWORD type; DWORD bufSize; status = RegQueryValueExW(keyHandle, valuename.c_str(), NULL, &type, NULL, &bufSize); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) { RegCloseKey(keyHandle); throw RegistryException(L"Error while reading registry value " + key + L"\\" + valuename + L": " + StringHelper::getSystemErrorString(status)); } - if(type != REG_MULTI_SZ) + if (type != REG_MULTI_SZ) { RegCloseKey(keyHandle); throw RegistryException(L"Registry value " + key + L"\\" + valuename + L" has wrong type"); @@ -138,28 +138,28 @@ vector RegistryHelper::readMultiValue(wstring key, wstring valuename) RegCloseKey(keyHandle); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) { delete buf; throw RegistryException(L"Error while reading registry value " + key + L"\\" + valuename + L": " + StringHelper::getSystemErrorString(status)); } size_t length = bufSize / sizeof(wchar_t); - //Remove zero-termination - while(length > 0 && buf[length - 1] == L'\0') + // Remove zero-termination + while (length > 0 && buf[length - 1] == L'\0') length--; size_t start = 0; - for(size_t i = 0; i < length; i++) + for (size_t i = 0; i < length; i++) { - if(buf[i] == L'\0') + if (buf[i] == L'\0') { result.push_back(wstring(buf + start, i - start)); start = i + 1; } } - if(length > start) + if (length > start) result.push_back(wstring(buf + start, length - start)); delete buf; @@ -175,13 +175,13 @@ vector RegistryHelper::readBinaryValue(wstring key, wstring value DWORD type; DWORD bufSize; status = RegQueryValueExW(keyHandle, valuename.c_str(), NULL, &type, NULL, &bufSize); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) { RegCloseKey(keyHandle); throw RegistryException(L"Error while reading registry value " + key + L"\\" + valuename + L": " + StringHelper::getSystemErrorString(status)); } - if(type != REG_BINARY) + if (type != REG_BINARY) { RegCloseKey(keyHandle); throw RegistryException(L"Registry value " + key + L"\\" + valuename + L" has wrong type"); @@ -192,7 +192,7 @@ vector RegistryHelper::readBinaryValue(wstring key, wstring value RegCloseKey(keyHandle); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) { throw RegistryException(L"Error while reading registry value " + key + L"\\" + valuename + L": " + StringHelper::getSystemErrorString(status)); } @@ -208,7 +208,7 @@ void RegistryHelper::writeValue(wstring key, wstring valuename, wstring value) RegCloseKey(keyHandle); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) throw RegistryException(L"Error while writing to registry value " + key + L"\\" + valuename + L": " + StringHelper::getSystemErrorString(status)); } @@ -229,7 +229,7 @@ void RegistryHelper::writeMultiValue(wstring key, wstring valuename, wstring val HKEY keyHandle = openKey(key, KEY_SET_VALUE | KEY_WOW64_64KEY); wchar_t* data = new wchar_t[value.size() + 2]; - value._Copy_s(data, (value.size() + 2)*sizeof(wchar_t), value.size()); + value._Copy_s(data, (value.size() + 2) * sizeof(wchar_t), value.size()); data[value.size()] = L'\0'; data[value.size() + 1] = L'\0'; @@ -239,7 +239,7 @@ void RegistryHelper::writeMultiValue(wstring key, wstring valuename, wstring val RegCloseKey(keyHandle); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) throw RegistryException(L"Error while writing to registry value " + key + L"\\" + valuename + L": " + StringHelper::getSystemErrorString(status)); } @@ -248,12 +248,12 @@ void RegistryHelper::writeMultiValue(wstring key, wstring valuename, vector RegistryHelper::enumSubKeys(wstring key) int i = 0; LSTATUS status; - while((status = RegEnumKeyExW(keyHandle, i++, keyName, &keyLength, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) + while ((status = RegEnumKeyExW(keyHandle, i++, keyName, &keyLength, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) { keyLength = sizeof(keyName) / sizeof(wchar_t); @@ -457,7 +457,7 @@ vector RegistryHelper::enumSubKeys(wstring key) RegCloseKey(keyHandle); - if(status != ERROR_NO_MORE_ITEMS) + if (status != ERROR_NO_MORE_ITEMS) throw RegistryException(L"Error while enumerating sub keys of registry key " + key + L": " + StringHelper::getSystemErrorString(status)); return result; @@ -473,7 +473,7 @@ bool RegistryHelper::keyEmpty(wstring key) RegCloseKey(keyHandle); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) throw RegistryException(L"Error while reading info for registry key " + key + L": " + StringHelper::getSystemErrorString(status)); return keyCount == 0 && valueCount == 0; @@ -482,12 +482,12 @@ bool RegistryHelper::keyEmpty(wstring key) void RegistryHelper::saveToFile(wstring key, vector valuenames, wstring filepath) { wofstream stream(filepath); - if(!stream.good()) + if (!stream.good()) throw RegistryException(L"Error while opening file " + filepath + L" for writing"); stream << L"Windows Registry Editor Version 5.00\n" << endl; stream << L"[HKEY_LOCAL_MACHINE\\" << key << L"]" << endl; - for(vector::iterator it = valuenames.begin(); it != valuenames.end(); it++) + for (vector::iterator it = valuenames.begin(); it != valuenames.end(); it++) { wstring& valuename = *it; wstring value = readValue(key, valuename); @@ -502,7 +502,7 @@ void RegistryHelper::saveToFile(wstring key, vector valuenames, wstring wstring RegistryHelper::getGuidString(GUID guid) { wchar_t* temp; - if(FAILED(StringFromCLSID(guid, &temp))) + if (FAILED(StringFromCLSID(guid, &temp))) throw RegistryException(L"Could not convert GUID to string"); std::wstring result(temp); CoTaskMemFree(temp); @@ -512,18 +512,18 @@ wstring RegistryHelper::getGuidString(GUID guid) bool RegistryHelper::isWindowsVersionAtLeast(unsigned major, unsigned minor) { - if(windowsVersion == 0) + if (windowsVersion == 0) { DWORD handle; DWORD size = GetFileVersionInfoSizeW(L"kernel32.dll", &handle); - if(size != 0) + if (size != 0) { void* data = malloc(size); - if(GetFileVersionInfo(L"kernel32.dll", handle, size, data)) + if (GetFileVersionInfo(L"kernel32.dll", handle, size, data)) { VS_FIXEDFILEINFO* info; UINT len; - if(VerQueryValueW(data, L"\\", (LPVOID*)&info, &len)) + if (VerQueryValueW(data, L"\\", (LPVOID*)&info, &len)) windowsVersion = info->dwProductVersionMS; } free(data); @@ -543,7 +543,7 @@ HKEY RegistryHelper::openKey(const wstring& key, REGSAM samDesired) HKEY keyHandle; LSTATUS status = RegOpenKeyExW(rootKey, subKey.c_str(), 0, samDesired, &keyHandle); - if(status != ERROR_SUCCESS) + if (status != ERROR_SUCCESS) throw RegistryException(L"Error while opening registry key " + key + L": " + StringHelper::getSystemErrorString(status)); return keyHandle; @@ -552,22 +552,22 @@ HKEY RegistryHelper::openKey(const wstring& key, REGSAM samDesired) wstring RegistryHelper::splitKey(const wstring& key, HKEY* rootKey) { size_t pos = key.find(L'\\'); - if(pos == wstring::npos) + if (pos == wstring::npos) throw RegistryException(L"Key " + key + L" has invalid format"); wstring rootPart = key.substr(0, pos); wstring pathPart = key.substr(pos + 1); wstring p = StringHelper::toUpperCase(rootPart); - if(p == L"HKEY_CLASSES_ROOT") + if (p == L"HKEY_CLASSES_ROOT") *rootKey = HKEY_CLASSES_ROOT; - else if(p == L"HKEY_CURRENT_CONFIG") + else if (p == L"HKEY_CURRENT_CONFIG") *rootKey = HKEY_CURRENT_CONFIG; - else if(p == L"HKEY_CURRENT_USER") + else if (p == L"HKEY_CURRENT_USER") *rootKey = HKEY_CURRENT_USER; - else if(p == L"HKEY_LOCAL_MACHINE") + else if (p == L"HKEY_LOCAL_MACHINE") *rootKey = HKEY_LOCAL_MACHINE; - else if(p == L"HKEY_USERS") + else if (p == L"HKEY_USERS") *rootKey = HKEY_USERS; else throw RegistryException(L"Unknown root key " + rootPart); diff --git a/helpers/RegistryHelper.h b/helpers/RegistryHelper.h index 80043af..ba0676a 100644 --- a/helpers/RegistryHelper.h +++ b/helpers/RegistryHelper.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2012 Jonas Thedering + 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 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. + 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. + 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. */ #pragma once @@ -26,9 +26,9 @@ #include // {EACD2258-FCAC-4FF4-B36D-419E924A6D79} -const GUID EQUALIZERAPO_PRE_MIX_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_POST_MIX_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}}; #define APP_REGPATH L"HKEY_LOCAL_MACHINE\\SOFTWARE\\EqualizerAPO" #define USER_REGPATH L"HKEY_CURRENT_USER\\SOFTWARE\\EqualizerAPO" @@ -67,7 +67,8 @@ private: class RegistryException { public: - RegistryException(const std::wstring& message):message(message) {} + RegistryException(const std::wstring& message) + : message(message) {} std::wstring getMessage() { diff --git a/helpers/StringHelper.cpp b/helpers/StringHelper.cpp index f444d03..439b333 100644 --- a/helpers/StringHelper.cpp +++ b/helpers/StringHelper.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2013 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2013 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 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. + 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. + 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 "stdafx.h" @@ -31,10 +31,10 @@ wstring StringHelper::replaceCharacters(const wstring& s, const wstring& chars, wstring result; result.reserve(s.length()); - for(unsigned i=0; i StringHelper::split(const wstring& s, wchar_t splitChar, bool skipEmpty) @@ -116,16 +116,16 @@ vector StringHelper::split(const wstring& s, wchar_t splitChar, bool sk vector result; size_t prevPos = 0; size_t pos = 0; - while((pos = s.find(splitChar, pos)) != wstring::npos) + while ((pos = s.find(splitChar, pos)) != wstring::npos) { - wstring part = s.substr(prevPos, pos-prevPos); - if(part.length() > 0 || !skipEmpty) + wstring part = s.substr(prevPos, pos - prevPos); + if (part.length() > 0 || !skipEmpty) result.push_back(part); prevPos = ++pos; } wstring part = s.substr(prevPos); - if(part.length() > 0 || !skipEmpty) + if (part.length() > 0 || !skipEmpty) result.push_back(part); return result; @@ -137,9 +137,9 @@ wstring StringHelper::join(const vector& strings, const wstring& separa bool first = true; - for(vector::const_iterator it = strings.cbegin(); it != strings.cend(); it++) + for (vector::const_iterator it = strings.cbegin(); it != strings.cend(); it++) { - if(first) + if (first) first = false; else stream << separator; @@ -153,7 +153,7 @@ wstring StringHelper::getSystemErrorString(long status) { wchar_t* buf; - if(FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, status, 0, (LPTSTR)&buf, 0, NULL) != 0) + if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, status, 0, (LPTSTR)&buf, 0, NULL) != 0) { wstring result(buf); LocalFree(buf); diff --git a/helpers/StringHelper.h b/helpers/StringHelper.h index 60d9aab..374f2c0 100644 --- a/helpers/StringHelper.h +++ b/helpers/StringHelper.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2013 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2013 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 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. + 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. + 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. */ #pragma once diff --git a/parser/RegexFunctions.cpp b/parser/RegexFunctions.cpp index c105b27..eea038b 100644 --- a/parser/RegexFunctions.cpp +++ b/parser/RegexFunctions.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -26,15 +26,15 @@ using namespace std; using namespace mup; RegexSearchFunction::RegexSearchFunction() - :ICallback(cmFUNC, L"regexSearch", 2) + : ICallback(cmFUNC, L"regexSearch", 2) { } -void RegexSearchFunction::Eval(ptr_val_type& ret, const ptr_val_type *arg, int argc) +void RegexSearchFunction::Eval(ptr_val_type& ret, const ptr_val_type* arg, int argc) { - if(!arg[0]->IsString()) + if (!arg[0]->IsString()) throw ParserError(ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), arg[0]->GetType(), 's', 1)); - if(!arg[1]->IsString()) + if (!arg[1]->IsString()) throw ParserError(ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), arg[1]->GetType(), 's', 2)); wstring regexString = arg[0]->GetString(); @@ -45,9 +45,9 @@ void RegexSearchFunction::Eval(ptr_val_type& ret, const ptr_val_type *arg, int a bool found = regex_search(string, match, regex); vector result; - if(found) + if (found) { - for(unsigned i=0; iIsString()) + if (!arg[0]->IsString()) throw ParserError(ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), arg[0]->GetType(), 's', 1)); - if(!arg[1]->IsString()) + if (!arg[1]->IsString()) throw ParserError(ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), arg[1]->GetType(), 's', 2)); - if(!arg[2]->IsString()) + if (!arg[2]->IsString()) throw ParserError(ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), arg[2]->GetType(), 's', 3)); wstring regexString = arg[0]->GetString(); diff --git a/parser/RegexFunctions.h b/parser/RegexFunctions.h index 001a0ba..ada3837 100644 --- a/parser/RegexFunctions.h +++ b/parser/RegexFunctions.h @@ -1,40 +1,40 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once #include -class RegexSearchFunction:public mup::ICallback +class RegexSearchFunction : public mup::ICallback { public: RegexSearchFunction(); - void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type *arg, int argc) override; + void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type* arg, int argc) override; const mup::char_type* GetDesc() const; mup::IToken* Clone() const override; }; -class RegexReplaceFunction:public mup::ICallback +class RegexReplaceFunction : public mup::ICallback { public: RegexReplaceFunction(); - void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type *arg, int argc) override; + void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type* arg, int argc) override; const mup::char_type* GetDesc() const; mup::IToken* Clone() const override; }; diff --git a/parser/RegistryFunctions.cpp b/parser/RegistryFunctions.cpp index 54c9904..5ad1eb9 100644 --- a/parser/RegistryFunctions.cpp +++ b/parser/RegistryFunctions.cpp @@ -26,16 +26,16 @@ using namespace std; using namespace mup; ReadRegStringFunction::ReadRegStringFunction(FilterEngine* engine) - :ICallback(cmFUNC, L"readRegString", 2) + : ICallback(cmFUNC, L"readRegString", 2) { this->engine = engine; } -void ReadRegStringFunction::Eval(ptr_val_type& ret, const ptr_val_type *arg, int argc) +void ReadRegStringFunction::Eval(ptr_val_type& ret, const ptr_val_type* arg, int argc) { - if(!arg[0]->IsString()) + if (!arg[0]->IsString()) throw ParserError(ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), arg[0]->GetType(), 's', 1)); - if(!arg[1]->IsString()) + if (!arg[1]->IsString()) throw ParserError(ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), arg[1]->GetType(), 's', 2)); wstring key = arg[0]->GetString(); @@ -49,7 +49,7 @@ void ReadRegStringFunction::Eval(ptr_val_type& ret, const ptr_val_type *arg, int engine->watchRegistryKey(key); } - catch(RegistryException e) + catch (RegistryException e) { throw ParserError(e.getMessage()); } @@ -66,16 +66,16 @@ IToken* ReadRegStringFunction::Clone() const } ReadRegDWORDFunction::ReadRegDWORDFunction(FilterEngine* engine) - :ICallback(cmFUNC, L"readRegDWORD", 2) + : ICallback(cmFUNC, L"readRegDWORD", 2) { this->engine = engine; } -void ReadRegDWORDFunction::Eval(ptr_val_type& ret, const ptr_val_type *arg, int argc) +void ReadRegDWORDFunction::Eval(ptr_val_type& ret, const ptr_val_type* arg, int argc) { - if(!arg[0]->IsString()) + if (!arg[0]->IsString()) throw ParserError(ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), arg[0]->GetType(), 's', 1)); - if(!arg[1]->IsString()) + if (!arg[1]->IsString()) throw ParserError(ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), arg[1]->GetType(), 's', 2)); wstring key = arg[0]->GetString(); @@ -89,7 +89,7 @@ void ReadRegDWORDFunction::Eval(ptr_val_type& ret, const ptr_val_type *arg, int engine->watchRegistryKey(key); } - catch(RegistryException e) + catch (RegistryException e) { throw ParserError(e.getMessage()); } diff --git a/parser/RegistryFunctions.h b/parser/RegistryFunctions.h index c84a5fd..27834e1 100644 --- a/parser/RegistryFunctions.h +++ b/parser/RegistryFunctions.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once @@ -23,11 +23,11 @@ class FilterEngine; -class ReadRegStringFunction:public mup::ICallback +class ReadRegStringFunction : public mup::ICallback { public: ReadRegStringFunction(FilterEngine* engine); - void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type *arg, int argc) override; + void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type* arg, int argc) override; const mup::char_type* GetDesc() const; mup::IToken* Clone() const override; @@ -35,11 +35,11 @@ private: FilterEngine* engine; }; -class ReadRegDWORDFunction:public mup::ICallback +class ReadRegDWORDFunction : public mup::ICallback { public: ReadRegDWORDFunction(FilterEngine* engine); - void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type *arg, int argc) override; + void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type* arg, int argc) override; const mup::char_type* GetDesc() const; mup::IToken* Clone() const override; diff --git a/parser/StringOperators.cpp b/parser/StringOperators.cpp index 3b0ad8e..9ed1739 100644 --- a/parser/StringOperators.cpp +++ b/parser/StringOperators.cpp @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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 "stdafx.h" @@ -23,22 +23,22 @@ using namespace std; using namespace mup; -void AddOperator::Eval(ptr_val_type& ret, const ptr_val_type *arg, int argc) +void AddOperator::Eval(ptr_val_type& ret, const ptr_val_type* arg, int argc) { - if(!arg[0]->IsString() && !arg[1]->IsString()) + if (!arg[0]->IsString() && !arg[1]->IsString()) { OprtAdd::Eval(ret, arg, argc); return; } wstring firstString; - if(arg[0]->IsString()) + if (arg[0]->IsString()) firstString = arg[0]->GetString(); else firstString = arg[0]->ToString(); wstring secondString; - if(arg[1]->IsString()) + if (arg[1]->IsString()) secondString = arg[1]->GetString(); else secondString = arg[1]->ToString(); diff --git a/parser/StringOperators.h b/parser/StringOperators.h index b3d938c..f04a613 100644 --- a/parser/StringOperators.h +++ b/parser/StringOperators.h @@ -1,20 +1,20 @@ /* - This file is part of EqualizerAPO, a system-wide equalizer. - Copyright (C) 2014 Jonas Thedering + This file is part of EqualizerAPO, a system-wide equalizer. + Copyright (C) 2014 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 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. + 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. + 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. */ #pragma once @@ -22,10 +22,10 @@ #include #include -class AddOperator:public mup::OprtAdd +class AddOperator : public mup::OprtAdd { public: - void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type *arg, int argc) override; + void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type* arg, int argc) override; const mup::char_type* GetDesc() const; mup::IToken* Clone() const override; }; diff --git a/reformat.bat b/reformat.bat new file mode 100644 index 0000000..dc32f2b --- /dev/null +++ b/reformat.bat @@ -0,0 +1,9 @@ +@echo off +cd %~dp0 +for /r %%f in (*.cpp *.h) do ( + (Echo "%%f" | FIND /I "\build-" 1>NUL) || (Echo "%%f" | FIND /I "\resource.h" 1>NUL) || (Echo "%%f" | FIND /I "\libHybridConv-0.1.1\" 1>NUL) || ( + uncrustify -c uncrustify.cfg -l CPP --no-backup "%%f" + ) +) + +pause diff --git a/uncrustify.cfg b/uncrustify.cfg new file mode 100644 index 0000000..6d6d571 --- /dev/null +++ b/uncrustify.cfg @@ -0,0 +1,306 @@ +tok_split_gte=false +utf8_byte=false +utf8_force=false +indent_cmt_with_tabs=false +indent_align_string=false +indent_braces=false +indent_braces_no_func=false +indent_braces_no_class=false +indent_braces_no_struct=false +indent_brace_parent=false +indent_paren_open_brace=false +indent_namespace=false +indent_namespace_single_indent=false +indent_extern=false +indent_class=true +indent_class_colon=false +indent_constr_colon=false +indent_else_if=false +indent_var_def_cont=false +indent_func_def_force_col1=false +indent_func_call_param=false +indent_func_def_param=false +indent_func_proto_param=false +indent_func_class_param=false +indent_func_ctor_var_param=false +indent_template_param=false +indent_func_param_double=false +indent_relative_single_line_comments=false +indent_col1_comment=false +indent_access_spec_body=false +indent_paren_nl=false +indent_comma_paren=false +indent_bool_paren=false +indent_first_bool_expr=false +indent_square_nl=false +indent_preserve_sql=false +indent_align_assign=false +indent_oc_block=false +indent_oc_msg_prioritize_first_colon=true +indent_oc_block_msg_xcode_style=false +indent_oc_block_msg_from_keyword=false +indent_oc_block_msg_from_colon=false +indent_oc_block_msg_from_caret=false +indent_oc_block_msg_from_brace=false +sp_balance_nested_parens=false +sp_permit_cpp11_shift=false +align_keep_tabs=false +align_with_tabs=false +align_on_tabstop=false +align_number_left=false +align_keep_extra_space=false +align_func_params=false +align_same_func_call_params=false +align_var_def_colon=false +align_var_def_attribute=false +align_var_def_inline=false +align_right_cmt_mix=false +align_on_operator=false +align_mix_var_proto=false +align_single_line_func=false +align_single_line_brace=false +align_nl_cont=false +align_pp_define_together=false +align_left_shift=false +align_oc_msg_colon_first=false +align_oc_decl_colon=false +nl_collapse_empty_body=false +nl_assign_leave_one_liners=false +nl_class_leave_one_liners=false +nl_enum_leave_one_liners=false +nl_getset_leave_one_liners=false +nl_func_leave_one_liners=true +nl_cpp_lambda_leave_one_liners=false +nl_if_leave_one_liners=false +nl_oc_msg_leave_one_liner=false +nl_multi_line_cond=false +nl_multi_line_define=false +nl_before_case=false +nl_after_case=false +nl_oc_msg_args=false +nl_after_semicolon=false +nl_after_brace_open=false +nl_after_brace_open_cmt=false +nl_after_vbrace_open=false +nl_after_vbrace_open_empty=false +nl_after_brace_close=false +nl_after_vbrace_close=false +nl_define_macro=false +nl_squeeze_ifdef=false +nl_ds_struct_enum_cmt=false +nl_ds_struct_enum_close_brace=false +nl_create_if_one_liner=false +nl_create_for_one_liner=false +nl_create_while_one_liner=false +ls_for_split_full=false +ls_func_split_full=false +ls_code_width=false +nl_after_multiline_comment=false +eat_blanks_after_open_brace=false +eat_blanks_before_close_brace=false +nl_before_return=false +nl_after_return=false +mod_full_brace_if_chain=false +mod_pawn_semicolon=false +mod_full_paren_if_bool=false +mod_remove_extra_semicolon=false +mod_sort_import=false +mod_sort_using=false +mod_sort_include=false +mod_move_case_break=false +mod_remove_empty_return=false +cmt_convert_tab_to_spaces=false +cmt_indent_multi=false +cmt_c_group=false +cmt_c_nl_start=false +cmt_c_nl_end=false +cmt_cpp_group=false +cmt_cpp_nl_start=false +cmt_cpp_nl_end=false +cmt_cpp_to_c=false +cmt_star_cont=false +cmt_multi_check_last=true +cmt_insert_before_preproc=false +pp_indent_at_level=false +pp_region_indent_code=false +pp_if_indent_code=false +pp_define_at_level=false +input_tab_size=4 +output_tab_size=4 +indent_columns=4 +indent_continue=4 +indent_case_brace=4 +nl_max=2 +newlines=auto +indent_with_tabs=2 +sp_arith=add +sp_assign=add +sp_assign_default=add +sp_before_assign=add +sp_after_assign=add +sp_enum_assign=add +sp_enum_before_assign=add +sp_enum_after_assign=add +sp_pp_concat=add +sp_pp_stringify=add +sp_bool=add +sp_compare=add +sp_inside_paren=remove +sp_paren_paren=remove +sp_paren_brace=remove +sp_before_ptr_star=remove +sp_before_unnamed_ptr_star=remove +sp_between_ptr_star=remove +sp_after_ptr_star=add +sp_after_ptr_star_qualifier=add +sp_after_ptr_star_func=add +sp_ptr_star_paren=add +sp_before_ptr_star_func=remove +sp_before_byref=remove +sp_before_unnamed_byref=remove +sp_after_byref=add +sp_after_byref_func=add +sp_before_byref_func=remove +sp_after_type=remove +sp_template_angle=remove +sp_before_angle=remove +sp_inside_angle=remove +sp_after_angle=remove +sp_angle_paren=remove +sp_angle_word=add +sp_angle_shift=remove +sp_before_sparen=add +sp_inside_sparen=remove +sp_inside_sparen_close=remove +sp_after_sparen=remove +sp_sparen_brace=remove +sp_special_semi=remove +sp_before_semi=remove +sp_before_semi_for=remove +sp_before_semi_for_empty=remove +sp_after_semi=remove +sp_after_semi_for=add +sp_after_semi_for_empty=remove +sp_before_square=remove +sp_before_squares=remove +sp_inside_square=remove +sp_after_comma=add +sp_before_comma=remove +sp_paren_comma=remove +sp_before_ellipsis=remove +sp_after_class_colon=add +sp_before_class_colon=add +sp_after_constr_colon=add +sp_before_constr_colon=add +sp_before_case_colon=remove +sp_after_operator=remove +sp_after_operator_sym=remove +sp_inside_paren_cast=remove +sp_cpp_cast_paren=remove +sp_sizeof_paren=remove +sp_after_tag=remove +sp_inside_braces_enum=remove +sp_inside_braces_struct=remove +sp_inside_braces=remove +sp_inside_braces_empty=remove +sp_type_func=remove +sp_func_proto_paren=remove +sp_func_def_paren=remove +sp_inside_fparens=remove +sp_inside_fparen=remove +sp_inside_tparen=remove +sp_after_tparen_close=remove +sp_square_fparen=remove +sp_fparen_brace=add +sp_func_call_paren=remove +sp_func_call_paren_empty=remove +sp_func_call_user_paren=remove +sp_func_class_paren=remove +sp_return_paren=remove +sp_attribute_paren=remove +sp_defined_paren=remove +sp_throw_paren=add +sp_catch_paren=add +sp_macro=remove +sp_macro_func=remove +sp_else_brace=remove +sp_brace_else=remove +sp_brace_typedef=remove +sp_catch_brace=remove +sp_brace_catch=remove +sp_finally_brace=remove +sp_brace_finally=remove +sp_try_brace=remove +sp_getset_brace=remove +sp_word_brace=add +sp_word_brace_ns=add +sp_before_dc=remove +sp_after_dc=remove +sp_d_array_colon=remove +sp_not=remove +sp_inv=remove +sp_addr=remove +sp_member=remove +sp_deref=remove +sp_sign=remove +sp_incdec=remove +sp_before_nl_cont=remove +sp_cond_colon=remove +sp_cond_colon_before=add +sp_cond_colon_after=add +sp_cond_question=remove +sp_cond_question_before=add +sp_cond_question_after=add +sp_case_label=remove +sp_range=remove +sp_after_for_colon=add +sp_before_for_colon=add +sp_cmt_cpp_start=add +sp_endif_cmt=add +sp_after_new=remove +sp_before_tr_emb_cmt=add +nl_fcall_brace=add +nl_enum_brace=add +nl_struct_brace=add +nl_union_brace=add +nl_if_brace=add +nl_brace_else=add +nl_elseif_brace=add +nl_else_brace=add +nl_else_if=remove +nl_brace_finally=add +nl_finally_brace=add +nl_try_brace=add +nl_getset_brace=add +nl_for_brace=add +nl_catch_brace=add +nl_brace_catch=add +nl_while_brace=add +nl_using_brace=add +nl_do_brace=add +nl_brace_while=add +nl_switch_brace=add +nl_case_colon_brace=add +nl_namespace_brace=remove +nl_template_class=remove +nl_class_brace=add +nl_class_init_args=remove +nl_func_type_name=remove +nl_func_type_name_class=remove +nl_func_scope_name=remove +nl_func_proto_type_name=remove +nl_func_paren=remove +nl_func_def_paren=remove +nl_func_decl_start=remove +nl_func_def_start=remove +nl_func_decl_end=remove +nl_func_def_end=remove +nl_func_decl_end_single=remove +nl_func_def_end_single=remove +nl_func_decl_empty=remove +nl_func_def_empty=remove +nl_fdef_brace=add +nl_return_expr=remove +nl_class_colon=remove +nl_constr_colon=add +pos_constr_colon=lead