Attempt #46 to understand MIDI data locking.
[ardour2.git] / gtk2_ardour / latency_gui.h
blob2adf2d430861561ab1d79b6fd3d018f71823dcb2
1 #ifndef __gtk2_ardour_latency_gui_h__
2 #define __gtk2_ardour_latency_gui_h__
4 #include <vector>
5 #include <string>
7 #include <gtkmm/dialog.h>
8 #include <gtkmm/box.h>
9 #include <gtkmm/button.h>
10 #include <gtkmm/adjustment.h>
12 #include <gtkmm2ext/barcontroller.h>
13 #include "pbd/controllable.h"
15 #include "ardour/types.h"
17 #include "ardour_dialog.h"
19 namespace ARDOUR {
20 class Latent;
23 class LatencyGUI;
25 class LatencyBarController : public Gtkmm2ext::BarController
27 public:
28 LatencyBarController (Gtk::Adjustment& adj, LatencyGUI* g)
29 : BarController (adj, boost::shared_ptr<PBD::IgnorableControllable> (new PBD::IgnorableControllable ())),
30 _latency_gui (g) {}
32 private:
33 LatencyGUI* _latency_gui;
35 std::string get_label (double&);
38 class LatencyGUI : public Gtk::VBox
40 public:
41 LatencyGUI (ARDOUR::Latent&, framepos_t sample_rate, framepos_t period_size);
42 ~LatencyGUI() { }
44 void finish ();
45 void reset ();
46 void refresh ();
48 private:
49 ARDOUR::Latent& _latent;
50 framepos_t initial_value;
51 framepos_t sample_rate;
52 framepos_t period_size;
53 boost::shared_ptr<PBD::IgnorableControllable> ignored;
55 Gtk::Adjustment adjustment;
56 LatencyBarController bc;
57 Gtk::HBox hbox1;
58 Gtk::HBox hbox2;
59 Gtk::HButtonBox hbbox;
60 Gtk::Button minus_button;
61 Gtk::Button plus_button;
62 Gtk::Button reset_button;
63 Gtk::ComboBoxText units_combo;
65 void change_latency_from_button (int dir);
67 friend class LatencyBarController;
69 static std::vector<std::string> unit_strings;
72 class LatencyDialog : public ArdourDialog
74 public:
75 LatencyDialog (const std::string& title, ARDOUR::Latent&, framepos_t sample_rate, framepos_t period_size);
76 ~LatencyDialog() {}
78 private:
79 LatencyGUI lwidget;
82 #endif /* __gtk2_ardour_latency_gui_h__ */