diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-15 13:06:28 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-15 13:06:28 +0200 |
commit | 4aa5b796ba7186892d14e20226d6cef942d0c60d (patch) | |
tree | fc4613b4983dd4f1ae1eaa95fe702475fe87fc19 /dgedit | |
parent | b16d0b91acba045026fdeab6f9cd43ef9bd7d2c3 (diff) |
Added updatePeakDB. Fixed setGainDB (it was reverse).
Diffstat (limited to 'dgedit')
-rw-r--r-- | dgedit/player.cc | 5 | ||||
-rw-r--r-- | 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: |