diff --git a/Benchmark/Benchmark.vcxproj b/Benchmark/Benchmark.vcxproj index f6ce85f..d6d69b1 100644 --- a/Benchmark/Benchmark.vcxproj +++ b/Benchmark/Benchmark.vcxproj @@ -22,34 +22,34 @@ {D4474852-5724-4253-95C6-7A6DC424F194} Win32Proj Benchmark - 10.0.10240.0 + 10.0 Application true Unicode - v120 + v142 Application true Unicode - v120 + v142 Application false true Unicode - v120 + v142 Application false true Unicode - v120 + v142 @@ -69,22 +69,22 @@ true - $(SolutionDir);C:\Program Files\tclap-1.2.1\include;C:\Program Files\libsndfile\include;$(IncludePath) + $(SolutionDir);C:\Program Files\tclap-1.2.4\include;C:\Program Files\libsndfile\include;$(IncludePath) C:\Program Files (x86)\libsndfile\lib;C:\Program Files\muparserx_v3_0_1\lib;C:\Program Files (x86)\fftw3;$(LibraryPath) true - $(SolutionDir);C:\Program Files\tclap-1.2.1\include;C:\Program Files\libsndfile\include;$(IncludePath) + $(SolutionDir);C:\Program Files\tclap-1.2.4\include;C:\Program Files\libsndfile\include;$(IncludePath) C:\Program Files\libsndfile\lib;C:\Program Files\muparserx_v3_0_1\lib64;C:\Program Files\fftw3;$(LibraryPath) false - $(SolutionDir);C:\Program Files\tclap-1.2.1\include;C:\Program Files\libsndfile\include;$(IncludePath) + $(SolutionDir);C:\Program Files\tclap-1.2.4\include;C:\Program Files\libsndfile\include;$(IncludePath) C:\Program Files (x86)\libsndfile\lib;C:\Program Files\muparserx_v3_0_1\lib;C:\Program Files (x86)\fftw3;$(LibraryPath) false - $(SolutionDir);C:\Program Files\tclap-1.2.1\include;C:\Program Files\libsndfile\include;$(IncludePath) + $(SolutionDir);C:\Program Files\tclap-1.2.4\include;C:\Program Files\libsndfile\include;$(IncludePath) C:\Program Files\libsndfile\lib;C:\Program Files\muparserx_v3_0_1\lib64;C:\Program Files\fftw3;$(LibraryPath) @@ -93,6 +93,8 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + stdcpp17 + true Console @@ -106,6 +108,8 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + stdcpp17 + true Console @@ -122,6 +126,8 @@ true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) Fast + stdcpp17 + true Console @@ -140,6 +146,8 @@ true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) Fast + stdcpp17 + true Console diff --git a/Common.vcxproj b/Common.vcxproj index 91f2842..39e2264 100644 --- a/Common.vcxproj +++ b/Common.vcxproj @@ -22,31 +22,32 @@ {6758B50E-B9F0-4389-A61D-A842F0545E1B} Win32Proj Common + 10.0 StaticLibrary true - v120 + v142 Unicode StaticLibrary true - v120 + v142 Unicode StaticLibrary false - v120 + v142 true Unicode StaticLibrary false - v120 + v142 true Unicode @@ -84,6 +85,8 @@ Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + stdcpp17 + true Windows @@ -96,6 +99,8 @@ Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + stdcpp17 + true Windows @@ -110,6 +115,8 @@ true true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + stdcpp17 + true Windows @@ -126,6 +133,8 @@ true true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + stdcpp17 + true Windows diff --git a/Configurator/Configurator.cpp b/Configurator/Configurator.cpp index 8c7fd81..0dba055 100644 --- a/Configurator/Configurator.cpp +++ b/Configurator/Configurator.cpp @@ -757,7 +757,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, { for (int index = 0; index <= 1; index++) { - vector > apoInfos = DeviceAPOInfo::loadAllInfos(index == 1); + vector> apoInfos = DeviceAPOInfo::loadAllInfos(index == 1); for (shared_ptr& apoInfo : apoInfos) { diff --git a/Configurator/Configurator.h b/Configurator/Configurator.h index 3e87a0f..d9da22d 100644 --- a/Configurator/Configurator.h +++ b/Configurator/Configurator.h @@ -64,6 +64,6 @@ private: void updateList(int listIndex, int itemIndex); void updateButtons(int listIndex); - std::vector > apoInfos[2]; + std::vector> apoInfos[2]; bool askForReboot = false; }; diff --git a/Configurator/Configurator.vcxproj b/Configurator/Configurator.vcxproj index 0582272..58ed8b4 100644 --- a/Configurator/Configurator.vcxproj +++ b/Configurator/Configurator.vcxproj @@ -51,34 +51,34 @@ {E18E1CA7-3D6C-4CD5-9CE9-E72565A206E5} Win32Proj Configurator - 10.0.10240.0 + 10.0 Application true Unicode - v120 + v142 Application true Unicode - v120 + v142 Application false true Unicode - v120 + v142 Application false true Unicode - v120 + v142 @@ -126,6 +126,8 @@ Level3 Disabled WIN32;USE_WINDDK;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + stdcpp17 + true Windows @@ -139,6 +141,8 @@ Level3 Disabled WIN32;USE_WINDDK;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + stdcpp17 + true Windows @@ -154,6 +158,8 @@ true true WIN32;USE_WINDDK;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + stdcpp17 + true Windows @@ -171,6 +177,8 @@ true true WIN32;USE_WINDDK;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + stdcpp17 + true Windows diff --git a/DeviceAPOInfo.cpp b/DeviceAPOInfo.cpp index 1771d72..0606587 100644 --- a/DeviceAPOInfo.cpp +++ b/DeviceAPOInfo.cpp @@ -70,9 +70,9 @@ static const wchar_t* disableEnhancementsValueName = L"{1da5d803-d492-4edd-8c23- static const wchar_t* installVersion = L"2"; static PROPERTYKEY guidPropertyKey = {{0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e}, 4}; -vector > DeviceAPOInfo::loadAllInfos(bool input) +vector> DeviceAPOInfo::loadAllInfos(bool input) { - vector > result; + vector> result; vector deviceGuidStrings = RegistryHelper::enumSubKeys(input ? captureKeyPath : renderKeyPath); wstring defaultDeviceGuid = getDefaultDevice(input); diff --git a/DeviceAPOInfo.h b/DeviceAPOInfo.h index 3e386ef..b651523 100644 --- a/DeviceAPOInfo.h +++ b/DeviceAPOInfo.h @@ -63,7 +63,7 @@ public: } }; - static std::vector > loadAllInfos(bool input); + static std::vector> loadAllInfos(bool input); static std::wstring getDefaultDevice(bool input, int role = 1); static bool checkProtectedAudioDG(bool fix); static bool checkAPORegistration(bool fix); diff --git a/Editor/AnalysisPlotScene.cpp b/Editor/AnalysisPlotScene.cpp index bcb06e9..5a6e615 100644 --- a/Editor/AnalysisPlotScene.cpp +++ b/Editor/AnalysisPlotScene.cpp @@ -44,7 +44,7 @@ void AnalysisPlotScene::setFreqData(fftwf_complex* freqData, int frameCount, uns update(); } -vector AnalysisPlotScene::getNodes() const +const vector& AnalysisPlotScene::getNodes() const { return nodes; } diff --git a/Editor/AnalysisPlotScene.h b/Editor/AnalysisPlotScene.h index 5677510..8f186cb 100644 --- a/Editor/AnalysisPlotScene.h +++ b/Editor/AnalysisPlotScene.h @@ -34,7 +34,7 @@ public: void setFreqData(fftwf_complex* freqData, int frameCount, unsigned sampleRate); - std::vector getNodes() const; + const std::vector& getNodes() const; private: std::vector nodes; diff --git a/Editor/AnalysisPlotView.cpp b/Editor/AnalysisPlotView.cpp index 39f1480..080cdff 100644 --- a/Editor/AnalysisPlotView.cpp +++ b/Editor/AnalysisPlotView.cpp @@ -36,7 +36,7 @@ void AnalysisPlotView::drawBackground(QPainter* painter, const QRectF& rect) painter->setRenderHint(QPainter::Antialiasing, true); AnalysisPlotScene* s = qobject_cast(scene()); - std::vector& nodes = s->getNodes(); + const std::vector& nodes = s->getNodes(); GainIterator gainIterator(nodes); QPainterPath path; bool first = true; diff --git a/Editor/AnalysisThread.h b/Editor/AnalysisThread.h index 32c0720..c68ede7 100644 --- a/Editor/AnalysisThread.h +++ b/Editor/AnalysisThread.h @@ -20,6 +20,7 @@ #pragma once #include +#include #include #include diff --git a/Editor/FilterTable.cpp b/Editor/FilterTable.cpp index be6a9a7..7ce5a5e 100644 --- a/Editor/FilterTable.cpp +++ b/Editor/FilterTable.cpp @@ -94,7 +94,7 @@ FilterTable::~FilterTable() factories.clear(); } -void FilterTable::initialize(QScrollArea* scrollArea, const QList >& outputDevices, const QList >& inputDevices) +void FilterTable::initialize(QScrollArea* scrollArea, const QList>& outputDevices, const QList>& inputDevices) { this->scrollArea = scrollArea; this->outputDevices = outputDevices; @@ -144,7 +144,7 @@ void FilterTable::updateGuis() timer.start(); gridLayout = new QGridLayout(this); - gridLayout->setMargin(0); + gridLayout->setContentsMargins(0, 0, 0, 0); gridLayout->setSpacing(0); gridLayout->setColumnStretch(0, 0); gridLayout->setColumnStretch(1, 1); @@ -926,7 +926,7 @@ void FilterTable::keyPressEvent(QKeyEvent* event) void FilterTable::wheelEvent(QWheelEvent* event) { scrollingNow = true; - scrollStartPoint = event->globalPos(); + scrollStartPoint = event->globalPosition(); QWidget::wheelEvent(event); } @@ -939,7 +939,7 @@ bool FilterTable::eventFilter(QObject* obj, QEvent* event) if (type == QEvent::Wheel) { QWheelEvent* wheelEvent = (QWheelEvent*)event; - scrollStartPoint = wheelEvent->globalPos(); + scrollStartPoint = wheelEvent->globalPosition(); QWidget* widget = qobject_cast(obj); if (widget != NULL) @@ -1059,12 +1059,12 @@ const QSet& FilterTable::getSelectedItems() const return selected; } -const QList >& FilterTable::getOutputDevices() const +const QList>& FilterTable::getOutputDevices() const { return outputDevices; } -const QList >& FilterTable::getInputDevices() const +const QList>& FilterTable::getInputDevices() const { return inputDevices; } diff --git a/Editor/FilterTable.h b/Editor/FilterTable.h index 68cf532..6ed8ee1 100644 --- a/Editor/FilterTable.h +++ b/Editor/FilterTable.h @@ -57,7 +57,7 @@ public: explicit FilterTable(MainWindow* mainWindow, QWidget* parent = 0); ~FilterTable(); - void initialize(QScrollArea* scrollArea, const QList >& outputDevices, const QList >& inputDevices); + void initialize(QScrollArea* scrollArea, const QList>& outputDevices, const QList>& inputDevices); void updateDeviceAndChannelMask(std::shared_ptr selectedDevice, int selectedChannelMask); void updateGuis(); void propagateChannels(); @@ -72,8 +72,8 @@ public: void deleteSelectedLines(); void selectAll(); - const QList >& getOutputDevices() const; - const QList >& getInputDevices() const; + const QList>& getOutputDevices() const; + const QList>& getInputDevices() const; std::shared_ptr getSelectedDevice() const; int getSelectedChannelMask() const; @@ -135,9 +135,9 @@ private: Item* selectionStart = NULL; QList factories; bool scrollingNow = false; - QPoint scrollStartPoint; - QList > outputDevices; - QList > inputDevices; + QPointF scrollStartPoint; + QList> outputDevices; + QList> inputDevices; std::shared_ptr selectedDevice; int selectedChannelMask; QString configPath; diff --git a/Editor/FilterTableRow.cpp b/Editor/FilterTableRow.cpp index cd5c1c2..ad1a9d3 100644 --- a/Editor/FilterTableRow.cpp +++ b/Editor/FilterTableRow.cpp @@ -170,7 +170,7 @@ void FilterTableRow::on_actionEditText_triggered(bool checked) { if (checked) { - if (!lastEditTime.isValid() || lastEditTime.elapsed() > 100) + if (!lastEditTime.isValid() || lastEditTime.msecsTo(QDateTime::currentDateTimeUtc()) > 100) { ui->lineEdit->setText(item->text); ui->stackedWidget->setCurrentIndex(0); @@ -199,7 +199,7 @@ void FilterTableRow::on_lineEdit_editingFinished() else { ui->stackedWidget->setCurrentIndex(1); - lastEditTime.start(); + lastEditTime = QDateTime::currentDateTimeUtc(); ui->actionEditText->setChecked(false); } } diff --git a/Editor/FilterTableRow.h b/Editor/FilterTableRow.h index 589ff9c..8d27499 100644 --- a/Editor/FilterTableRow.h +++ b/Editor/FilterTableRow.h @@ -60,5 +60,5 @@ private: FilterTable::Item* item; IFilterGUI* gui; bool editingDone = false; - QTime lastEditTime; + QDateTime lastEditTime; }; diff --git a/Editor/Licenseheader.txt b/Editor/Licenseheader.txt new file mode 100644 index 0000000..af3aea6 --- /dev/null +++ b/Editor/Licenseheader.txt @@ -0,0 +1,19 @@ +/* + This file is part of Equalizer APO, a system-wide equalizer. + Copyright (C) %YEAR% Jonas Thedering + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + diff --git a/Editor/MainWindow.cpp b/Editor/MainWindow.cpp index 8ccc59d..440a61c 100644 --- a/Editor/MainWindow.cpp +++ b/Editor/MainWindow.cpp @@ -51,8 +51,8 @@ using namespace std; 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))); + outputDevices = toQList(DeviceAPOInfo::loadAllInfos(false)); + inputDevices = toQList(DeviceAPOInfo::loadAllInfos(true)); defaultOutputDevice = NULL; for (shared_ptr& apoInfo : outputDevices) @@ -141,7 +141,7 @@ MainWindow::MainWindow(QDir configDir, QWidget* parent) 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 (size_t i = 0; i < sizeof(languages) / sizeof(QLocale::Language); i++) { QLocale::Language language = languages[i]; QString languageName; @@ -228,7 +228,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); + unsigned long long result = (unsigned long long)ShellExecuteW(NULL, L"open", file.c_str(), NULL, NULL, SW_SHOWNORMAL); if (result == SE_ERR_ACCESSDENIED) ShellExecuteW(NULL, L"runas", file.c_str(), NULL, NULL, SW_SHOWNORMAL); } @@ -292,7 +292,7 @@ void MainWindow::load(QString path) encodedLine.resize(encodedLine.size() - 1); wstring line = StringHelper::toWString(encodedLine, CP_UTF8); - if (line.find(L'\uFFFD') != -1) + if (line.find(L'\uFFFD') != wstring::npos) line = StringHelper::toWString(encodedLine, CP_ACP); lines.append(QString::fromStdWString(line)); @@ -402,7 +402,7 @@ void MainWindow::closeEvent(QCloseEvent* event) void MainWindow::deviceSelected(int index) { - shared_ptr apoInfo = deviceComboBox->itemData(index).value >(); + shared_ptr apoInfo = deviceComboBox->itemData(index).value>(); if (apoInfo == NULL) apoInfo = defaultOutputDevice; @@ -415,7 +415,7 @@ void MainWindow::deviceSelected(int index) const GUIChannelHelper::ChannelConfigurationInfo* selectedInfo = NULL; for (const GUIChannelHelper::ChannelConfigurationInfo& info : infos) { - if (info.channelMask == apoInfo->getChannelMask()) + if (info.channelMask == (int)apoInfo->getChannelMask()) { selectedInfo = &info; break; @@ -425,7 +425,7 @@ void MainWindow::deviceSelected(int index) if (selectedInfo != NULL) channelConfigurationComboBox->addItem(tr("From device") + " (" + selectedInfo->name + ")", 0); else if (apoInfo->getChannelCount() != 0) - channelConfigurationComboBox->addItem(tr("From device") + " (" + apoInfo->getChannelCount() + " channels)", 0); + channelConfigurationComboBox->addItem((tr("From device") + " (%1 channels)").arg(apoInfo->getChannelCount()), 0); else channelConfigurationComboBox->addItem(tr("From device") + " (? channels)", 0); } @@ -458,7 +458,7 @@ void MainWindow::channelConfigurationSelected(int index) if (selectedDevice != NULL) { unsigned channelCount = selectedDevice->getChannelCount(); - if (channelMask != 0 && channelMask != selectedDevice->getChannelMask()) + if (channelMask != 0 && channelMask != (int)selectedDevice->getChannelMask()) { channelCount = 0; for (int i = 0; i < 31; i++) @@ -475,7 +475,7 @@ void MainWindow::channelConfigurationSelected(int index) } vector channelNames = ChannelHelper::getChannelNames(channelCount, channelMask); - for (wstring channelName : channelNames) + for (const wstring& channelName : channelNames) { ui->analysisChannelComboBox->addItem(QString::fromStdWString(channelName)); } @@ -615,7 +615,7 @@ void MainWindow::on_actionSaveAs_triggered() if (dialog.exec() == QDialog::Accepted) { - QString savePath = dialog.selectedFiles().first(); + QString savePath = dialog.selectedFiles().at(0); save(filterTable, savePath); filterTable->setConfigPath(QDir::toNativeSeparators(savePath)); @@ -817,12 +817,12 @@ 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) { QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat); - for (QString key : settings.childGroups()) + for (const QString& key : settings.childGroups()) { if (key != "file-specific") settings.remove(key); } - for (QString key : settings.childKeys()) + for (const QString& key : settings.childKeys()) settings.remove(key); restart = true; @@ -836,9 +836,9 @@ 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) { QSettings settings(QString::fromWCharArray(EDITOR_PER_FILE_REGPATH), QSettings::NativeFormat); - for (QString key : settings.childGroups()) + for (const QString& key : settings.childGroups()) settings.remove(key); - for (QString key : settings.childKeys()) + for (const QString& key : settings.childKeys()) settings.remove(key); restart = true; @@ -871,7 +871,7 @@ FilterTable* MainWindow::addTab(QString title, QString tooltip, QString configPa void MainWindow::getDeviceAndChannelMask(shared_ptr* selectedDevice, int* channelMask) { - *selectedDevice = deviceComboBox->currentData().value >(); + *selectedDevice = deviceComboBox->currentData().value>(); if (*selectedDevice == NULL) *selectedDevice = defaultOutputDevice; @@ -981,7 +981,7 @@ void MainWindow::loadPreferences() { for (int i = 0; i < deviceComboBox->count(); i++) { - shared_ptr apoInfo = deviceComboBox->itemData(i).value >(); + shared_ptr apoInfo = deviceComboBox->itemData(i).value>(); if (apoInfo != NULL) { if (QString::fromStdWString(apoInfo->getDeviceString()).compare(selectedDevice, Qt::CaseInsensitive) == 0) @@ -1055,7 +1055,7 @@ void MainWindow::savePreferences() settings.setValue("geometry", saveGeometry()); settings.setValue("windowState", saveState()); settings.setValue("instantMode", instantModeCheckBox->isChecked()); - shared_ptr selectedDevice = deviceComboBox->currentData().value >(); + shared_ptr selectedDevice = deviceComboBox->currentData().value>(); settings.setValue("selectedDevice", selectedDevice != NULL ? QString::fromStdWString(selectedDevice->getDeviceString()) : ""); int channelMask = channelConfigurationComboBox->currentData().toInt(); settings.setValue("selectedChannelMask", channelMask); @@ -1105,7 +1105,7 @@ void MainWindow::updateRecentFiles() if (separatorsFound == 1) { QList newActions; - for (QString recentFile : recentFiles) + for (const QString& recentFile : recentFiles) { QAction* newAction = new QAction(recentFile, ui->menuFile); connect(newAction, SIGNAL(triggered(bool)), this, SLOT(recentFileSelected())); @@ -1124,3 +1124,13 @@ void MainWindow::updateRecentFiles() } } } + +template QList MainWindow::toQList(const std::vector& vector) +{ + QList list; + list.reserve((int)vector.size()); + for (T t : vector) + list.append(t); + + return list; +} diff --git a/Editor/MainWindow.h b/Editor/MainWindow.h index 0751ffb..16df5a0 100644 --- a/Editor/MainWindow.h +++ b/Editor/MainWindow.h @@ -98,6 +98,7 @@ private: void loadPreferences(); void savePreferences(); void updateRecentFiles(); + template QList toQList(const std::vector& vector); Ui::MainWindow* ui; @@ -105,8 +106,8 @@ private: QCheckBox* instantModeCheckBox; QComboBox* deviceComboBox; QComboBox* channelConfigurationComboBox; - QList > outputDevices; - QList > inputDevices; + QList> outputDevices; + QList> inputDevices; std::shared_ptr defaultOutputDevice; AnalysisPlotScene* analysisPlotScene; AnalysisThread* analysisThread = NULL; diff --git a/Editor/guis/BiQuadFilterGUIFactory.cpp b/Editor/guis/BiQuadFilterGUIFactory.cpp index b874291..555363d 100644 --- a/Editor/guis/BiQuadFilterGUIFactory.cpp +++ b/Editor/guis/BiQuadFilterGUIFactory.cpp @@ -48,7 +48,9 @@ IFilterGUI* BiQuadFilterGUIFactory::createFilterGUI(QString& command, QString& p if (command.startsWith("Filter")) { BiQuadFilterFactory factory; - std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); + std::wstring commandWStr = command.toStdWString(); + std::wstring paramWStr = parameters.toStdWString(); + std::vector filters = factory.createFilter(L"", commandWStr, paramWStr); if (!filters.empty()) { BiQuadFilter* filter = (BiQuadFilter*)filters[0]; diff --git a/Editor/guis/ChannelFilterGUI.cpp b/Editor/guis/ChannelFilterGUI.cpp index 06d0ae3..7e104bc 100644 --- a/Editor/guis/ChannelFilterGUI.cpp +++ b/Editor/guis/ChannelFilterGUI.cpp @@ -37,7 +37,7 @@ ChannelFilterGUI::ChannelFilterGUI(const QString& parameters, int selectedChanne selectedChannels.clear(); - QStringList words = parameters.trimmed().split(' ', QString::SkipEmptyParts); + QStringList words = parameters.trimmed().split(' ', Qt::SkipEmptyParts); for (QString word : words) if (word.length() > 0) selectedChannels.append(word.toUpper()); diff --git a/Editor/guis/ChannelFilterGUIDialog.cpp b/Editor/guis/ChannelFilterGUIDialog.cpp index 92212e1..72f761e 100644 --- a/Editor/guis/ChannelFilterGUIDialog.cpp +++ b/Editor/guis/ChannelFilterGUIDialog.cpp @@ -92,7 +92,7 @@ ChannelFilterGUIDialog::ChannelFilterGUIDialog(QWidget* parent, QStringList sele else if (channelName == "LFE" && remainingSelectedChannels.removeOne("SUB")) checked = true; - if (remainingSelectedChannels.removeOne(QString(channelIndex))) + if (remainingSelectedChannels.removeOne(QString("%1").arg(channelIndex))) checked = true; checkBox->setChecked(checked); } diff --git a/Editor/guis/CopyFilterGUIConnectionItem.cpp b/Editor/guis/CopyFilterGUIConnectionItem.cpp index 3a1649b..ff71e5e 100644 --- a/Editor/guis/CopyFilterGUIConnectionItem.cpp +++ b/Editor/guis/CopyFilterGUIConnectionItem.cpp @@ -67,7 +67,7 @@ QPainterPath CopyFilterGUIConnectionItem::shape() const double length = line().length(); if (length > 0) { - double offset = min(length, DPIHelper::scale(maxArrowSize)); + double offset = fmin(length, DPIHelper::scale(maxArrowSize)); QLineF unit = l.unitVector(); QLineF normal = l.normalVector().unitVector(); QPointF v(unit.dx(), unit.dy()); @@ -131,7 +131,7 @@ void CopyFilterGUIConnectionItem::paint(QPainter* painter, const QStyleOptionGra painter->drawLine(line()); double length = line().length(); - double offset = min(length, DPIHelper::scale(maxArrowSize)); + double offset = fmin(length, DPIHelper::scale(maxArrowSize)); QLineF unit = l.unitVector(); QLineF normal = l.normalVector().unitVector(); QPointF v(unit.dx(), unit.dy()); diff --git a/Editor/guis/CopyFilterGUIFactory.cpp b/Editor/guis/CopyFilterGUIFactory.cpp index eaa7b23..186512d 100644 --- a/Editor/guis/CopyFilterGUIFactory.cpp +++ b/Editor/guis/CopyFilterGUIFactory.cpp @@ -45,7 +45,9 @@ IFilterGUI* CopyFilterGUIFactory::createFilterGUI(QString& command, QString& par if (command == "Copy") { CopyFilterFactory factory; - std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); + std::wstring commandWStr = command.toStdWString(); + std::wstring paramWStr = parameters.toStdWString(); + std::vector filters = factory.createFilter(L"", commandWStr, paramWStr); if (!filters.empty()) { CopyFilter* filter = (CopyFilter*)filters[0]; diff --git a/Editor/guis/DelayFilterGUIFactory.cpp b/Editor/guis/DelayFilterGUIFactory.cpp index fade3fa..7066751 100644 --- a/Editor/guis/DelayFilterGUIFactory.cpp +++ b/Editor/guis/DelayFilterGUIFactory.cpp @@ -40,7 +40,9 @@ IFilterGUI* DelayFilterGUIFactory::createFilterGUI(QString& command, QString& pa if (command == "Delay") { DelayFilterFactory factory; - std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); + std::wstring commandWStr = command.toStdWString(); + std::wstring paramWStr = parameters.toStdWString(); + std::vector filters = factory.createFilter(L"", commandWStr, paramWStr); if (!filters.empty()) { DelayFilter* filter = (DelayFilter*)filters[0]; diff --git a/Editor/guis/DeviceFilterGUI.cpp b/Editor/guis/DeviceFilterGUI.cpp index b999af6..e857ac5 100644 --- a/Editor/guis/DeviceFilterGUI.cpp +++ b/Editor/guis/DeviceFilterGUI.cpp @@ -64,7 +64,7 @@ void DeviceFilterGUI::load(const QString& parameters) } else { - const QList >& devices = factory->getDevices(); + const QList>& devices = factory->getDevices(); bool anyInstalled = false; for (const shared_ptr& apoInfo : devices) { diff --git a/Editor/guis/DeviceFilterGUIDialog.cpp b/Editor/guis/DeviceFilterGUIDialog.cpp index 05a3003..058ab62 100644 --- a/Editor/guis/DeviceFilterGUIDialog.cpp +++ b/Editor/guis/DeviceFilterGUIDialog.cpp @@ -45,7 +45,7 @@ DeviceFilterGUIDialog::DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterG outputNode->setExpanded(true); QTreeWidgetItem* inputNode = new QTreeWidgetItem(ui->treeWidget, QStringList(tr("Capture devices"))); inputNode->setExpanded(true); - const QList >& devices = factory->getDevices(); + const QList>& devices = factory->getDevices(); for (const shared_ptr& apoInfo : devices) { QStringList values; @@ -99,7 +99,7 @@ QString DeviceFilterGUIDialog::getPattern() { if (pattern != "") pattern += "; "; - shared_ptr apoInfo = item->data(0, Qt::UserRole).value >(); + shared_ptr apoInfo = item->data(0, Qt::UserRole).value>(); pattern += QString::fromStdWString(apoInfo->getDeviceString()); } } @@ -122,7 +122,7 @@ void DeviceFilterGUIDialog::on_showOnlyInstalledCheckBox_toggled(bool checked) for (int j = 0; j < groupItem->childCount(); j++) { QTreeWidgetItem* item = groupItem->child(j); - shared_ptr apoInfo = item->data(0, Qt::UserRole).value >(); + shared_ptr apoInfo = item->data(0, Qt::UserRole).value>(); item->setHidden(item->checkState(0) != Qt::Checked && !apoInfo->isInstalled() && checked); } } diff --git a/Editor/guis/DeviceFilterGUIFactory.cpp b/Editor/guis/DeviceFilterGUIFactory.cpp index 772da38..39ac78c 100644 --- a/Editor/guis/DeviceFilterGUIFactory.cpp +++ b/Editor/guis/DeviceFilterGUIFactory.cpp @@ -53,7 +53,7 @@ IFilterGUI* DeviceFilterGUIFactory::createFilterGUI(QString& command, QString& p return result; } -const QList >& DeviceFilterGUIFactory::getDevices() const +const QList>& DeviceFilterGUIFactory::getDevices() const { return devices; } diff --git a/Editor/guis/DeviceFilterGUIFactory.h b/Editor/guis/DeviceFilterGUIFactory.h index f8d61ff..246486d 100644 --- a/Editor/guis/DeviceFilterGUIFactory.h +++ b/Editor/guis/DeviceFilterGUIFactory.h @@ -34,8 +34,8 @@ public: QList createFilterTemplates() override; IFilterGUI* createFilterGUI(QString& command, QString& parameters) override; - const QList >& getDevices() const; + const QList>& getDevices() const; private: - QList > devices; + QList> devices; }; diff --git a/Editor/guis/GraphicEQFilterGUIFactory.cpp b/Editor/guis/GraphicEQFilterGUIFactory.cpp index 6cb1fbd..91bfa7c 100644 --- a/Editor/guis/GraphicEQFilterGUIFactory.cpp +++ b/Editor/guis/GraphicEQFilterGUIFactory.cpp @@ -52,7 +52,9 @@ IFilterGUI* GraphicEQFilterGUIFactory::createFilterGUI(QString& command, QString if (command == "GraphicEQ") { GraphicEQFilterFactory factory; - std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); + std::wstring commandWStr = command.toStdWString(); + std::wstring paramWStr = parameters.toStdWString(); + std::vector filters = factory.createFilter(L"", commandWStr, paramWStr); if (!filters.empty()) { GraphicEQFilter* filter = (GraphicEQFilter*)filters[0]; diff --git a/Editor/guis/GraphicEQFilterGUIItem.cpp b/Editor/guis/GraphicEQFilterGUIItem.cpp index 24991ca..a878503 100644 --- a/Editor/guis/GraphicEQFilterGUIItem.cpp +++ b/Editor/guis/GraphicEQFilterGUIItem.cpp @@ -62,7 +62,7 @@ void GraphicEQFilterGUIItem::paint(QPainter* painter, const QStyleOptionGraphics QFontMetrics metrics(font); painter->setFont(font); QString text = QString::number(index + 1); - painter->drawText(-metrics.width(text) / 2, metrics.boundingRect('0').height() / 2, text); + painter->drawText(-metrics.size(0, text).width() / 2, metrics.boundingRect('0').height() / 2, text); } } diff --git a/Editor/guis/PreampFilterGUIFactory.cpp b/Editor/guis/PreampFilterGUIFactory.cpp index 2ebddf5..19dc750 100644 --- a/Editor/guis/PreampFilterGUIFactory.cpp +++ b/Editor/guis/PreampFilterGUIFactory.cpp @@ -35,7 +35,9 @@ IFilterGUI* PreampFilterGUIFactory::createFilterGUI(QString& command, QString& p if (command == "Preamp") { PreampFilterFactory factory; - std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); + std::wstring commandWStr = command.toStdWString(); + std::wstring paramWStr = parameters.toStdWString(); + std::vector filters = factory.createFilter(L"", commandWStr, paramWStr); if (!filters.empty()) { PreampFilter* filter = (PreampFilter*)filters[0]; diff --git a/Editor/guis/VSTPluginFilterGUI.cpp b/Editor/guis/VSTPluginFilterGUI.cpp index c66ebb9..6e7277a 100644 --- a/Editor/guis/VSTPluginFilterGUI.cpp +++ b/Editor/guis/VSTPluginFilterGUI.cpp @@ -433,31 +433,27 @@ void VSTPluginFilterGUI::updatePermissionWarning() { QByteArray bytes = QByteArray::fromBase64(QString::fromStdWString(chunkData).toUtf8()); QString string = QString::fromUtf8(bytes.data(), bytes.length()); - QRegExp regexp("[A-Za-z]:(?:\\\\[\\w \\(\\)-]+)+\\.[A-Za-z]{3}"); - int offset = 0; - while (offset >= 0) + QRegularExpression regexp("[A-Za-z]:(?:\\\\[\\w \\(\\)-]+)+\\.[A-Za-z]{3}"); + QRegularExpressionMatchIterator it = regexp.globalMatch(string); + while (it.hasNext()) { - offset = regexp.indexIn(string, offset); - if (offset >= 0) + QRegularExpressionMatch m = it.next(); + QString path = m.captured(); + QFile file(path); + if (file.exists()) { - QString path = regexp.cap(); - QFile file(path); - if (file.exists()) + ACCESS_MASK mask = GENERIC_READ; + try { - ACCESS_MASK mask = GENERIC_READ; - try - { - mask = RegistryHelper::getFileAccessForUser(path.toStdWString(), SECURITY_LOCAL_SERVICE_RID); - } - catch (RegistryException e) - { - // ignore - } - - if ((mask & GENERIC_READ) != GENERIC_READ && (mask & FILE_GENERIC_READ) != FILE_GENERIC_READ) - files.append(path); + mask = RegistryHelper::getFileAccessForUser(path.toStdWString(), SECURITY_LOCAL_SERVICE_RID); } - offset += regexp.matchedLength(); + catch (RegistryException e) + { + // ignore + } + + if ((mask & GENERIC_READ) != GENERIC_READ && (mask & FILE_GENERIC_READ) != FILE_GENERIC_READ) + files.append(path); } } } diff --git a/Editor/guis/VSTPluginFilterGUIFactory.cpp b/Editor/guis/VSTPluginFilterGUIFactory.cpp index 62a1336..44f2512 100644 --- a/Editor/guis/VSTPluginFilterGUIFactory.cpp +++ b/Editor/guis/VSTPluginFilterGUIFactory.cpp @@ -40,7 +40,9 @@ IFilterGUI* VSTPluginFilterGUIFactory::createFilterGUI(QString& command, QString if (command == "VSTPlugin") { VSTPluginFilterFactory factory; - std::vector filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString()); + std::wstring commandWStr = command.toStdWString(); + std::wstring paramWStr = parameters.toStdWString(); + std::vector filters = factory.createFilter(L"", commandWStr, paramWStr); if (!filters.empty()) { VSTPluginFilter* filter = (VSTPluginFilter*)filters[0]; diff --git a/Editor/main.cpp b/Editor/main.cpp index 43dd62d..449c12e 100644 --- a/Editor/main.cpp +++ b/Editor/main.cpp @@ -47,17 +47,17 @@ int main(int argc, char* argv[]) QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat); QVariant languageValue = settings.value("language"); if (languageValue.isValid()) - QLocale::setDefault(languageValue.toString()); + QLocale::setDefault(QLocale(languageValue.toString())); else QLocale::setDefault(QLocale::system()); QTranslator qtTranslator; - qtTranslator.load(QLocale(), ":/translations/qtbase", "_"); - application.installTranslator(&qtTranslator); + if (qtTranslator.load(QLocale(), ":/translations/qtbase", "_")) + application.installTranslator(&qtTranslator); QTranslator editorTranslator; - editorTranslator.load(QLocale(), ":/translations/Editor", "_"); - application.installTranslator(&editorTranslator); + if (editorTranslator.load(QLocale(), ":/translations/Editor", "_")) + application.installTranslator(&editorTranslator); QString configPath = QDir::currentPath(); if (RegistryHelper::keyExists(APP_REGPATH) && RegistryHelper::valueExists(APP_REGPATH, L"ConfigPath")) @@ -82,7 +82,7 @@ int main(int argc, char* argv[]) if (args.isEmpty() && w.isEmpty()) args = QStringList("config.txt"); - for (QString arg : args) + for (const QString& arg : args) w.load(configDir.absoluteFilePath(arg)); w.doChecks(); diff --git a/Editor/widgets/ChannelGraphItem.cpp b/Editor/widgets/ChannelGraphItem.cpp index a5dc81b..5eda697 100644 --- a/Editor/widgets/ChannelGraphItem.cpp +++ b/Editor/widgets/ChannelGraphItem.cpp @@ -35,7 +35,7 @@ QRectF ChannelGraphItem::boundingRect() const if (cachedRect.isNull()) { QFontMetrics metrics(scene()->font()); - int width = metrics.width(name); + int width = metrics.size(0, name).width(); // we only use upper case characters and digits, so everything is above the baseline int height = metrics.ascent(); // make it at least quadratic diff --git a/Editor/widgets/FrequencyPlotHRuler.cpp b/Editor/widgets/FrequencyPlotHRuler.cpp index 96f7826..6b999bf 100644 --- a/Editor/widgets/FrequencyPlotHRuler.cpp +++ b/Editor/widgets/FrequencyPlotHRuler.cpp @@ -63,7 +63,7 @@ void FrequencyPlotHRuler::paintEvent(QPaintEvent*) text = QString("%0").arg(hz); else text = QString("%0k").arg(hz / 1000); - if (metrics.width(text) + 2 < s->hzToX(hz + hzBase) - x) + if (metrics.size(0, text).width() + 2 < s->hzToX(hz + hzBase) - x) painter.drawText(x - topLeft.x() + offsetLeft + 1, 0, 0, height(), Qt::TextDontClip | Qt::AlignCenter, text); } @@ -125,7 +125,7 @@ void FrequencyPlotHRuler::paintEvent(QPaintEvent*) void FrequencyPlotHRuler::wheelEvent(QWheelEvent* event) { FrequencyPlotView* view = qobject_cast(parentWidget()); - view->zoom(event->angleDelta().y(), 0, event->x() - view->viewportMargins().left(), 0); + view->zoom(event->angleDelta().y(), 0, event->position().x() - view->viewportMargins().left(), 0); } void FrequencyPlotHRuler::mouseMoveEvent(QMouseEvent* event) diff --git a/Editor/widgets/FrequencyPlotVRuler.cpp b/Editor/widgets/FrequencyPlotVRuler.cpp index 96d70cb..4eea62d 100644 --- a/Editor/widgets/FrequencyPlotVRuler.cpp +++ b/Editor/widgets/FrequencyPlotVRuler.cpp @@ -101,5 +101,5 @@ void FrequencyPlotVRuler::wheelEvent(QWheelEvent* event) void FrequencyPlotVRuler::mouseMoveEvent(QMouseEvent* event) { FrequencyPlotView* view = qobject_cast(parentWidget()); - view->setLastMousePos(QPoint(0, min(event->y(), view->viewport()->height() - 1))); + view->setLastMousePos(QPoint(0, fmin(event->y(), view->viewport()->height() - 1))); } diff --git a/Editor/widgets/FrequencyPlotView.cpp b/Editor/widgets/FrequencyPlotView.cpp index 5c6ac9c..ae8460d 100644 --- a/Editor/widgets/FrequencyPlotView.cpp +++ b/Editor/widgets/FrequencyPlotView.cpp @@ -179,7 +179,7 @@ void FrequencyPlotView::wheelEvent(QWheelEvent* event) { event->accept(); int delta = event->angleDelta().y(); - zoom(delta, delta, event->x(), event->y()); + zoom(delta, delta, event->position().x(), event->position().y()); } void FrequencyPlotView::scrollContentsBy(int dx, int dy) diff --git a/Editor/widgets/MiddleClickTabBar.cpp b/Editor/widgets/MiddleClickTabBar.cpp index ece0ee7..42147da 100644 --- a/Editor/widgets/MiddleClickTabBar.cpp +++ b/Editor/widgets/MiddleClickTabBar.cpp @@ -28,7 +28,7 @@ MiddleClickTabBar::MiddleClickTabBar(QWidget* parent) void MiddleClickTabBar::mouseReleaseEvent(QMouseEvent* event) { - if (event->button() == Qt::MidButton) + if (event->button() == Qt::MiddleButton) { int tabIndex = tabAt(event->pos()); if (tabIndex != -1) diff --git a/Editor/widgets/ResizingLineEdit.cpp b/Editor/widgets/ResizingLineEdit.cpp index 8211966..5ed5e55 100644 --- a/Editor/widgets/ResizingLineEdit.cpp +++ b/Editor/widgets/ResizingLineEdit.cpp @@ -40,8 +40,8 @@ QSize ResizingLineEdit::sizeHint() const QSize originalSize = QLineEdit::sizeHint(); QFontMetrics metrics = fontMetrics(); - QSize contentSize(metrics.width(text()), metrics.height()); - QStyleOptionFrameV2 opt; + QSize contentSize(metrics.size(0, text())); + QStyleOptionFrame opt; initStyleOption(&opt); QSize size = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, contentSize, this); diff --git a/EqualizerAPO/EqualizerAPO.vcxproj b/EqualizerAPO/EqualizerAPO.vcxproj index a8e5532..7a3ce92 100644 --- a/EqualizerAPO/EqualizerAPO.vcxproj +++ b/EqualizerAPO/EqualizerAPO.vcxproj @@ -22,7 +22,7 @@ {5AF4EE2B-CC80-4AE5-A786-86FACC0CC649} Win32Proj EqualizerAPO - 10.0.10240.0 + 10.0 @@ -30,28 +30,28 @@ true Unicode false - v120 + v142 DynamicLibrary true Unicode false - v120 + v142 DynamicLibrary false true Unicode - v120 + v142 DynamicLibrary false true Unicode - v120 + v142 @@ -95,11 +95,13 @@ Level3 Disabled WIN32;USE_WINDDK;_DEBUG;_WINDOWS;_USRDLL;EQUALIZERAPO_EXPORTS;%(PreprocessorDefinitions) + stdcpp17 + true Windows true - $(OutDir)Common.lib;muparserxd.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;crypt32.lib;dbghelp.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies) + $(OutDir)Common.lib;muparserxd.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;legacy_stdio_definitions.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;crypt32.lib;dbghelp.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies) EqualizerAPO.def @@ -112,11 +114,13 @@ Level3 Disabled WIN32;USE_WINDDK;_DEBUG;_WINDOWS;_USRDLL;EQUALIZERAPO_EXPORTS;%(PreprocessorDefinitions) + stdcpp17 + true Windows true - $(OutDir)Common.lib;muparserxd.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;crypt32.lib;dbghelp.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies) + $(OutDir)Common.lib;muparserxd.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;legacy_stdio_definitions.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;crypt32.lib;dbghelp.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies) EqualizerAPO.def @@ -132,13 +136,15 @@ true WIN32;USE_WINDDK;NDEBUG;_WINDOWS;_USRDLL;EQUALIZERAPO_EXPORTS;%(PreprocessorDefinitions) Fast + stdcpp17 + true Windows true true true - $(OutDir)Common.lib;muparserx.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;crypt32.lib;dbghelp.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies) + $(OutDir)Common.lib;muparserx.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;legacy_stdio_definitions.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;crypt32.lib;dbghelp.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies) EqualizerAPO.def @@ -151,13 +157,15 @@ true WIN32;USE_WINDDK;NDEBUG;_WINDOWS;_USRDLL;EQUALIZERAPO_EXPORTS;%(PreprocessorDefinitions) Fast + stdcpp17 + true Windows true true true - $(OutDir)Common.lib;muparserx.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;crypt32.lib;dbghelp.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies) + $(OutDir)Common.lib;muparserx.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;legacy_stdio_definitions.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;crypt32.lib;dbghelp.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies) EqualizerAPO.def diff --git a/Setup/Setup.nsi b/Setup/Setup.nsi index 4a0c587..bd63be2 100644 --- a/Setup/Setup.nsi +++ b/Setup/Setup.nsi @@ -1,6 +1,11 @@ +!include "LogicLib.nsh" !include "MUI2.nsh" !include "NSISpcre.nsh" +!include "WinVer.nsh" +;Use ANSI because NSISpcre's Unicode version is less optimized +Unicode false +ManifestDPIAware true ;Use more efficient compression SetCompressor /SOLID lzma @@ -32,12 +37,14 @@ SetCompressor /SOLID lzma Var StartMenuFolder Var OldStartMenuFolder + Var OLDINSTDIR ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING !define MUI_COMPONENTSPAGE_NODESC + !define MUI_WELCOMEPAGE_TITLE_3LINES ;-------------------------------- ;Pages @@ -71,29 +78,47 @@ SetCompressor /SOLID lzma ;Macros !macro RenameAndDelete path - IfFileExists "${path}" 0 +3 + ${If} ${FileExists} "${path}" Rename "${path}" "${path}.old" Delete /REBOOTOK "${path}.old" + ${EndIf} !macroend + +LangString UCRTError ${LANG_ENGLISH} "Your Windows installation is missing required updates to use this program. Please install remaining Windows updates or the Visual C++ Redistributable for Visual Studio 2015 - 2019.$\n$\nDo you want to download the Visual C++ Redistributable now?" +LangString UCRTError ${LANG_GERMAN} "Ihrer Windows-Installation fehlen benötigte Updates, um dieses Programm zu verwenden. Bitte installieren Sie ausstehende Windows-Updates oder das Visual C++ Redistributable für Visual Studio 2015 - 2019.$\n$\nMöchten Sie jetzt das Visual C++ Redistributable herunterladen?" ;-------------------------------- ;Functions Function .onInit - SetRegView 64 + !if ${LIBPATH} == "lib64" + SetRegView 64 + !endif ;Get installation folder from registry if available ReadRegStr $INSTDIR HKLM ${REGPATH} "InstallPath" ;Use default installation folder otherwise - StrCmp $INSTDIR "" 0 +2 + ${If} $INSTDIR == "" StrCpy $INSTDIR "$PROGRAMFILES64\EqualizerAPO" + ${EndIf} !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder ;Try to replace version number in start menu folder ${REReplace} $0 "Equalizer APO [0-9]+\.[0-9]+(?:\.[0-9]+)?" "$StartMenuFolder" "Equalizer APO ${VERSION}" 1 - StrCmp $0 "" +2 0 + ${If} $0 != "" StrCpy $StartMenuFolder "$0" + ${EndIf} Call initCheck + + ${IfNot} ${AtLeastWin10} + System::Call 'KERNEL32::LoadLibrary(t "ucrtbase.dll")p.r0' + ${If} $0 P= 0 + MessageBox MB_YESNO|MB_ICONSTOP $(UCRTError) IDNO skipDownload + ExecShell "open" "${VCREDIST_URL}" + skipDownload: + Abort + ${EndIf} + ${EndIf} FunctionEnd ;-------------------------------- @@ -109,13 +134,17 @@ Section "Install" SecInstall ;Rename before delete as these files may be in use !insertmacro RenameAndDelete "$INSTDIR\EqualizerAPO.dll" - !insertmacro RenameAndDelete "$INSTDIR\libsndfile-1.dll" !insertmacro RenameAndDelete "$INSTDIR\libfftw3f-3.dll" + !insertmacro RenameAndDelete "$INSTDIR\libsndfile-1.dll" !insertmacro RenameAndDelete "$INSTDIR\msvcp100.dll" !insertmacro RenameAndDelete "$INSTDIR\msvcr100.dll" !insertmacro RenameAndDelete "$INSTDIR\msvcp120.dll" !insertmacro RenameAndDelete "$INSTDIR\msvcr120.dll" + !insertmacro RenameAndDelete "$INSTDIR\msvcp140.dll" + !insertmacro RenameAndDelete "$INSTDIR\msvcp140_1.dll" !insertmacro RenameAndDelete "$INSTDIR\VoicemeeterClient.exe" + !insertmacro RenameAndDelete "$INSTDIR\vcruntime140.dll" + !insertmacro RenameAndDelete "$INSTDIR\vcruntime140_1.dll" File "${BINPATH}\EqualizerAPO.dll" File "${BINPATH}\Configurator.exe" @@ -124,22 +153,28 @@ Section "Install" SecInstall File "${BINPATH_EDITOR}\Editor.exe" - File "${LIBPATH}\libsndfile-1.dll" File "${LIBPATH}\libfftw3f-3.dll" - File "${LIBPATH}\msvcp120.dll" - File "${LIBPATH}\msvcr120.dll" + File "${LIBPATH}\libsndfile-1.dll" + File "${LIBPATH}\msvcp140.dll" + File "${LIBPATH}\msvcp140_1.dll" File "${LIBPATH}\Qt5Core.dll" File "${LIBPATH}\Qt5Gui.dll" File "${LIBPATH}\Qt5Widgets.dll" + File "${LIBPATH}\vcruntime140.dll" + !if ${LIBPATH} == "lib64" + File "${LIBPATH}\vcruntime140_1.dll" + !endif CreateDirectory "$INSTDIR\qt" - CreateDirectory "$INSTDIR\qt\platforms" CreateDirectory "$INSTDIR\qt\imageformats" + CreateDirectory "$INSTDIR\qt\platforms" + CreateDirectory "$INSTDIR\qt\styles" - File /oname=qt\platforms\qwindows.dll "${LIBPATH}\qt\platforms\qwindows.dll" File /oname=qt\imageformats\qgif.dll "${LIBPATH}\qt\imageformats\qgif.dll" File /oname=qt\imageformats\qico.dll "${LIBPATH}\qt\imageformats\qico.dll" File /oname=qt\imageformats\qjpeg.dll "${LIBPATH}\qt\imageformats\qjpeg.dll" + File /oname=qt\platforms\qwindows.dll "${LIBPATH}\qt\platforms\qwindows.dll" + File /oname=qt\styles\qwindowsvistastyle.dll "${LIBPATH}\qt\styles\qwindowsvistastyle.dll" File "Configuration tutorial (online).url" File "Configuration reference (online).url" @@ -159,10 +194,21 @@ Section "Install" SecInstall ;Grant write access to the config directory for all users AccessControl::GrantOnFile "$INSTDIR\config" "(S-1-5-32-545)" "FullAccess" + ReadRegStr $OLDINSTDIR HKLM ${REGPATH} "InstallPath" WriteRegStr HKLM ${REGPATH} "InstallPath" "$INSTDIR" - WriteRegStr HKLM ${REGPATH} "ConfigPath" "$INSTDIR\config" - WriteRegStr HKLM ${REGPATH} "EnableTrace" "false" + ;Write ConfigPath if non-existing or if InstallPath has changed + ReadRegStr $0 HKLM ${REGPATH} "ConfigPath" + ${If} $0 == "" + ${OrIf} $INSTDIR != $OLDINSTDIR + WriteRegStr HKLM ${REGPATH} "ConfigPath" "$INSTDIR\config" + ${EndIf} + + ReadRegStr $0 HKLM ${REGPATH} "EnableTrace" + ${If} $0 == "" + WriteRegStr HKLM ${REGPATH} "EnableTrace" "false" + ${EndIf} + WriteUninstaller "$INSTDIR\Uninstall.exe" !insertmacro MUI_STARTMENU_WRITE_BEGIN Application @@ -205,7 +251,9 @@ Section /o un.$(SecRemoveName) SectionEnd Section "-un.Uninstall" - SetRegView 64 + !if ${LIBPATH} == "lib64" + SetRegView 64 + !endif ExecWait '"$INSTDIR\Configurator.exe" /u' @@ -222,14 +270,17 @@ Section "-un.Uninstall" RMDir /r "$INSTDIR\qt" + !if ${LIBPATH} == "lib64" + Delete /REBOOTOK "$INSTDIR\vcruntime140_1.dll" + !endif + Delete /REBOOTOK "$INSTDIR\vcruntime140.dll" Delete "$INSTDIR\Qt5Widgets.dll" Delete "$INSTDIR\Qt5Gui.dll" Delete "$INSTDIR\Qt5Core.dll" - Delete /REBOOTOK "$INSTDIR\msvcr120.dll" - Delete /REBOOTOK "$INSTDIR\msvcp120.dll" - Delete /REBOOTOK "$INSTDIR\libfftw3f-3.dll" + Delete /REBOOTOK "$INSTDIR\msvcp140_1.dll" + Delete /REBOOTOK "$INSTDIR\msvcp140.dll" Delete /REBOOTOK "$INSTDIR\libsndfile-1.dll" - + Delete /REBOOTOK "$INSTDIR\libfftw3f-3.dll" Delete "$INSTDIR\Editor.exe" Delete "$INSTDIR\VoicemeeterClient.exe" diff --git a/Setup/Setup32.nsi b/Setup/Setup32.nsi index 351f8ba..9fff8f6 100644 --- a/Setup/Setup32.nsi +++ b/Setup/Setup32.nsi @@ -1,7 +1,8 @@ !define BINPATH "..\Release" -!define BINPATH_EDITOR "..\build-Editor-Desktop_Qt_5_7_MSVC2013_32bit-Release\release" +!define BINPATH_EDITOR "..\build-Editor-Desktop_Qt_5_15_2_MSVC2019_32bit\release" !define LIBPATH "lib32" +!define VCREDIST_URL "https://aka.ms/vs/16/release/vc_redist.x86.exe" !include "Setup.nsi" diff --git a/Setup/Setup64.nsi b/Setup/Setup64.nsi index f76b7b3..ad5a2b3 100644 --- a/Setup/Setup64.nsi +++ b/Setup/Setup64.nsi @@ -1,7 +1,8 @@ !define BINPATH "..\x64\Release" -!define BINPATH_EDITOR "..\build-Editor-Desktop_Qt_5_7_MSVC2013_64bit-Release\release" +!define BINPATH_EDITOR "..\build-Editor-Desktop_Qt_5_15_2_MSVC2019_64bit\release" !define LIBPATH "lib64" +!define VCREDIST_URL "https://aka.ms/vs/16/release/vc_redist.x64.exe" !include "Setup.nsi" diff --git a/Setup/lib32/Qt5Core.dll b/Setup/lib32/Qt5Core.dll index d8a12cc..a079953 100644 Binary files a/Setup/lib32/Qt5Core.dll and b/Setup/lib32/Qt5Core.dll differ diff --git a/Setup/lib32/Qt5Gui.dll b/Setup/lib32/Qt5Gui.dll index 2649c00..2e1b7ea 100644 Binary files a/Setup/lib32/Qt5Gui.dll and b/Setup/lib32/Qt5Gui.dll differ diff --git a/Setup/lib32/Qt5Widgets.dll b/Setup/lib32/Qt5Widgets.dll index 14809c0..08bb8d3 100644 Binary files a/Setup/lib32/Qt5Widgets.dll and b/Setup/lib32/Qt5Widgets.dll differ diff --git a/Setup/lib32/libfftw3f-3.dll b/Setup/lib32/libfftw3f-3.dll index ce32bea..b0a053a 100644 Binary files a/Setup/lib32/libfftw3f-3.dll and b/Setup/lib32/libfftw3f-3.dll differ diff --git a/Setup/lib32/libsndfile-1.dll b/Setup/lib32/libsndfile-1.dll index e3aa44e..95ce5bd 100644 Binary files a/Setup/lib32/libsndfile-1.dll and b/Setup/lib32/libsndfile-1.dll differ diff --git a/Setup/lib32/msvcp120.dll b/Setup/lib32/msvcp120.dll deleted file mode 100644 index a237d2d..0000000 Binary files a/Setup/lib32/msvcp120.dll and /dev/null differ diff --git a/Setup/lib32/msvcp140.dll b/Setup/lib32/msvcp140.dll new file mode 100644 index 0000000..8d424d9 Binary files /dev/null and b/Setup/lib32/msvcp140.dll differ diff --git a/Setup/lib32/msvcp140_1.dll b/Setup/lib32/msvcp140_1.dll new file mode 100644 index 0000000..1dcd162 Binary files /dev/null and b/Setup/lib32/msvcp140_1.dll differ diff --git a/Setup/lib32/msvcr120.dll b/Setup/lib32/msvcr120.dll deleted file mode 100644 index 8c36149..0000000 Binary files a/Setup/lib32/msvcr120.dll and /dev/null differ diff --git a/Setup/lib32/qt/imageformats/qgif.dll b/Setup/lib32/qt/imageformats/qgif.dll index c099a18..9d64e5c 100644 Binary files a/Setup/lib32/qt/imageformats/qgif.dll and b/Setup/lib32/qt/imageformats/qgif.dll differ diff --git a/Setup/lib32/qt/imageformats/qico.dll b/Setup/lib32/qt/imageformats/qico.dll index e3320d6..87c4050 100644 Binary files a/Setup/lib32/qt/imageformats/qico.dll and b/Setup/lib32/qt/imageformats/qico.dll differ diff --git a/Setup/lib32/qt/imageformats/qjpeg.dll b/Setup/lib32/qt/imageformats/qjpeg.dll index d5d2feb..d00410e 100644 Binary files a/Setup/lib32/qt/imageformats/qjpeg.dll and b/Setup/lib32/qt/imageformats/qjpeg.dll differ diff --git a/Setup/lib32/qt/platforms/qwindows.dll b/Setup/lib32/qt/platforms/qwindows.dll index 244dc1f..cc19e2e 100644 Binary files a/Setup/lib32/qt/platforms/qwindows.dll and b/Setup/lib32/qt/platforms/qwindows.dll differ diff --git a/Setup/lib32/qt/styles/qwindowsvistastyle.dll b/Setup/lib32/qt/styles/qwindowsvistastyle.dll new file mode 100644 index 0000000..bfa8388 Binary files /dev/null and b/Setup/lib32/qt/styles/qwindowsvistastyle.dll differ diff --git a/Setup/lib32/vcruntime140.dll b/Setup/lib32/vcruntime140.dll new file mode 100644 index 0000000..855ca3a Binary files /dev/null and b/Setup/lib32/vcruntime140.dll differ diff --git a/Setup/lib64/Qt5Core.dll b/Setup/lib64/Qt5Core.dll index 08b77fa..4f71838 100644 Binary files a/Setup/lib64/Qt5Core.dll and b/Setup/lib64/Qt5Core.dll differ diff --git a/Setup/lib64/Qt5Gui.dll b/Setup/lib64/Qt5Gui.dll index a8ba0e9..a64eeba 100644 Binary files a/Setup/lib64/Qt5Gui.dll and b/Setup/lib64/Qt5Gui.dll differ diff --git a/Setup/lib64/Qt5Widgets.dll b/Setup/lib64/Qt5Widgets.dll index 393db95..d154e8e 100644 Binary files a/Setup/lib64/Qt5Widgets.dll and b/Setup/lib64/Qt5Widgets.dll differ diff --git a/Setup/lib64/libfftw3f-3.dll b/Setup/lib64/libfftw3f-3.dll index ba8bd07..32a3fcf 100644 Binary files a/Setup/lib64/libfftw3f-3.dll and b/Setup/lib64/libfftw3f-3.dll differ diff --git a/Setup/lib64/libsndfile-1.dll b/Setup/lib64/libsndfile-1.dll index 5c92b95..9817e8b 100644 Binary files a/Setup/lib64/libsndfile-1.dll and b/Setup/lib64/libsndfile-1.dll differ diff --git a/Setup/lib64/msvcp120.dll b/Setup/lib64/msvcp120.dll deleted file mode 100644 index 4ea1efa..0000000 Binary files a/Setup/lib64/msvcp120.dll and /dev/null differ diff --git a/Setup/lib64/msvcp140.dll b/Setup/lib64/msvcp140.dll new file mode 100644 index 0000000..5e5117a Binary files /dev/null and b/Setup/lib64/msvcp140.dll differ diff --git a/Setup/lib64/msvcp140_1.dll b/Setup/lib64/msvcp140_1.dll new file mode 100644 index 0000000..c6ab9fc Binary files /dev/null and b/Setup/lib64/msvcp140_1.dll differ diff --git a/Setup/lib64/msvcr120.dll b/Setup/lib64/msvcr120.dll deleted file mode 100644 index d711c92..0000000 Binary files a/Setup/lib64/msvcr120.dll and /dev/null differ diff --git a/Setup/lib64/qt/imageformats/qgif.dll b/Setup/lib64/qt/imageformats/qgif.dll index a5d3805..1e35942 100644 Binary files a/Setup/lib64/qt/imageformats/qgif.dll and b/Setup/lib64/qt/imageformats/qgif.dll differ diff --git a/Setup/lib64/qt/imageformats/qico.dll b/Setup/lib64/qt/imageformats/qico.dll index bc7fd0b..c74b057 100644 Binary files a/Setup/lib64/qt/imageformats/qico.dll and b/Setup/lib64/qt/imageformats/qico.dll differ diff --git a/Setup/lib64/qt/imageformats/qjpeg.dll b/Setup/lib64/qt/imageformats/qjpeg.dll index dc3d73d..7ed9e20 100644 Binary files a/Setup/lib64/qt/imageformats/qjpeg.dll and b/Setup/lib64/qt/imageformats/qjpeg.dll differ diff --git a/Setup/lib64/qt/platforms/qwindows.dll b/Setup/lib64/qt/platforms/qwindows.dll index 3dc2320..7ffb092 100644 Binary files a/Setup/lib64/qt/platforms/qwindows.dll and b/Setup/lib64/qt/platforms/qwindows.dll differ diff --git a/Setup/lib64/qt/styles/qwindowsvistastyle.dll b/Setup/lib64/qt/styles/qwindowsvistastyle.dll new file mode 100644 index 0000000..8baff56 Binary files /dev/null and b/Setup/lib64/qt/styles/qwindowsvistastyle.dll differ diff --git a/Setup/lib64/vcruntime140.dll b/Setup/lib64/vcruntime140.dll new file mode 100644 index 0000000..fe4d49f Binary files /dev/null and b/Setup/lib64/vcruntime140.dll differ diff --git a/Setup/lib64/vcruntime140_1.dll b/Setup/lib64/vcruntime140_1.dll new file mode 100644 index 0000000..b8dfdf5 Binary files /dev/null and b/Setup/lib64/vcruntime140_1.dll differ diff --git a/VoicemeeterAPOInfo.cpp b/VoicemeeterAPOInfo.cpp index 0771436..77f7b81 100644 --- a/VoicemeeterAPOInfo.cpp +++ b/VoicemeeterAPOInfo.cpp @@ -38,7 +38,7 @@ static const wchar_t* clientFilename = L"VoicemeeterClient.exe"; static const wchar_t* voicemeeterClientKeyPath = USER_REGPATH L"\\Voicemeeter Client"; static const wchar_t* sampleRateValueName = L"sampleRate"; -typedef NTSTATUS (NTAPI* pfnNtQueryInformationProcess)( +typedef NTSTATUS (NTAPI * pfnNtQueryInformationProcess)( IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, @@ -46,7 +46,7 @@ typedef NTSTATUS (NTAPI* pfnNtQueryInformationProcess)( OUT PULONG ReturnLength OPTIONAL ); -void VoicemeeterAPOInfo::prependInfos(vector >& list) +void VoicemeeterAPOInfo::prependInfos(vector>& list) { wstring voicemeeterDirectory; if (RegistryHelper::keyExists(voicemeeterKeyPath)) diff --git a/VoicemeeterAPOInfo.h b/VoicemeeterAPOInfo.h index 58041bd..2dcd574 100644 --- a/VoicemeeterAPOInfo.h +++ b/VoicemeeterAPOInfo.h @@ -27,7 +27,7 @@ class VoicemeeterAPOInfo : public AbstractAPOInfo { public: - static void prependInfos(std::vector >& list); + static void prependInfos(std::vector>& list); VoicemeeterAPOInfo(const std::wstring& connectionName, bool voicemeeterInstalled); diff --git a/VoicemeeterClient/VoicemeeterClient.vcxproj b/VoicemeeterClient/VoicemeeterClient.vcxproj index 5719dd2..97788fe 100644 --- a/VoicemeeterClient/VoicemeeterClient.vcxproj +++ b/VoicemeeterClient/VoicemeeterClient.vcxproj @@ -22,31 +22,32 @@ {10F1DD37-EA50-46C2-810D-D01A1A0D4D2F} Win32Proj VoicemeeterClient + 10.0 Application true - v120 + v142 Unicode Application true - v120 + v142 Unicode Application false - v120 + v142 true Unicode Application false - v120 + v142 true Unicode @@ -92,6 +93,8 @@ Level3 Disabled WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + stdcpp17 + true Windows @@ -105,6 +108,8 @@ Level3 Disabled WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + stdcpp17 + true Windows @@ -121,6 +126,8 @@ true WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) Fast + stdcpp17 + true Windows @@ -139,6 +146,8 @@ true WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) Fast + stdcpp17 + true Windows diff --git a/build.bat b/build.bat index b9644f7..0b3b857 100644 --- a/build.bat +++ b/build.bat @@ -1,22 +1,23 @@ -call "%VS120COMNTOOLS%\vsvars32.bat" -msbuild EqualizerAPO.sln /p:Configuration=release /p:platform=win32 /t:rebuild +FOR /F "tokens=*" %%g IN ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -products * -property installationPath') do (SET vspath=%%g) +call "%vspath%\Common7\Tools\VsDevCmd.bat" +msbuild EqualizerAPO.sln /p:Configuration=release /p:platform=win32 /t:rebuild /m if %ERRORLEVEL% GEQ 1 goto done -msbuild EqualizerAPO.sln /p:Configuration=release /p:platform=x64 /t:rebuild +msbuild EqualizerAPO.sln /p:Configuration=release /p:platform=x64 /t:rebuild /m if %ERRORLEVEL% GEQ 1 goto done -if not exist build-Editor-Desktop_Qt_5_7_MSVC2013_32bit-Release mkdir build-Editor-Desktop_Qt_5_7_MSVC2013_32bit-Release -cd build-Editor-Desktop_Qt_5_7_MSVC2013_32bit-Release -call "%VCINSTALLDIR%vcvarsall.bat" x86 -"C:\Qt\5.7\msvc2013\bin\qmake.exe" ..\Editor\Editor.pro -r -spec win32-msvc2013 "CONFIG+=release" +if not exist build-Editor-Desktop_Qt_5_15_2_MSVC2019_32bit mkdir build-Editor-Desktop_Qt_5_15_2_MSVC2019_32bit +cd build-Editor-Desktop_Qt_5_15_2_MSVC2019_32bit +call "%vspath%\VC\Auxiliary\Build\vcvarsall.bat" x86 +"C:\Qt\5.15.2\msvc2019\bin\qmake.exe" ..\Editor\Editor.pro -r "CONFIG+=release" "C:\Qt\Tools\QtCreator\bin\jom.exe" clean "C:\Qt\Tools\QtCreator\bin\jom.exe" if %ERRORLEVEL% GEQ 1 goto done cd.. -if not exist build-Editor-Desktop_Qt_5_7_MSVC2013_64bit-Release mkdir build-Editor-Desktop_Qt_5_7_MSVC2013_64bit-Release -cd build-Editor-Desktop_Qt_5_7_MSVC2013_64bit-Release -call "%VCINSTALLDIR%vcvarsall.bat" amd64 -"C:\Qt\5.7\msvc2013_64\bin\qmake.exe" ..\Editor\Editor.pro -r -spec win32-msvc2013 "CONFIG+=release" +if not exist build-Editor-Desktop_Qt_5_15_2_MSVC2019_64bit mkdir build-Editor-Desktop_Qt_5_15_2_MSVC2019_64bit +cd build-Editor-Desktop_Qt_5_15_2_MSVC2019_64bit +call "%vspath%\VC\Auxiliary\Build\vcvarsall.bat" amd64 +"C:\Qt\5.15.2\msvc2019_64\bin\qmake.exe" ..\Editor\Editor.pro -r "CONFIG+=release" "C:\Qt\Tools\QtCreator\bin\jom.exe" clean "C:\Qt\Tools\QtCreator\bin\jom.exe" if %ERRORLEVEL% GEQ 1 goto done diff --git a/filters/BiQuadFilter.h b/filters/BiQuadFilter.h index 84b362f..2b4b55e 100644 --- a/filters/BiQuadFilter.h +++ b/filters/BiQuadFilter.h @@ -27,8 +27,8 @@ class BiQuadFilter : public IFilter { public: BiQuadFilter(BiQuad::Type type, double dbGain, double freq, double bandwidthOrQOrS, bool isBandwidthOrS, bool isCornerFreq); - virtual~BiQuadFilter(); - bool getInPlace() override{return true;} + virtual ~BiQuadFilter(); + bool getInPlace() override {return true;} std::vector initialize(float sampleRate, unsigned maxFrameCount, std::vector channelNames) override; void process(float** output, float** input, unsigned frameCount) override; diff --git a/filters/DeviceFilterFactory.cpp b/filters/DeviceFilterFactory.cpp index f62f9b9..55c13a4 100644 --- a/filters/DeviceFilterFactory.cpp +++ b/filters/DeviceFilterFactory.cpp @@ -79,7 +79,7 @@ bool DeviceFilterFactory::matchDevice(const std::wstring& deviceString, const st { wstring value = StringHelper::trim(pattern) + L";"; - vector > fullList; + vector> fullList; vector currentList; wstring currentWord; diff --git a/filters/loudnessCorrection/LoudnessCorrectionFilterFactory.h b/filters/loudnessCorrection/LoudnessCorrectionFilterFactory.h index ca68531..d257b4c 100644 --- a/filters/loudnessCorrection/LoudnessCorrectionFilterFactory.h +++ b/filters/loudnessCorrection/LoudnessCorrectionFilterFactory.h @@ -20,7 +20,6 @@ #pragma once #include -#include #include "IFilterFactory.h" #include "IFilter.h" diff --git a/filters/loudnessCorrection/ParameterArchive.h b/filters/loudnessCorrection/ParameterArchive.h index a65211d..c6c930d 100644 --- a/filters/loudnessCorrection/ParameterArchive.h +++ b/filters/loudnessCorrection/ParameterArchive.h @@ -26,7 +26,7 @@ template struct to_WString_type_traits { - static inline std::wstring cast_ToWString(type& input) {return std::wstring();} + static inline std::wstring cast_ToWString(const type& input) {return std::wstring();} }; template<> struct to_WString_type_traits @@ -41,12 +41,12 @@ template<> struct to_WString_type_traits template<> struct to_WString_type_traits { - static inline std::wstring cast_ToWString(const int& input) {return std::to_wstring((_Longlong)input);} + static inline std::wstring cast_ToWString(const int& input) {return std::to_wstring((long long)input);} }; template<> struct to_WString_type_traits { - static inline std::wstring cast_ToWString(const bool& input) {return std::to_wstring((_Longlong)input);} + static inline std::wstring cast_ToWString(const bool& input) {return std::to_wstring((long long)input);} }; template<> struct to_WString_type_traits @@ -99,7 +99,7 @@ template<> struct constructor_traits static inline std::wstring initFrom(std::wstring input) {return input;} }; -template<> struct constructor_traits > +template<> struct constructor_traits> { static inline std::wstring initFrom(std::vector input) { diff --git a/filters/loudnessCorrection/VolumeController.cpp b/filters/loudnessCorrection/VolumeController.cpp index 78c1db0..c9ff722 100644 --- a/filters/loudnessCorrection/VolumeController.cpp +++ b/filters/loudnessCorrection/VolumeController.cpp @@ -49,7 +49,7 @@ HRESULT VolumeController::getVolume(float& currentVolume) HRESULT VolumeController::setVolume(float volume) { - volume = min(volume, _maxVol); - volume = max(volume, _minVol); + volume = fmin(volume, _maxVol); + volume = fmax(volume, _minVol); return _endpointVolume->SetMasterVolumeLevel(volume, NULL); -} \ No newline at end of file +} diff --git a/helpers/VSTPluginInstance.cpp b/helpers/VSTPluginInstance.cpp index 547c0cf..31ae8bf 100644 --- a/helpers/VSTPluginInstance.cpp +++ b/helpers/VSTPluginInstance.cpp @@ -19,6 +19,7 @@ #include "stdafx.h" #include +#include #include "StringHelper.h" #include "version.h" #include "VSTPluginLibrary.h" @@ -32,7 +33,7 @@ static intptr_t callback(AEffect* effect, int32_t opcode, int32_t index, intptr_ { VSTPluginInstance* instance = effect != NULL ? (VSTPluginInstance*)effect->user : NULL; #ifdef _DEBUG - printf("vst: %p opcode: %d index: %d value: %d ptr: %p opt: %f user: %p\n", + printf("vst: %p opcode: %d index: %d value: %" PRIdPTR " ptr: %p opt: %f user: %p\n", effect, opcode, index, value, ptr, opt, effect != NULL ? effect->user : NULL); fflush(stdout); #endif @@ -59,10 +60,10 @@ static intptr_t callback(AEffect* effect, int32_t opcode, int32_t index, intptr_ return 0; case audioMasterNeedIdle: - return effect->dispatcher(effect, effIdle, 0, 0, NULL, 0.0f); + return effect != NULL ? effect->dispatcher(effect, effIdle, 0, 0, NULL, 0.0f) : 0; case audioMasterUpdateDisplay: - return effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f); + return effect != NULL ? effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f) : 0; case audioMasterGetTime: return 0; @@ -199,6 +200,7 @@ std::wstring VSTPluginInstance::getName() const char buf[256]; memset(buf, 0, sizeof(buf)); effect->dispatcher(effect, effGetEffectName, 0, 0, buf, 0.0f); + buf[255] = '\0'; // just to be sure return StringHelper::toWString(buf, CP_UTF8); } @@ -271,6 +273,7 @@ void VSTPluginInstance::writeToEffect(const std::wstring& chunkData, const std:: { char buf[256]; effect->dispatcher(effect, effGetParamName, i, 0, buf, 0.0f); + buf[255] = '\0'; // just to be sure wstring name = StringHelper::toWString(buf, CP_UTF8); auto it = paramMap.find(name); if (it != paramMap.end()) @@ -291,7 +294,7 @@ void VSTPluginInstance::readFromEffect(std::wstring& chunkData, std::unordered_m { BYTE* chunk = NULL; int size = (int)effect->dispatcher(effect, effGetChunk, 1, 0, &chunk, 0.0f); - DWORD stringLength; + DWORD stringLength = 0; CryptBinaryToStringW(chunk, size, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, NULL, &stringLength); wchar_t* string = new wchar_t[stringLength]; if (CryptBinaryToStringW(chunk, size, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, string, &stringLength) == TRUE) @@ -304,6 +307,7 @@ void VSTPluginInstance::readFromEffect(std::wstring& chunkData, std::unordered_m { char buf[256]; effect->dispatcher(effect, effGetParamName, i, 0, buf, 0.0f); + buf[255] = '\0'; // just to be sure float value = effect->getParameter(effect, i); paramMap[StringHelper::toWString(buf, CP_UTF8)] = value; } diff --git a/helpers/VSTPluginInstance.h b/helpers/VSTPluginInstance.h index 720863e..11ba62b 100644 --- a/helpers/VSTPluginInstance.h +++ b/helpers/VSTPluginInstance.h @@ -68,11 +68,11 @@ public: private: std::shared_ptr library; - AEffect* effect; + AEffect* effect = NULL; std::function automateFunc; std::function sizeWindowFunc; float sampleRate = 0.0f; - int usedChannelCount; + int usedChannelCount = -1; int processLevel = 0; int language = 1; }; diff --git a/helpers/VSTPluginLibrary.cpp b/helpers/VSTPluginLibrary.cpp index 2429eac..4197a9a 100644 --- a/helpers/VSTPluginLibrary.cpp +++ b/helpers/VSTPluginLibrary.cpp @@ -24,7 +24,7 @@ using namespace std; -std::unordered_map > VSTPluginLibrary::instanceMap; +std::unordered_map> VSTPluginLibrary::instanceMap; std::wstring VSTPluginLibrary::defaultPluginPath; std::shared_ptr VSTPluginLibrary::getInstance(const wstring& libPath) diff --git a/helpers/VSTPluginLibrary.h b/helpers/VSTPluginLibrary.h index 1c332ba..11a4c9b 100644 --- a/helpers/VSTPluginLibrary.h +++ b/helpers/VSTPluginLibrary.h @@ -43,7 +43,7 @@ protected: private: VSTPluginLibrary(const std::wstring& libPath); - static std::unordered_map > instanceMap; + static std::unordered_map> instanceMap; static std::wstring defaultPluginPath; std::wstring libPath; }; diff --git a/parser/RegistryFunctions.cpp b/parser/RegistryFunctions.cpp index 5ad1eb9..184e1d6 100644 --- a/parser/RegistryFunctions.cpp +++ b/parser/RegistryFunctions.cpp @@ -85,7 +85,7 @@ void ReadRegDWORDFunction::Eval(ptr_val_type& ret, const ptr_val_type* arg, int { unsigned long value = RegistryHelper::readDWORDValue(key, valuename); - *ret = (long)value; + *ret = (int)value; engine->watchRegistryKey(key); } diff --git a/parser/RegistryFunctions.h b/parser/RegistryFunctions.h index 27834e1..6d40e45 100644 --- a/parser/RegistryFunctions.h +++ b/parser/RegistryFunctions.h @@ -28,7 +28,7 @@ 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; - const mup::char_type* GetDesc() const; + const mup::char_type* GetDesc() const override; mup::IToken* Clone() const override; private: @@ -40,7 +40,7 @@ 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; - const mup::char_type* GetDesc() const; + const mup::char_type* GetDesc() const override; mup::IToken* Clone() const override; private: diff --git a/reformat.bat b/reformat.bat index 3013863..e2cd52a 100644 --- a/reformat.bat +++ b/reformat.bat @@ -2,7 +2,7 @@ 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) || (Echo "%%f" | FIND /I "\helpers\aeffectx.h" 1>NUL) || (Echo "%%f" | FIND /I "\helpers\UncaughtExceptions.h" 1>NUL) || (Echo "%%f" | FIND /I "\VoicemeeterClient\VoicemeeterRemote.h" 1>NUL) || ( - uncrustify -c uncrustify.cfg -l CPP --no-backup "%%f" + uncrustify -c uncrustify.cfg -l CPP --replace --no-backup "%%f" ) ) diff --git a/stdafx.cpp b/stdafx.cpp index 1577c4e..98b0d93 100644 --- a/stdafx.cpp +++ b/stdafx.cpp @@ -1 +1,20 @@ +/* + This file is part of Equalizer APO, a system-wide equalizer. + Copyright (C) 2017 Jonas Thedering + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + #include "stdafx.h" \ No newline at end of file diff --git a/stdafx.h b/stdafx.h index 1433b86..ef8aba7 100644 --- a/stdafx.h +++ b/stdafx.h @@ -1,3 +1,22 @@ +/* + This file is part of Equalizer APO, a system-wide equalizer. + Copyright (C) 2017 Jonas Thedering + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + #define _USE_MATH_DEFINES #include #include diff --git a/uncrustify.cfg b/uncrustify.cfg index 5170167..fa570c3 100644 --- a/uncrustify.cfg +++ b/uncrustify.cfg @@ -1,3 +1,4 @@ +# for Uncrustify 0.65 tok_split_gte=false utf8_byte=false utf8_force=false @@ -168,6 +169,7 @@ sp_after_angle=remove sp_angle_paren=remove sp_angle_word=add sp_angle_shift=remove +sp_permit_cpp11_shift=true sp_before_sparen=add sp_inside_sparen=remove sp_inside_sparen_close=remove