provide control over waveform image cache size from GUI
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 23 Jun 2015 12:18:11 +0000 (08:18 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 23 Jun 2015 12:18:11 +0000 (08:18 -0400)
gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/rc_option_editor.cc
gtk2_ardour/ui_config_vars.h

index f63dd46401ee94d3d330853ffe99d795dee24a98..0c59a6621343ec601256785bff69e7207f617ddb 100644 (file)
@@ -425,6 +425,9 @@ ARDOUR_UI::parameter_changed (std::string p)
                ArdourCanvas::WaveView::set_global_show_waveform_clipping (ARDOUR_UI::config()->get_show_waveform_clipping());
        } else if (p == "font-scale") {
                ui_scale = config()->get_font_scale () / 102400.;
+       } else if (p == "waveform-cache-size") {
+               /* GUI option has units of megabytes; image cache uses units of bytes */
+               ArdourCanvas::WaveView::set_image_cache_size (ARDOUR_UI::config()->get_waveform_cache_size() * 1048576);
        }
 }
 
index bb0042cf79ef11bbd9ab952a42259d7ea6d3d781..0fdaaae902a60a0660be12ee3002ba7e33650a2d 100644 (file)
@@ -2697,6 +2697,22 @@ RCOptionEditor::RCOptionEditor ()
                            sigc::mem_fun (*_ui_config, &UIConfiguration::set_super_rapid_clock_update)
                            ));
 
+
+       /* Image cache size */
+
+       Gtk::Adjustment *ics = manage (new Gtk::Adjustment(0, 1, 1024, 10)); /* 1 MB to 1GB in steps of 10MB */
+       HSliderOption *sics = new HSliderOption("waveform-cache-size",
+                                               _("Waveform image cache size (megabytes)"),
+                                               ics,
+                                               sigc::mem_fun (*ARDOUR_UI::config(), &UIConfiguration::get_waveform_cache_size),
+                                               sigc::mem_fun (*ARDOUR_UI::config(), &UIConfiguration::set_waveform_cache_size)
+                       );
+       sics->scale().set_digits (0);
+       Gtkmm2ext::UI::instance()->set_tip
+               (sics->tip_widget(),
+                _("Larger values lead to using more memory to store images of waveforms, which can improve graphical performance."));
+       add_option (S_("Preferences|GUI"), sics);
+       
        /* Lock GUI timeout */
 
        Gtk::Adjustment *lts = manage (new Gtk::Adjustment(0, 0, 1000, 1, 10));
index 7cf96ce7b0e2980841d970242a17a0331957116d..ae6648ab96b5a1fedcd41b9e18027c79fa6e5497 100644 (file)
@@ -72,3 +72,4 @@ UI_CONFIG_VARIABLE (double, waveform_clip_level, "waveform-clip-level", -0.09339
 UI_CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactivates-groups", true)
 UI_CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false)
 UI_CONFIG_VARIABLE (bool, buggy_gradients, "buggy-gradients", false)
+UI_CONFIG_VARIABLE (uint64_t, waveform_cache_size, "waveform-cache-size", 100) /* units of megagbytes */