Add MIDI readahead to options editor.
authorDavid Robillard <d@drobilla.net>
Thu, 5 Mar 2015 23:48:33 +0000 (18:48 -0500)
committerDavid Robillard <d@drobilla.net>
Thu, 5 Mar 2015 23:48:33 +0000 (18:48 -0500)
gtk2_ardour/option_editor.h
gtk2_ardour/rc_option_editor.cc
libs/ardour/butler.cc

index a91c2404fc2f8c5eff337110529ad72b3d47914d..ac768383ee58438f8758e859b6c3ac6ecfc80122 100644 (file)
@@ -506,6 +506,7 @@ public:
         *  @param page Page step for the spin button.
         *  @param unit Unit name.
         *  @param scale Scaling factor (such that for a value x in the spinbutton, x * scale is written to the config)
+        *  @param digits Number of decimal digits to show.
         */
        SpinOption (
                std::string const & i,
@@ -517,7 +518,8 @@ public:
                T step,
                T page,
                std::string const & unit = "",
-               float scale = 1
+               float scale = 1,
+               unsigned digits = 0
                )
                : Option (i, n),
                  _get (g),
@@ -530,6 +532,7 @@ public:
                _spin = Gtk::manage (new Gtk::SpinButton);
                _spin->set_range (min, max);
                _spin->set_increments (step, page);
+               _spin->set_digits(digits);
 
                _box = Gtk::manage (new Gtk::HBox);
                _box->pack_start (*_spin, true, true);
index ef3c66153edbbbb8d7f48162a945677195deb16d..f9b9b3784052bf17bc77c80eba473197ab27cced 100644 (file)
@@ -2066,6 +2066,16 @@ RCOptionEditor::RCOptionEditor ()
                     sigc::mem_fun (*_rc_config, &RCConfiguration::set_link_send_and_route_panner)
                     ));
 
+       add_option (_("MIDI"),
+                   new SpinOption<float> (
+                           "midi-readahead",
+                           _("MIDI read-ahead time (seconds)"),
+                           sigc::mem_fun (*_rc_config, &RCConfiguration::get_midi_readahead),
+                           sigc::mem_fun (*_rc_config, &RCConfiguration::set_midi_readahead),
+                           0.1, 10, 0.1, 1,
+                           "", 1.0, 1
+                           ));
+
        add_option (_("MIDI"),
                    new BoolOption (
                            "send-midi-clock",
index a89e8295d282944723d733d6dc236973ab59c1ad..01c21b45d0f6efde499a0942e6448c325c79a04c 100644 (file)
@@ -65,14 +65,16 @@ Butler::~Butler()
 void
 Butler::config_changed (std::string p)
 {
-        if (p == "playback-buffer-seconds") {
-                /* size is in Samples, not bytes */
-                audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * _session.frame_rate());
-                _session.adjust_playback_buffering ();
-        } else if (p == "capture-buffer-seconds") {
-                audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * _session.frame_rate());
-                _session.adjust_capture_buffering ();
-        }
+       if (p == "playback-buffer-seconds") {
+               /* size is in Samples, not bytes */
+               audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * _session.frame_rate());
+               _session.adjust_playback_buffering ();
+       } else if (p == "capture-buffer-seconds") {
+               audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * _session.frame_rate());
+               _session.adjust_capture_buffering ();
+       } else if (p == "midi-readahead") {
+               MidiDiskstream::set_readahead_frames ((framecnt_t) (Config->get_midi_readahead() * _session.frame_rate()));
+       }
 }
 
 int