Improved: Switched to stricter code formatter (Uncrustify) for better consistency across all source files.
This commit is contained in:
1 parent
a1be4cc70f
commit
57e8158efd
202 files changed
+4595
-4284
No files matched your search
+25
-25
@@ -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;
|
||||
}
|
||||
+17
-17
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+21
-21
@@ -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<wstring> 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<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
{
|
||||
new (biquads + i) BiQuad(type, dbGain, biquadFreq, sampleRate, bandwidthOrQOrS, isBandwidth);
|
||||
new(biquads + i)BiQuad(type, dbGain, biquadFreq, sampleRate, bandwidthOrQOrS, isBandwidth);
|
||||
}
|
||||
|
||||
return channelNames;
|
||||
@@ -65,14 +65,14 @@ vector<wstring> BiQuadFilter::initialize(float sampleRate, unsigned maxFrameCoun
|
||||
#pragma AVRT_CODE_BEGIN
|
||||
void BiQuadFilter::process(float** output, float** input, unsigned frameCount)
|
||||
{
|
||||
for(unsigned i=0; i<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
{
|
||||
BiQuad bq = biquads[i];
|
||||
|
||||
float* inputChannel = input[i];
|
||||
float* outputChannel = output[i];
|
||||
|
||||
for(unsigned j=0; j<frameCount; j++)
|
||||
for (unsigned j = 0; j < frameCount; j++)
|
||||
outputChannel[j] = (float)bq.process(inputChannel[j]);
|
||||
|
||||
bq.removeDenormals();
|
||||
|
||||
+13
-13
@@ -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
|
||||
|
||||
@@ -69,19 +69,19 @@ vector<IFilter*> 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<IFilter*> 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<IFilter*> 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<IFilter*> 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<IFilter*> 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<IFilter*> 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<IFilter*> 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<IFilter*>(0);
|
||||
return vector<IFilter*>(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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
-23
@@ -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<wstring>& words)
|
||||
:words(words)
|
||||
: words(words)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,38 +42,38 @@ vector<wstring> ChannelFilter::initialize(float sampleRate, unsigned maxFrameCou
|
||||
size_t channelCount = channelNames.size();
|
||||
vector<bool> selectedChannels = vector<bool>(channelCount, false);
|
||||
|
||||
for(vector<wstring>::iterator it = words.begin(); it != words.end(); it++)
|
||||
for (vector<wstring>::iterator it = words.begin(); it != words.end(); it++)
|
||||
{
|
||||
wstring currentWord = *it;
|
||||
int channelNr = -1;
|
||||
|
||||
if(currentWord == L"ALL")
|
||||
if (currentWord == L"ALL")
|
||||
selectedChannels = vector<bool>(channelCount, true);
|
||||
else
|
||||
channelNr = ChannelHelper::getChannelIndex(currentWord, channelNames);
|
||||
|
||||
if(channelNr != -1 && channelNr < (int)channelCount)
|
||||
if (channelNr != -1 && channelNr < (int)channelCount)
|
||||
{
|
||||
selectedChannels[channelNr] = true;
|
||||
}
|
||||
}
|
||||
|
||||
vector<wstring> selectedChannelNames;
|
||||
for(unsigned i=0; i<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
{
|
||||
if(selectedChannels[i])
|
||||
if (selectedChannels[i])
|
||||
selectedChannelNames.push_back(channelNames[i]);
|
||||
}
|
||||
|
||||
wstringstream channelNumbers;
|
||||
for(size_t c=0; c<channelCount; c++)
|
||||
for (size_t c = 0; c < channelCount; c++)
|
||||
{
|
||||
if(selectedChannels[c])
|
||||
if (selectedChannels[c])
|
||||
{
|
||||
if(channelNumbers.tellp() > 0)
|
||||
if (channelNumbers.tellp() > 0)
|
||||
channelNumbers << L", ";
|
||||
|
||||
channelNumbers << c+1;
|
||||
channelNumbers << c + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -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
|
||||
|
||||
@@ -30,19 +30,19 @@ vector<IFilter*> ChannelFilterFactory::createFilter(const wstring& configPath, w
|
||||
{
|
||||
ChannelFilter* filter = NULL;
|
||||
|
||||
if(command == L"Channel")
|
||||
if (command == L"Channel")
|
||||
{
|
||||
wstring value = parameters + L" ";
|
||||
|
||||
vector<wstring> words;
|
||||
wstring currentWord;
|
||||
for(unsigned i=0; i<value.length(); i++)
|
||||
for (unsigned i = 0; i < value.length(); i++)
|
||||
{
|
||||
wchar_t c = towupper(value[i]);
|
||||
|
||||
if(c == L' ')
|
||||
if (c == L' ')
|
||||
{
|
||||
if(currentWord.length() > 0)
|
||||
if (currentWord.length() > 0)
|
||||
{
|
||||
words.push_back(currentWord);
|
||||
|
||||
@@ -59,7 +59,7 @@ vector<IFilter*> ChannelFilterFactory::createFilter(const wstring& configPath, w
|
||||
filter = new(mem) ChannelFilter(words);
|
||||
}
|
||||
|
||||
if(filter == NULL)
|
||||
if (filter == NULL)
|
||||
return vector<IFilter*>(0);
|
||||
return vector<IFilter*>(1, filter);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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<wstring> 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<wstring> 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<fileChannelCount; i++)
|
||||
for (unsigned i = 0; i < fileChannelCount; i++)
|
||||
{
|
||||
float* buf = new float[frameCount];
|
||||
float* p = interleavedBuf + i;
|
||||
for(unsigned j=0; j<frameCount; j++)
|
||||
for (unsigned j = 0; j < frameCount; j++)
|
||||
{
|
||||
buf[j] = p[j*fileChannelCount];
|
||||
buf[j] = p[j * fileChannelCount];
|
||||
}
|
||||
|
||||
bufs[i] = buf;
|
||||
}
|
||||
|
||||
filters = (HConvSingle*)MemoryHelper::alloc(sizeof(HConvSingle) * channelCount);
|
||||
for(unsigned i=0; i<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
{
|
||||
hcInitSingle(&filters[i], bufs[i % fileChannelCount], frameCount, maxFrameCount, 1);
|
||||
}
|
||||
|
||||
for(unsigned i=0; i<fileChannelCount; i++)
|
||||
for (unsigned i = 0; i < fileChannelCount; i++)
|
||||
{
|
||||
delete[] bufs[i];
|
||||
delete[]bufs[i];
|
||||
}
|
||||
delete bufs;
|
||||
delete interleavedBuf;
|
||||
@@ -107,10 +107,10 @@ vector<wstring> 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<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
{
|
||||
float* inputChannel = input[i];
|
||||
float* outputChannel = output[i];
|
||||
@@ -125,9 +125,9 @@ void ConvolutionFilter::process(float** output, float** input, unsigned frameCou
|
||||
|
||||
void ConvolutionFilter::cleanup()
|
||||
{
|
||||
if(filters != NULL)
|
||||
if (filters != NULL)
|
||||
{
|
||||
for(unsigned i=0; i<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
hcCloseSingle(&filters[i]);
|
||||
|
||||
MemoryHelper::free(filters);
|
||||
|
||||
+13
-13
@@ -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
|
||||
|
||||
@@ -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,18 +32,18 @@ vector<IFilter*> 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<IFilter*> ConvolutionFilterFactory::createFilter(const wstring& configPat
|
||||
filter = new(mem) ConvolutionFilter(absolutePath);
|
||||
}
|
||||
|
||||
if(filter == NULL)
|
||||
if (filter == NULL)
|
||||
return vector<IFilter*>(0);
|
||||
return vector<IFilter*>(1, filter);
|
||||
}
|
||||
@@ -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
-40
@@ -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<wstring> CopyFilter::initialize(float sampleRate, unsigned maxFrameCount,
|
||||
|
||||
vector<wstring> outChannelNames;
|
||||
|
||||
for(unsigned i=0; i<assignmentCount; i++)
|
||||
for (unsigned i = 0; i < assignmentCount; i++)
|
||||
{
|
||||
InternalAssignment& ia = internalAssignments[i];
|
||||
Assignment& a = assignments[i];
|
||||
|
||||
wstring channelName = a.targetChannel;
|
||||
int channelIndex = ChannelHelper::getChannelIndex(a.targetChannel, channelNames, true);
|
||||
if(channelIndex != -1)
|
||||
if (channelIndex != -1)
|
||||
channelName = channelNames[channelIndex];
|
||||
vector<wstring>::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<ia.sourceCount; j++)
|
||||
for (unsigned j = 0; j < ia.sourceCount; j++)
|
||||
{
|
||||
InternalAssignment::InternalSummand& is = ia.sourceSum[j];
|
||||
Assignment::Summand& s = a.sourceSum[j];
|
||||
|
||||
if(s.channel != L"")
|
||||
if (s.channel != L"")
|
||||
is.channel = ChannelHelper::getChannelIndex(s.channel, channelNames);
|
||||
else
|
||||
is.channel = -1;
|
||||
|
||||
if(s.isDecibel)
|
||||
if (s.isDecibel)
|
||||
is.factor = (float)pow(10.0, s.factor / 20.0);
|
||||
else
|
||||
is.factor = (float)s.factor;
|
||||
@@ -86,18 +86,18 @@ vector<wstring> CopyFilter::initialize(float sampleRate, unsigned maxFrameCount,
|
||||
|
||||
wstringstream stream;
|
||||
stream << "Copying ";
|
||||
for(unsigned i=0; i<assignmentCount; i++)
|
||||
for (unsigned i = 0; i < assignmentCount; i++)
|
||||
{
|
||||
InternalAssignment& ia = internalAssignments[i];
|
||||
if(i > 0)
|
||||
if (i > 0)
|
||||
stream << ", ";
|
||||
stream << L"to channel " << outChannelNames[ia.targetChannel].c_str() << " ";
|
||||
for(unsigned j=0; j<ia.sourceCount; j++)
|
||||
for (unsigned j = 0; j < ia.sourceCount; j++)
|
||||
{
|
||||
InternalAssignment::InternalSummand& is = ia.sourceSum[j];
|
||||
if(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<wstring> CopyFilter::initialize(float sampleRate, unsigned maxFrameCount,
|
||||
#pragma AVRT_CODE_BEGIN
|
||||
void CopyFilter::process(float** output, float** input, unsigned frameCount)
|
||||
{
|
||||
for(unsigned i=0; i<assignmentCount; i++)
|
||||
for (unsigned i = 0; i < assignmentCount; i++)
|
||||
{
|
||||
InternalAssignment& ia = internalAssignments[i];
|
||||
|
||||
if(ia.targetChannel == -1 || ia.sourceCount == 0)
|
||||
if (ia.targetChannel == -1 || ia.sourceCount == 0)
|
||||
continue;
|
||||
|
||||
{
|
||||
InternalAssignment::InternalSummand& is = ia.sourceSum[0];
|
||||
|
||||
if(is.channel == -1)
|
||||
for(unsigned f=0; f<frameCount; f++)
|
||||
if (is.channel == -1)
|
||||
for (unsigned f = 0; f < frameCount; f++)
|
||||
output[ia.targetChannel][f] = is.factor;
|
||||
else if(is.factor == 1.0)
|
||||
else if (is.factor == 1.0)
|
||||
memcpy(output[ia.targetChannel], input[is.channel], frameCount * sizeof(float));
|
||||
else
|
||||
for(unsigned f=0; f<frameCount; f++)
|
||||
for (unsigned f = 0; f < frameCount; f++)
|
||||
output[ia.targetChannel][f] = is.factor * input[is.channel][f];
|
||||
}
|
||||
|
||||
for(unsigned j=1; j<ia.sourceCount; j++)
|
||||
for (unsigned j = 1; j < ia.sourceCount; j++)
|
||||
{
|
||||
InternalAssignment::InternalSummand& is = ia.sourceSum[j];
|
||||
|
||||
if(is.channel == -1)
|
||||
for(unsigned f=0; f<frameCount; f++)
|
||||
if (is.channel == -1)
|
||||
for (unsigned f = 0; f < frameCount; f++)
|
||||
output[ia.targetChannel][f] += is.factor;
|
||||
else if(is.factor == 1.0)
|
||||
for(unsigned f=0; f<frameCount; f++)
|
||||
else if (is.factor == 1.0)
|
||||
for (unsigned f = 0; f < frameCount; f++)
|
||||
output[ia.targetChannel][f] += input[is.channel][f];
|
||||
else
|
||||
for(unsigned f=0; f<frameCount; f++)
|
||||
for (unsigned f = 0; f < frameCount; f++)
|
||||
output[ia.targetChannel][f] += is.factor * input[is.channel][f];
|
||||
}
|
||||
}
|
||||
@@ -151,12 +151,12 @@ void CopyFilter::process(float** output, float** input, unsigned frameCount)
|
||||
|
||||
void CopyFilter::cleanup()
|
||||
{
|
||||
if(internalAssignments != NULL)
|
||||
if (internalAssignments != NULL)
|
||||
{
|
||||
for(unsigned i=0; i<assignmentCount; i++)
|
||||
for (unsigned i = 0; i < assignmentCount; i++)
|
||||
{
|
||||
InternalAssignment& ia = internalAssignments[i];
|
||||
if(ia.sourceSum != NULL)
|
||||
if (ia.sourceSum != NULL)
|
||||
{
|
||||
MemoryHelper::free(ia.sourceSum);
|
||||
ia.sourceSum = NULL;
|
||||
|
||||
+13
-13
@@ -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
|
||||
|
||||
@@ -30,17 +30,17 @@ vector<IFilter*> CopyFilterFactory::createFilter(const wstring& configPath, wstr
|
||||
{
|
||||
CopyFilter* filter = NULL;
|
||||
|
||||
if(command == L"Copy")
|
||||
if (command == L"Copy")
|
||||
{
|
||||
vector<Assignment> assignments;
|
||||
|
||||
vector<wstring> assignmentStrings = StringHelper::split(parameters, L' ');
|
||||
for(vector<wstring>::iterator it=assignmentStrings.begin(); it!=assignmentStrings.end(); it++)
|
||||
for (vector<wstring>::iterator it = assignmentStrings.begin(); it != assignmentStrings.end(); it++)
|
||||
{
|
||||
Assignment assignment;
|
||||
|
||||
vector<wstring> 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<IFilter*> CopyFilterFactory::createFilter(const wstring& configPath, wstr
|
||||
assignment.targetChannel = target;
|
||||
|
||||
vector<wstring> summands = StringHelper::split(source, '+');
|
||||
for(vector<wstring>::iterator it2=summands.begin(); it2!=summands.end(); it2++)
|
||||
for (vector<wstring>::iterator it2 = summands.begin(); it2 != summands.end(); it2++)
|
||||
{
|
||||
vector<wstring> 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<IFilter*> 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<IFilter*> 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<IFilter*> CopyFilterFactory::createFilter(const wstring& configPath, wstr
|
||||
filter = new(mem) CopyFilter(assignments);
|
||||
}
|
||||
|
||||
if(filter == NULL)
|
||||
if (filter == NULL)
|
||||
return vector<IFilter*>(0);
|
||||
return vector<IFilter*>(1, filter);
|
||||
}
|
||||
+13
-13
@@ -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
-22
@@ -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<wstring> 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<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
{
|
||||
buffers[i] = (float*)MemoryHelper::alloc(sizeof(float) * bufferLength);
|
||||
memset(buffers[i], 0, sizeof(float) * bufferLength);
|
||||
@@ -63,13 +63,13 @@ vector<wstring> DelayFilter::initialize(float sampleRate, unsigned maxFrameCount
|
||||
#pragma AVRT_CODE_BEGIN
|
||||
void DelayFilter::process(float** output, float** input, unsigned frameCount)
|
||||
{
|
||||
for(unsigned i=0; i<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
{
|
||||
float* inputChannel = input[i];
|
||||
float* outputChannel = output[i];
|
||||
float* bufferChannel = buffers[i];
|
||||
|
||||
if(bufferLength <= frameCount)
|
||||
if (bufferLength <= frameCount)
|
||||
{
|
||||
memcpy(outputChannel, bufferChannel + bufferOffset, (bufferLength - bufferOffset) * sizeof(float));
|
||||
memcpy(outputChannel + bufferLength - bufferOffset, bufferChannel, bufferOffset * sizeof(float));
|
||||
@@ -78,7 +78,7 @@ void DelayFilter::process(float** output, float** input, unsigned frameCount)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bufferLength < bufferOffset + frameCount)
|
||||
if (bufferLength < bufferOffset + frameCount)
|
||||
{
|
||||
memcpy(outputChannel, bufferChannel + bufferOffset, (bufferLength - bufferOffset) * sizeof(float));
|
||||
memcpy(outputChannel + bufferLength - bufferOffset, bufferChannel, (frameCount - (bufferLength - bufferOffset)) * sizeof(float));
|
||||
@@ -93,7 +93,7 @@ void DelayFilter::process(float** output, float** input, unsigned frameCount)
|
||||
}
|
||||
}
|
||||
|
||||
if(bufferLength <= frameCount)
|
||||
if (bufferLength <= frameCount)
|
||||
bufferOffset = 0;
|
||||
else
|
||||
bufferOffset = (bufferOffset + frameCount) % bufferLength;
|
||||
@@ -102,9 +102,9 @@ void DelayFilter::process(float** output, float** input, unsigned frameCount)
|
||||
|
||||
void DelayFilter::cleanup()
|
||||
{
|
||||
if(buffers != NULL)
|
||||
if (buffers != NULL)
|
||||
{
|
||||
for(unsigned i=0; i<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
MemoryHelper::free(buffers[i]);
|
||||
|
||||
MemoryHelper::free(buffers);
|
||||
|
||||
+13
-13
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -32,9 +32,9 @@ vector<IFilter*> 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<IFilter*> 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<IFilter*> DelayFilterFactory::createFilter(const wstring& configPath, wst
|
||||
}
|
||||
}
|
||||
|
||||
if(filter == NULL)
|
||||
if (filter == NULL)
|
||||
return vector<IFilter*>(0);
|
||||
return vector<IFilter*>(1, filter);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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<IFilter*> DeviceFilterFactory::startOfConfiguration()
|
||||
|
||||
vector<IFilter*> 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<IFilter*> 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<vector<wstring>> fullList;
|
||||
vector<vector<wstring> > fullList;
|
||||
vector<wstring> currentList;
|
||||
wstring currentWord;
|
||||
|
||||
for(unsigned i=0; i<value.length(); i++)
|
||||
for (unsigned i = 0; i < value.length(); i++)
|
||||
{
|
||||
wchar_t c = value[i];
|
||||
if(c == L' ' || c == L';')
|
||||
if (c == L' ' || c == L';')
|
||||
{
|
||||
if(currentWord.length() > 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<fullList.size(); i++)
|
||||
for (unsigned i = 0; i < fullList.size(); i++)
|
||||
{
|
||||
matches = true;
|
||||
|
||||
if(fullList[i].size() == 1 && StringHelper::toLowerCase(fullList[i][0]) == L"all")
|
||||
if (fullList[i].size() == 1 && StringHelper::toLowerCase(fullList[i][0]) == L"all")
|
||||
break;
|
||||
|
||||
for(unsigned j=0; j<fullList[i].size(); j++)
|
||||
for (unsigned j = 0; j < fullList[i].size(); j++)
|
||||
{
|
||||
wstring word = StringHelper::toLowerCase(fullList[i][j]);
|
||||
if(StringHelper::toLowerCase(deviceString).find(word) == -1)
|
||||
if (StringHelper::toLowerCase(deviceString).find(word) == -1)
|
||||
{
|
||||
matches = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(matches)
|
||||
if (matches)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -49,7 +49,7 @@ void ExpressionFilterFactory::initialize(FilterEngine* engine)
|
||||
|
||||
vector<IFilter*> 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<IFilter*>();
|
||||
|
||||
bool inExpression = false;
|
||||
@@ -57,14 +57,14 @@ vector<IFilter*> ExpressionFilterFactory::createFilter(const wstring& configPath
|
||||
|
||||
wstring output;
|
||||
wstring expression;
|
||||
for(unsigned i=0; i<parameters.size(); i++)
|
||||
for (unsigned i = 0; i < parameters.size(); i++)
|
||||
{
|
||||
wchar_t c = parameters[i];
|
||||
if(c == L'`')
|
||||
if (c == L'`')
|
||||
{
|
||||
if(!inExpression)
|
||||
if (!inExpression)
|
||||
{
|
||||
if(lastWasBackslash)
|
||||
if (lastWasBackslash)
|
||||
{
|
||||
output += c;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ vector<IFilter*> ExpressionFilterFactory::createFilter(const wstring& configPath
|
||||
}
|
||||
else
|
||||
{
|
||||
if(lastWasBackslash)
|
||||
if (lastWasBackslash)
|
||||
{
|
||||
expression += c;
|
||||
}
|
||||
@@ -87,14 +87,14 @@ vector<IFilter*> 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<IFilter*> 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<IFilter*> ExpressionFilterFactory::createFilter(const wstring& configPath
|
||||
}
|
||||
else
|
||||
{
|
||||
if(inExpression)
|
||||
if (inExpression)
|
||||
expression += c;
|
||||
else
|
||||
output += c;
|
||||
@@ -126,7 +126,7 @@ vector<IFilter*> ExpressionFilterFactory::createFilter(const wstring& configPath
|
||||
|
||||
parameters = output;
|
||||
|
||||
if(command == L"Eval")
|
||||
if (command == L"Eval")
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -134,13 +134,13 @@ vector<IFilter*> 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());
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+52
-52
@@ -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<FilterNode>& nodes, unsigned filterLength)
|
||||
:nodes(nodes), filterLength(filterLength)
|
||||
: nodes(nodes), filterLength(filterLength)
|
||||
{
|
||||
filters = NULL;
|
||||
}
|
||||
@@ -54,37 +54,37 @@ vector<wstring> 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<filterLength; i++)
|
||||
for (unsigned i = 0; i < filterLength; i++)
|
||||
{
|
||||
double freq = i*1.0*sampleRate/(filterLength * 2);
|
||||
double freq = i * 1.0 * sampleRate / (filterLength * 2);
|
||||
double dbGain = gainIterator.gainAt(freq);
|
||||
float gain = (float)pow(10.0, dbGain / 20.0);
|
||||
|
||||
freqData[i][0] = gain;
|
||||
freqData[i][1] = 0;
|
||||
freqData[2*filterLength-i-1][0] = gain;
|
||||
freqData[2*filterLength-i-1][1] = 0;
|
||||
freqData[2 * filterLength - i - 1][0] = gain;
|
||||
freqData[2 * filterLength - i - 1][1] = 0;
|
||||
}
|
||||
|
||||
mps(timeData, freqData, planForward, planReverse);
|
||||
|
||||
fftwf_execute(planReverse);
|
||||
|
||||
for(unsigned i=0; i<2*filterLength; i++)
|
||||
for (unsigned i = 0; i < 2 * filterLength; i++)
|
||||
{
|
||||
timeData[i][0] /= 2*filterLength;
|
||||
timeData[i][1] /= 2*filterLength;
|
||||
timeData[i][0] /= 2 * filterLength;
|
||||
timeData[i][1] /= 2 * filterLength;
|
||||
}
|
||||
|
||||
for(unsigned i=0; i<filterLength; i++)
|
||||
for (unsigned i = 0; i < filterLength; i++)
|
||||
{
|
||||
float factor=(float)(0.5*(1+cos(2*M_PI*i*1.0/(2*filterLength))));
|
||||
float factor = (float)(0.5 * (1 + cos(2 * M_PI * i * 1.0 / (2 * filterLength))));
|
||||
timeData[i][0] *= factor;
|
||||
timeData[i][1] *= factor;
|
||||
}
|
||||
|
||||
float* buf = new float[filterLength];
|
||||
for(unsigned i=0; i<filterLength; i++)
|
||||
for (unsigned i = 0; i < filterLength; i++)
|
||||
{
|
||||
buf[i] = timeData[i][0];
|
||||
}
|
||||
@@ -95,7 +95,7 @@ vector<wstring> GraphicEQFilter::initialize(float sampleRate, unsigned maxFrameC
|
||||
fftwf_destroy_plan(planReverse);
|
||||
|
||||
filters = (HConvSingle*)MemoryHelper::alloc(sizeof(HConvSingle) * channelCount);
|
||||
for(unsigned i=0; i<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
{
|
||||
hcInitSingle(&filters[i], buf, filterLength, maxFrameCount, 1);
|
||||
}
|
||||
@@ -108,10 +108,10 @@ vector<wstring> 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<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
{
|
||||
float* inputChannel = input[i];
|
||||
float* outputChannel = output[i];
|
||||
@@ -131,9 +131,9 @@ const std::vector<FilterNode>& GraphicEQFilter::getNodes()
|
||||
|
||||
void GraphicEQFilter::cleanup()
|
||||
{
|
||||
if(filters != NULL)
|
||||
if (filters != NULL)
|
||||
{
|
||||
for(unsigned i=0; i<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
hcCloseSingle(&filters[i]);
|
||||
|
||||
MemoryHelper::free(filters);
|
||||
@@ -144,43 +144,43 @@ void GraphicEQFilter::cleanup()
|
||||
// Minimum phase spectrum from coefficients
|
||||
void GraphicEQFilter::mps(fftwf_complex* timeData, fftwf_complex* freqData, fftwf_plan planForward, fftwf_plan planReverse)
|
||||
{
|
||||
double threshold=pow(10.0, -100.0/20.0);
|
||||
float logThreshold=(float)log(threshold);
|
||||
|
||||
for(unsigned i=0; i<filterLength * 2; i++)
|
||||
double threshold = pow(10.0, -100.0 / 20.0);
|
||||
float logThreshold = (float)log(threshold);
|
||||
|
||||
for (unsigned i = 0; i < filterLength * 2; i++)
|
||||
{
|
||||
if(freqData[i][0] < threshold)
|
||||
if (freqData[i][0] < threshold)
|
||||
freqData[i][0] = logThreshold;
|
||||
else
|
||||
freqData[i][0] = log(freqData[i][0]);
|
||||
|
||||
freqData[i][1]=0;
|
||||
|
||||
freqData[i][1] = 0;
|
||||
}
|
||||
|
||||
|
||||
fftwf_execute(planReverse);
|
||||
|
||||
for(unsigned i=0; i<filterLength * 2; i++)
|
||||
|
||||
for (unsigned i = 0; i < filterLength * 2; i++)
|
||||
{
|
||||
timeData[i][0] /= filterLength * 2;
|
||||
timeData[i][1] /= filterLength * 2;
|
||||
}
|
||||
|
||||
for(unsigned i=1; i<filterLength; i++)
|
||||
|
||||
for (unsigned i = 1; i < filterLength; i++)
|
||||
{
|
||||
timeData[i][0] += timeData[filterLength*2 - i][0];
|
||||
timeData[i][1] -= timeData[filterLength*2 - i][1];
|
||||
|
||||
timeData[filterLength*2 - i][0] = 0;
|
||||
timeData[filterLength*2 - i][1] = 0;
|
||||
timeData[i][0] += timeData[filterLength * 2 - i][0];
|
||||
timeData[i][1] -= timeData[filterLength * 2 - i][1];
|
||||
|
||||
timeData[filterLength * 2 - i][0] = 0;
|
||||
timeData[filterLength * 2 - i][1] = 0;
|
||||
}
|
||||
timeData[filterLength][1] *= -1;
|
||||
|
||||
|
||||
fftwf_execute(planForward);
|
||||
|
||||
for(unsigned i=0; i<filterLength * 2; i++)
|
||||
|
||||
for (unsigned i = 0; i < filterLength * 2; i++)
|
||||
{
|
||||
double eR=exp(freqData[i][0]);
|
||||
freqData[i][0]=float(eR*cos(freqData[i][1]));
|
||||
freqData[i][1]=float(eR*sin(freqData[i][1]));
|
||||
double eR = exp(freqData[i][0]);
|
||||
freqData[i][0] = float(eR * cos(freqData[i][1]));
|
||||
freqData[i][1] = float(eR * sin(freqData[i][1]));
|
||||
}
|
||||
}
|
||||
+13
-13
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -34,20 +34,20 @@ vector<IFilter*> 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<FilterNode> 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<IFilter*> GraphicEQFilterFactory::createFilter(const wstring& configPath,
|
||||
filter = new(mem) GraphicEQFilter(nodes, 16384);
|
||||
}
|
||||
|
||||
if(filter == NULL)
|
||||
if (filter == NULL)
|
||||
return vector<IFilter*>(0);
|
||||
return vector<IFilter*>(1, filter);
|
||||
}
|
||||
@@ -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
-33
@@ -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<double>& coefficients)
|
||||
x = NULL;
|
||||
y = NULL;
|
||||
|
||||
double a0 = coefficients[order+1];
|
||||
double a0 = coefficients[order + 1];
|
||||
b0 = coefficients[0] / a0;
|
||||
for(unsigned i=0; i<order; i++)
|
||||
for (unsigned i = 0; i < order; i++)
|
||||
{
|
||||
b[i] = coefficients[i+1] / a0;
|
||||
a[i] = -coefficients[i+order+2] / a0;
|
||||
b[i] = coefficients[i + 1] / a0;
|
||||
a[i] = -coefficients[i + order + 2] / a0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +47,9 @@ IIRFilter::~IIRFilter()
|
||||
MemoryHelper::free(a);
|
||||
MemoryHelper::free(b);
|
||||
|
||||
if(x != NULL)
|
||||
if (x != NULL)
|
||||
MemoryHelper::free(x);
|
||||
if(y != NULL)
|
||||
if (y != NULL)
|
||||
MemoryHelper::free(y);
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ vector<wstring> 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<wstring> IIRFilter::initialize(float sampleRate, unsigned maxFrameCount,
|
||||
#pragma AVRT_CODE_BEGIN
|
||||
void IIRFilter::process(float** output, float** input, unsigned frameCount)
|
||||
{
|
||||
for(unsigned i=0; i<channelCount; i++)
|
||||
for (unsigned i = 0; i < channelCount; i++)
|
||||
{
|
||||
float* inputChannel = input[i];
|
||||
float* outputChannel = output[i];
|
||||
|
||||
unsigned channelOffset = i*order;
|
||||
double* xo = x+channelOffset;
|
||||
double* yo = y+channelOffset;
|
||||
for(unsigned j=0; j<frameCount; j++)
|
||||
unsigned channelOffset = i * order;
|
||||
double* xo = x + channelOffset;
|
||||
double* yo = y + channelOffset;
|
||||
for (unsigned j = 0; j < frameCount; j++)
|
||||
{
|
||||
double sample = inputChannel[j];
|
||||
double sum = b0 * sample;
|
||||
|
||||
for(unsigned k=order-1; k>0; 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<channelCount*order; i++)
|
||||
for (unsigned i = 0; i < channelCount * order; i++)
|
||||
{
|
||||
if(IS_DENORMAL(x[i]))
|
||||
if (IS_DENORMAL(x[i]))
|
||||
x[i] = 0.0;
|
||||
if(IS_DENORMAL(y[i]))
|
||||
if (IS_DENORMAL(y[i]))
|
||||
y[i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -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
|
||||
|
||||
@@ -43,24 +43,24 @@ vector<IFilter*> 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<IFilter*> IIRFilterFactory::createFilter(const wstring& configPath, wstri
|
||||
{
|
||||
found = regex_search(parameters, match, regexCoefficients);
|
||||
|
||||
if(found)
|
||||
if (found)
|
||||
{
|
||||
wstring coefficientsString = match.str(1);
|
||||
vector<wstring> 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<double> 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<IFilter*> IIRFilterFactory::createFilter(const wstring& configPath, wstri
|
||||
}
|
||||
}
|
||||
|
||||
if(filter == NULL)
|
||||
if (filter == NULL)
|
||||
return vector<IFilter*>(0);
|
||||
return vector<IFilter*>(1, filter);
|
||||
}
|
||||
+13
-13
@@ -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
|
||||
|
||||
+38
-38
@@ -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<IFilter*> IfFilterFactory::startOfConfiguration()
|
||||
{
|
||||
trueCount = 0;
|
||||
falseCount = 0;
|
||||
while(!trueCountStack.empty())
|
||||
while (!trueCountStack.empty())
|
||||
trueCountStack.pop();
|
||||
|
||||
return vector<IFilter*>();
|
||||
@@ -48,7 +48,7 @@ std::vector<IFilter*> 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<IFilter*> 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<IFilter*> 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<IFilter*> 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<IFilter*> 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<IFilter*> 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<IFilter*> 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<IFilter*> IfFilterFactory::createFilter(const wstring& configPath, wstrin
|
||||
|
||||
std::vector<IFilter*> 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':
|
||||
{
|
||||
|
||||
+13
-13
@@ -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
|
||||
|
||||
@@ -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<IFilter*> 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';
|
||||
|
||||
@@ -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
|
||||
|
||||
+16
-16
@@ -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<wstring> 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<channelCount; i++)
|
||||
for (size_t i = 0; i < channelCount; i++)
|
||||
{
|
||||
float* sampleChannel = input[i];
|
||||
|
||||
for(unsigned j=0; j<frameCount; j++)
|
||||
for (unsigned j = 0; j < frameCount; j++)
|
||||
sampleChannel[j] *= gain;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -30,14 +30,14 @@ vector<IFilter*> 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<IFilter*> PreampFilterFactory::createFilter(const wstring& configPath, ws
|
||||
}
|
||||
}
|
||||
|
||||
if(filter == NULL)
|
||||
if (filter == NULL)
|
||||
return vector<IFilter*>(0);
|
||||
return vector<IFilter*>(1, filter);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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<IFilter*> StageFilterFactory::startOfConfiguration()
|
||||
{
|
||||
stageMatches = capture || !preMix || !postMixInstalled;
|
||||
while(!stageMatchesStack.empty())
|
||||
while (!stageMatchesStack.empty())
|
||||
stageMatchesStack.pop();
|
||||
|
||||
return vector<IFilter*>();
|
||||
@@ -52,35 +52,35 @@ std::vector<IFilter*> StageFilterFactory::startOfFile(const std::wstring& config
|
||||
|
||||
vector<IFilter*> 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<wstring> 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<IFilter*> 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"";
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user