Version 1.0
Added: Configuration Editor, which allows to edit configurations in a graphical user interface. Contains GUIs for most commands supported by E-APO, but as lines can also be edited directly, all commands can be used. Added: Command "GraphicEQ", which can act as a regular, fixed-band graphic equalizer (via the GUI) but also supports variable bands so that any desired frequency response can be specified. Internally, it is implemented via convolution with a generated IR. Added: Command "Convolution", which allows to convolve the signal with a user-provided impulse response to achieve e.g. equalization or reverberation effects. Improved: Configurator performs checks for registry values that are needed for the operation of E-APO, which may be changed by driver installations, fixing the values if necessary. Improved: Configurator shows which is the default device as a hint to the user.
This commit is contained in:
1 parent
d68b958bc8
commit
b8cdd47f71
284 files changed
+17622
-322
No files matched your search
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
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 distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "GainIterator.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
GainIterator::GainIterator(const vector<FilterNode>& nodes)
|
||||
{
|
||||
this->nodes = nodes;
|
||||
nodeLeft = NULL;
|
||||
nodeRight = NULL;
|
||||
}
|
||||
|
||||
double GainIterator::gainAt(double freq)
|
||||
{
|
||||
if(nodeLeft == NULL && nodeRight == NULL || nodeLeft != NULL && freq < nodeLeft->freq)
|
||||
{
|
||||
FilterNode findNode(freq, 0);
|
||||
vector<FilterNode>::iterator it = lower_bound(nodes.begin(), nodes.end(), findNode);
|
||||
if(it != nodes.begin())
|
||||
nodeLeft = &*(it - 1);
|
||||
if(it != nodes.end())
|
||||
nodeRight = &*it;
|
||||
|
||||
if(nodeLeft != NULL && nodeRight != NULL)
|
||||
{
|
||||
logLeft = log(nodeLeft->freq);
|
||||
logRightMinusLeft = log(nodeRight->freq) - logLeft;
|
||||
}
|
||||
}
|
||||
else if(nodeRight != NULL && freq > nodeRight->freq)
|
||||
{
|
||||
vector<FilterNode>::iterator it = nodes.begin() + (nodeRight - &*nodes.begin());
|
||||
while(it != nodes.end() && freq > it->freq)
|
||||
{
|
||||
it++;
|
||||
}
|
||||
if(it == nodes.end())
|
||||
nodeRight = NULL;
|
||||
else
|
||||
nodeRight = &*it;
|
||||
|
||||
if(it != nodes.begin())
|
||||
nodeLeft = &*(it - 1);
|
||||
|
||||
if(nodeLeft != NULL && nodeRight != NULL)
|
||||
{
|
||||
logLeft = log(nodeLeft->freq);
|
||||
logRightMinusLeft = log(nodeRight->freq) - logLeft;
|
||||
}
|
||||
}
|
||||
|
||||
double dbGain;
|
||||
if(nodeLeft == NULL)
|
||||
{
|
||||
if(nodeRight == NULL)
|
||||
dbGain = 0.0;
|
||||
else
|
||||
dbGain = nodeRight->dbGain;
|
||||
}
|
||||
else if(nodeRight == NULL)
|
||||
{
|
||||
dbGain = nodeLeft->dbGain;
|
||||
}
|
||||
else
|
||||
{
|
||||
double t = (log(freq) - logLeft) / logRightMinusLeft;
|
||||
dbGain = nodeLeft->dbGain + t * (nodeRight->dbGain - nodeLeft->dbGain);
|
||||
}
|
||||
|
||||
return dbGain;
|
||||
}
|
||||
Reference in new issue
Block a user