summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dgedit/player.cc5
-rw-r--r--dgedit/player.h12
2 files changed, 15 insertions, 2 deletions
diff --git a/dgedit/player.cc b/dgedit/player.cc
index a7f09c3..cb6b986 100644
--- a/dgedit/player.cc
+++ b/dgedit/player.cc
@@ -88,17 +88,18 @@ void Player::run()
void Player::setGainScalar(double g)
{
- gain_scalar = g / 10000.0;
+ gain_scalar = g;
}
void Player::setGainDB(double gain_db)
{
- setGainScalar(20*log10(gain_db));
+ setGainScalar(pow(10, gain_db/ 20.0));
}
void Player::reportTimeout()
{
emit peakUpdate(peak);
+ emit peakUpdateDB(20 * log10(peak));
peak = 0.0;
emit positionUpdate(pos);
diff --git a/dgedit/player.h b/dgedit/player.h
index af278f5..0289cd5 100644
--- a/dgedit/player.h
+++ b/dgedit/player.h
@@ -63,7 +63,19 @@ public slots:
void setGainDB(double gain_db);
signals:
+ /**
+ * The absolute maximum of samples seen since last update.
+ */
void peakUpdate(double peak);
+
+ /**
+ * The absolute maximum of samples seen since last update in dB.
+ */
+ void peakUpdateDB(double peak_db);
+
+ /**
+ * The sample position of the player.
+ */
void positionUpdate(size_t position);
private slots: