From 4aa5b796ba7186892d14e20226d6cef942d0c60d Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 15 Apr 2014 13:06:28 +0200 Subject: Added updatePeakDB. Fixed setGainDB (it was reverse). --- dgedit/player.cc | 5 +++-- dgedit/player.h | 12 ++++++++++++ 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: -- cgit v1.2.3