Added: Voicemeeter Potato support

Improved: Device strings like "Output A5" no longer accidentally match GUIDs. Now, only strings containing { will match GUIDs.
This commit is contained in:
jthedering committed 2019-06-05 21:15:06 +00:00
1 parent 5a795a2d26
commit 5b886a9e7a
7 files changed
+28 -11

No files matched your search

+7 -1
View File
@@ -18,6 +18,7 @@
*/
#include "stdafx.h"
#include <regex>
#include <mpParser.h>
#include "helpers/LogHelper.h"
#include "helpers/StringHelper.h"
@@ -28,6 +29,8 @@
using namespace std;
static wregex regexGuid(L"\\{[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\}");
#ifndef NO_FILTERENGINE
void DeviceFilterFactory::initialize(FilterEngine* engine)
{
@@ -102,6 +105,8 @@ bool DeviceFilterFactory::matchDevice(const std::wstring& deviceString, const st
}
}
wstring deviceStringNoGuid = regex_replace(deviceString, regexGuid, L"");
bool matches = false;
for (unsigned i = 0; i < fullList.size(); i++)
@@ -114,7 +119,8 @@ bool DeviceFilterFactory::matchDevice(const std::wstring& deviceString, const st
for (unsigned j = 0; j < fullList[i].size(); j++)
{
wstring word = StringHelper::toLowerCase(fullList[i][j]);
if (StringHelper::toLowerCase(deviceString).find(word) == -1)
const wstring& matchString = word.find('{') == wstring::npos ? deviceStringNoGuid : deviceString;
if (StringHelper::toLowerCase(matchString).find(word) == wstring::npos)
{
matches = false;
break;