summaryrefslogtreecommitdiff
path: root/dgedit/volumefader.cc
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2014-04-17 13:56:35 +0200
committerJonas Suhr Christensen <jsc@umbraculum.org>2014-04-17 13:56:35 +0200
commit4b2720ed4f29c2d7c66cf62aa603fa253f49d8df (patch)
treee335d70e71d6d039eaede0ebde4dbd15a6e87836 /dgedit/volumefader.cc
parenta63f2ded039309e109019a089e3d03523b678ae0 (diff)
Added values to signals.
Diffstat (limited to 'dgedit/volumefader.cc')
-rw-r--r--dgedit/volumefader.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/dgedit/volumefader.cc b/dgedit/volumefader.cc
index 9a153a6..c7cb9d0 100644
--- a/dgedit/volumefader.cc
+++ b/dgedit/volumefader.cc
@@ -29,10 +29,20 @@
#include <QSlider>
#include <QVBoxLayout>
+#include <math.h>
+
+#define SCALAR 10
+
VolumeFader::VolumeFader()
{
+ volslider = new QSlider();
+ volslider->setRange(-60 * SCALAR , 10 * SCALAR);
+
+ connect(volslider, SIGNAL(valueChanged(int)), this, SLOT(handleValueChanged()));
+
QVBoxLayout* lo = new QVBoxLayout();
- lo->addWidget(new QSlider());
+ lo->addWidget(volslider);
+
setLayout(lo);
}
@@ -59,3 +69,12 @@ void VolumeFader::setVolumePower(double vol)
{
}
+
+void VolumeFader::handleValueChanged()
+{
+ double db = ((double)volslider->value())/((double)SCALAR);
+ double power = pow(10, db/10);
+// printf("Volume %f db, %f power\n", vol, pow(10, vol/10));
+ emit volumeChangedDb(db);
+ emit volumeChangedPower(power);
+}