summaryrefslogtreecommitdiff
path: root/dgedit/volumefader.cc
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2014-04-18 14:57:43 +0200
committerJonas Suhr Christensen <jsc@umbraculum.org>2014-04-18 14:57:43 +0200
commitd4bed772174630a6ef234fd6e7df013dfebec3b1 (patch)
treedf7089899804fc9a658b2ad1dbe034fb65552dbe /dgedit/volumefader.cc
parentaaef1169830abac6d3ece8a378fd09d690c4afbe (diff)
Removed printf.
Diffstat (limited to 'dgedit/volumefader.cc')
-rw-r--r--dgedit/volumefader.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/dgedit/volumefader.cc b/dgedit/volumefader.cc
index c7cb9d0..83a0bbf 100644
--- a/dgedit/volumefader.cc
+++ b/dgedit/volumefader.cc
@@ -44,6 +44,9 @@ VolumeFader::VolumeFader()
lo->addWidget(volslider);
setLayout(lo);
+
+ setVolumeDb(10);
+ setVolumePower(10);
}
VolumeFader::~VolumeFader()
@@ -60,21 +63,22 @@ void VolumeFader::updatePeakPower(double)
}
-void VolumeFader::setVolumeDb(double)
+void VolumeFader::setVolumeDb(double db)
{
-
+ volslider->setValue(db*SCALAR);
}
-void VolumeFader::setVolumePower(double vol)
+void VolumeFader::setVolumePower(double power)
{
-
+ double db = 10 * log10(power);
+ setVolumeDb(db);
}
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));
+// printf("Volume %f db, %f power\n", db, pow(10, db/10));
emit volumeChangedDb(db);
emit volumeChangedPower(power);
}