Added: Analysis panel which shows the calculated frequency response of the filters for the selected device and channel.

Improved: GUIs of GraphicEQ and Copy command can now be resized
Improved: GraphicEQ GUI can now be zoomed separately in X and Y direction using mouse wheel on rulers. Also now shows values at mouse position.
Fixed: Original APO was not released when E-APO was shutting down, leading to a memory leak.
This commit is contained in:
jthedering committed 2015-11-07 19:00:49 +00:00
1 parent 04d22adb07
commit 0895d84055
49 files changed
+2228 -267

No files matched your search

+50 -6
View File
@@ -17,6 +17,8 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QWheelEvent>
#include "FrequencyPlotView.h"
#include "FrequencyPlotScene.h"
#include "FrequencyPlotVRuler.h"
@@ -29,13 +31,13 @@ FrequencyPlotVRuler::FrequencyPlotVRuler(QWidget *parent) :
void FrequencyPlotVRuler::paintEvent(QPaintEvent*)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
FrequencyPlotView* view = qobject_cast<FrequencyPlotView*>(parentWidget());
FrequencyPlotScene* scene = view->scene();
FrequencyPlotScene* s = view->scene();
QPointF topLeft = view->mapToScene(0, 0);
QPointF bottomRight = view->mapToScene(view->viewport()->width(), view->viewport()->height());
double dbHeight = abs(scene->yToDb(topLeft.y()) - scene->yToDb(bottomRight.y()));
double dbStep = dbHeight / 4;
double dbStep = abs(s->yToDb(0) - s->yToDb(30));
double dbBase = pow(10, floor(log10(dbStep)));
if(dbStep >= 5 * dbBase)
@@ -45,16 +47,58 @@ void FrequencyPlotVRuler::paintEvent(QPaintEvent*)
else
dbStep = dbBase;
double fromDb = floor(scene->yToDb(topLeft.y()) / dbStep) * dbStep;
double toDb = ceil(scene->yToDb(bottomRight.y()) / dbStep) * dbStep;
double fromDb = floor(s->yToDb(topLeft.y()) / dbStep) * dbStep;
double toDb = ceil(s->yToDb(bottomRight.y()) / dbStep) * dbStep;
painter.setPen(QColor(50, 50, 50));
for(double db = toDb; db <= fromDb; db += dbStep)
{
if(abs(db) < 1e-6)
db = 0;
double y = scene->dbToY(db);
double y = s->dbToY(db);
if(y != -1)
painter.drawText(0, y - topLeft.y() - 1, width(), 0, Qt::TextDontClip | Qt::AlignCenter, QString("%0").arg(db));
}
QPoint mousePos = view->getLastMousePos();
if(!mousePos.isNull())
{
QPointF mouseScenePos = view->mapToScene(mousePos);
double db = s->yToDb(mouseScenePos.y());
double y = s->dbToY(db);
if(y != -1)
{
QString text = QString("%0").arg(db, 0, 'f', 1);
QFontMetrics metrics = painter.fontMetrics();
QRectF rect = metrics.boundingRect(text);
float center = y - topLeft.y() - 1;
rect = QRectF(ceil(width() / 2) - ceil(rect.width() / 2) - 2.5, center - rect.height() / 2 + 1, rect.width() + 3, rect.height());
QPainterPath path;
path.addRect(rect);
QPainterPath rightTriangle;
rightTriangle.moveTo(QPoint(rect.right(), center - 2));
rightTriangle.lineTo(QPoint(rect.right(), center + 4));
rightTriangle.lineTo(QPoint(rect.right() + 4, center + 1));
path = path.united(rightTriangle);
painter.setPen(Qt::black);
painter.setBrush(Qt::white);
painter.drawPath(path);
painter.setPen(Qt::blue);
painter.drawText(0, center, width() - 2, 0, Qt::TextDontClip | Qt::AlignCenter, text);
}
}
}
void FrequencyPlotVRuler::wheelEvent(QWheelEvent* event)
{
FrequencyPlotView* view = qobject_cast<FrequencyPlotView*>(parentWidget());
view->zoom(0, event->angleDelta().y(), 0, event->y());
}
void FrequencyPlotVRuler::mouseMoveEvent(QMouseEvent* event)
{
FrequencyPlotView* view = qobject_cast<FrequencyPlotView*>(parentWidget());
view->setLastMousePos(QPoint(0, min(event->y(), view->viewport()->height() - 1)));
}