2 Copyright (C) 2010 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __gtk2_ardour_engine_dialog_h__
21 #define __gtk2_ardour_engine_dialog_h__
27 #include <gtkmm/checkbutton.h>
28 #include <gtkmm/spinbutton.h>
29 #include <gtkmm/comboboxtext.h>
30 #include <gtkmm/table.h>
31 #include <gtkmm/expander.h>
32 #include <gtkmm/box.h>
33 #include <gtkmm/buttonbox.h>
34 #include <gtkmm/button.h>
36 #include "pbd/signals.h"
38 #include "ardour_dialog.h"
40 class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
45 static bool need_setup ();
47 XMLNode& get_state ();
48 void set_state (const XMLNode&);
50 void set_desired_sample_rate (uint32_t);
53 Gtk::Notebook notebook;
55 /* core fields used by all backends */
57 Gtk::ComboBoxText backend_combo;
58 Gtk::ComboBoxText sample_rate_combo;
59 Gtk::ComboBoxText buffer_size_combo;
60 Gtk::Label buffer_size_duration_label;
61 Gtk::Adjustment input_latency_adjustment;
62 Gtk::SpinButton input_latency;
63 Gtk::Adjustment output_latency_adjustment;
64 Gtk::SpinButton output_latency;
65 Gtk::Adjustment input_channels_adjustment;
66 Gtk::SpinButton input_channels;
67 Gtk::Adjustment output_channels_adjustment;
68 Gtk::SpinButton output_channels;
69 Gtk::Adjustment ports_adjustment;
70 Gtk::SpinButton ports_spinner;
72 Gtk::Button control_app_button;
74 /* latency measurement */
76 Gtk::ComboBoxText lm_output_channel_combo;
77 Gtk::ComboBoxText lm_input_channel_combo;
78 Gtk::ToggleButton lm_measure_button;
79 Gtk::Button lm_use_button;
81 Gtk::Label lm_preamble;
82 Gtk::Label lm_results;
88 Gtk::CheckButton realtime_button;
89 Gtk::CheckButton no_memory_lock_button;
90 Gtk::CheckButton unlock_memory_button;
91 Gtk::CheckButton soft_mode_button;
92 Gtk::CheckButton monitor_button;
93 Gtk::CheckButton force16bit_button;
94 Gtk::CheckButton hw_monitor_button;
95 Gtk::CheckButton hw_meter_button;
96 Gtk::CheckButton verbose_output_button;
98 Gtk::ComboBoxText preset_combo;
99 Gtk::ComboBoxText serverpath_combo;
100 Gtk::ComboBoxText driver_combo;
101 Gtk::ComboBoxText device_combo;
102 Gtk::ComboBoxText timeout_combo;
103 Gtk::ComboBoxText dither_mode_combo;
104 Gtk::ComboBoxText audio_mode_combo;
105 Gtk::ComboBoxText midi_driver_combo;
107 Gtk::Table basic_packer;
108 Gtk::Table midi_packer;
109 Gtk::HBox basic_hbox;
110 Gtk::VBox basic_vbox;
113 uint32_t ignore_changes;
115 static bool engine_running ();
117 void driver_changed ();
118 void backend_changed ();
119 void sample_rate_changed ();
120 void buffer_size_changed ();
122 uint32_t get_rate() const;
123 uint32_t get_buffer_size() const;
124 uint32_t get_input_channels() const;
125 uint32_t get_output_channels() const;
126 uint32_t get_input_latency() const;
127 uint32_t get_output_latency() const;
128 std::string get_device_name() const;
129 std::string get_driver() const;
131 void device_changed ();
132 void list_devices ();
133 void show_buffer_duration ();
139 std::string sample_rate;
140 std::string buffer_size;
141 uint32_t input_latency;
142 uint32_t output_latency;
143 uint32_t input_channels;
144 uint32_t output_channels;
147 State() : active (false) {};
150 typedef std::list<State> StateList;
154 State* get_matching_state (const std::string& backend,
155 const std::string& driver,
156 const std::string& device);
157 State* get_current_state ();
158 void maybe_display_saved_state ();
161 static bool print_channel_count (Gtk::SpinButton*);
163 void build_notebook ();
165 void on_response (int);
166 void control_app_button_clicked ();
167 void use_latency_button_clicked ();
168 void manage_control_app_sensitivity ();
169 int push_state_to_backend (bool start);
170 uint32_t _desired_sample_rate;
172 /* latency measurement */
173 void latency_button_toggled ();
174 bool check_latency_measurement ();
175 void update_latency_display ();
176 sigc::connection latency_timeout;
177 void enable_latency_tab ();
178 void disable_latency_tab ();
181 #endif /* __gtk2_ardour_engine_dialog_h__ */