X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Faudio_plot.cc;h=b2be40036be74d9d5e591b286d30f95b65cc69ad;hb=293583097f7b25e481f0898f13c62c10aac33719;hp=2a6210164e3a23f66076fc7f1fe063d8ffda7c00;hpb=5859b758e3a6e0191ce12e77b636c7def58bbc3b;p=dcpomatic.git diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc index 2a6210164..b2be40036 100644 --- a/src/wx/audio_plot.cc +++ b/src/wx/audio_plot.cc @@ -37,11 +37,13 @@ int const AudioPlot::_minimum = -70; int const AudioPlot::max_smoothing = 128; AudioPlot::AudioPlot (wxWindow* parent) - : wxPanel (parent) + : wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE) , _gain (0) , _smoothing (max_smoothing / 2) { +#ifndef __WXOSX__ SetDoubleBuffered (true); +#endif for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) { _channel_visible[i] = false; @@ -51,11 +53,11 @@ AudioPlot::AudioPlot (wxWindow* parent) _type_visible[i] = false; } - _colours.push_back (wxColour ( 0, 0, 0)); - _colours.push_back (wxColour (255, 0, 0)); - _colours.push_back (wxColour ( 0, 255, 0)); + _colours.push_back (wxColour ( 0, 0, 0)); + _colours.push_back (wxColour (255, 0, 0)); + _colours.push_back (wxColour ( 0, 255, 0)); _colours.push_back (wxColour (139, 0, 204)); - _colours.push_back (wxColour ( 0, 0, 255)); + _colours.push_back (wxColour ( 0, 0, 255)); _colours.push_back (wxColour (100, 100, 100)); Connect (wxID_ANY, wxEVT_PAINT, wxPaintEventHandler (AudioPlot::paint), 0, this); @@ -145,11 +147,7 @@ AudioPlot::paint (wxPaintEvent &) plot_peak (p, c); } wxColour const col = _colours[c]; -#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9 gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (col.Red(), col.Green(), col.Blue(), col.Alpha() / 2), 1, wxPENSTYLE_SOLID)); -#else - gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (col.Red(), col.Green(), col.Blue(), col.Alpha() / 2), 1, wxSOLID)); -#endif gc->StrokePath (p); } } @@ -161,11 +159,7 @@ AudioPlot::paint (wxPaintEvent &) plot_rms (p, c); } wxColour const col = _colours[c]; -#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9 gc->SetPen (*wxThePenList->FindOrCreatePen (col, 1, wxPENSTYLE_SOLID)); -#else - gc->SetPen (*wxThePenList->FindOrCreatePen (col, 1, wxSOLID)); -#endif gc->StrokePath (p); } } @@ -189,6 +183,10 @@ AudioPlot::y_for_linear (float p) const void AudioPlot::plot_peak (wxGraphicsPath& path, int channel) const { + if (_analysis->points (channel) == 0) { + return; + } + path.MoveToPoint (_db_label_width, y_for_linear (_analysis->get_point(channel, 0)[AudioPoint::PEAK])); float peak = 0; @@ -209,6 +207,10 @@ AudioPlot::plot_peak (wxGraphicsPath& path, int channel) const void AudioPlot::plot_rms (wxGraphicsPath& path, int channel) const { + if (_analysis->points (channel) == 0) { + return; + } + path.MoveToPoint (_db_label_width, y_for_linear (_analysis->get_point(channel, 0)[AudioPoint::RMS])); list smoothing;