X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Faudio_plot.cc;h=16930ffd870ab55724d6753ea0e91eabcb8160ca;hb=a112eeb4d052b1212f94e95efd83a215213da691;hp=69faf127e2db0404fa5192cf9f12d8a74510ec5b;hpb=cfdd68eb5fb0ef8423e860103ad4e5510994f1da;p=dcpomatic.git diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc index 69faf127e..16930ffd8 100644 --- a/src/wx/audio_plot.cc +++ b/src/wx/audio_plot.cc @@ -40,7 +40,6 @@ AudioPlot::AudioPlot (wxWindow* parent) : wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE) , _gain (0) , _smoothing (max_smoothing / 2) - , _message (_("Please wait; audio is being analysed...")) { #ifndef __WXOSX__ SetDoubleBuffered (true); @@ -67,6 +66,8 @@ AudioPlot::AudioPlot (wxWindow* parent) _colours.push_back (wxColour (255, 0, 139)); _colours.push_back (wxColour (139, 0, 255)); + set_analysis (shared_ptr ()); + #if MAX_DCP_AUDIO_CHANNELS != 12 #warning AudioPlot::AudioPlot is expecting the wrong MAX_DCP_AUDIO_CHANNELS #endif @@ -81,14 +82,10 @@ AudioPlot::set_analysis (shared_ptr a) { _analysis = a; - for (int i = 0; i < MAX_DCP_AUDIO_CHANNELS; ++i) { - _channel_visible[i] = false; + if (!a) { + _message = _("Please wait; audio is being analysed..."); } - for (int i = 0; i < AudioPoint::COUNT; ++i) { - _type_visible[i] = false; - } - Refresh (); } @@ -162,7 +159,7 @@ AudioPlot::paint () gc->DrawText (std_to_wx (String::compose ("%1dB", i)), 0, y - (db_label_height / 2)); } - gc->SetPen (*wxLIGHT_GREY_PEN); + gc->SetPen (wxPen (wxColour (200, 200, 200))); gc->StrokePath (grid); gc->DrawText (_("Time"), data_width, metrics.height - metrics.y_origin + db_label_height / 2); @@ -174,7 +171,7 @@ AudioPlot::paint () plot_peak (p, c, metrics); } wxColour const col = _colours[c]; - gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (col.Red(), col.Green(), col.Blue(), col.Alpha() / 2), 1, wxPENSTYLE_SOLID)); + gc->SetPen (wxPen (wxColour (col.Red(), col.Green(), col.Blue(), col.Alpha() / 2), 1, wxPENSTYLE_SOLID)); gc->StrokePath (p); } } @@ -186,7 +183,7 @@ AudioPlot::paint () plot_rms (p, c, metrics); } wxColour const col = _colours[c]; - gc->SetPen (*wxThePenList->FindOrCreatePen (col, 1, wxPENSTYLE_SOLID)); + gc->SetPen (wxPen (col, 1, wxPENSTYLE_SOLID)); gc->StrokePath (p); } } @@ -195,7 +192,7 @@ AudioPlot::paint () axes.MoveToPoint (metrics.db_label_width, 0); axes.AddLineToPoint (metrics.db_label_width, metrics.height - metrics.y_origin); axes.AddLineToPoint (metrics.db_label_width + data_width, metrics.height - metrics.y_origin); - gc->SetPen (*wxBLACK_PEN); + gc->SetPen (wxPen (wxColour (0, 0, 0))); gc->StrokePath (axes); delete gc; @@ -283,7 +280,7 @@ AudioPlot::plot_rms (wxGraphicsPath& path, int channel, Metrics const & metrics) p += pow (*j, 2); } - if (smoothing.size() > 0) { + if (!smoothing.empty ()) { p = sqrt (p / smoothing.size ()); }