summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-02-25 00:50:45 +0000
committerCarl Hetherington <cth@carlh.net>2013-02-25 00:50:45 +0000
commit1ae970dfd86a8c314660379fcbc9c7995778e5b5 (patch)
tree4f913527335895affde57ad1ddf3fc62918d139d /src
parent5702637ee38f0349fd0b7f17f10bda581e795a9d (diff)
Make minimum gain a constant.
Diffstat (limited to 'src')
-rw-r--r--src/wx/audio_plot.cc12
-rw-r--r--src/wx/audio_plot.h2
2 files changed, 9 insertions, 5 deletions
diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc
index d438426c7..1ad07fcce 100644
--- a/src/wx/audio_plot.cc
+++ b/src/wx/audio_plot.cc
@@ -33,6 +33,8 @@ using std::min;
using boost::bind;
using boost::shared_ptr;
+int const AudioPlot::_minimum = -90;
+
AudioPlot::AudioPlot (wxWindow* parent)
: wxPanel (parent)
, _channel (0)
@@ -75,12 +77,12 @@ AudioPlot::paint (wxPaintEvent &)
int const width = GetSize().GetWidth();
float const xs = width / float (_analysis->points (_channel));
int const height = GetSize().GetHeight ();
- float const ys = height / 60;
+ float const ys = height / -_minimum;
wxGraphicsPath grid = gc->CreatePath ();
gc->SetFont (gc->CreateFont (*wxSMALL_FONT));
- for (int i = -60; i <= 0; i += 10) {
- int const y = height - (i + 60) * ys;
+ for (int i = _minimum; i <= 0; i += 10) {
+ int const y = height - (i - _minimum) * ys;
grid.MoveToPoint (0, y);
grid.AddLineToPoint (width, y);
gc->DrawText (std_to_wx (String::compose ("%1dB", i)), width - 32, y - 12);
@@ -92,12 +94,12 @@ AudioPlot::paint (wxPaintEvent &)
for (int i = 0; i < AudioPoint::COUNT; ++i) {
path[i] = gc->CreatePath ();
- path[i].MoveToPoint (0, height - (max (_analysis->get_point(_channel, 0)[i], -60.0f) + 60 + _gain) * ys);
+ path[i].MoveToPoint (0, height - (max (_analysis->get_point(_channel, 0)[i], float (_minimum)) - _minimum + _gain) * ys);
}
for (int i = 0; i < _analysis->points(_channel); ++i) {
for (int j = 0; j < AudioPoint::COUNT; ++j) {
- path[j].AddLineToPoint (i * xs, height - (max (_analysis->get_point(_channel, i)[j], -60.0f) + 60 + _gain) * ys);
+ path[j].AddLineToPoint (i * xs, height - (max (_analysis->get_point(_channel, i)[j], float (_minimum)) - _minimum + _gain) * ys);
}
}
diff --git a/src/wx/audio_plot.h b/src/wx/audio_plot.h
index dfc1b18ae..b2ae139d1 100644
--- a/src/wx/audio_plot.h
+++ b/src/wx/audio_plot.h
@@ -39,4 +39,6 @@ private:
int _channel;
/** gain to apply in dB */
float _gain;
+
+ static const int _minimum;
};