summaryrefslogtreecommitdiff
path: root/libs/surfaces
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-05-05 22:44:50 +0000
committerCarl Hetherington <carl@carlh.net>2011-05-05 22:44:50 +0000
commit143dddd9a76ef23544b2ee61c8778a44b96badb0 (patch)
treebb6c56a2e1926749e19bc6003b22e5af9db0084b /libs/surfaces
parente89d8af65bd9f77fe3be48ce37ed83f050aa1dd1 (diff)
Add a GUI to set the number of active extenders for the Mackie control surface.
git-svn-id: svn://localhost/ardour2/branches/3.0@9484 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces')
-rw-r--r--libs/surfaces/mackie/gui.cc35
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc21
2 files changed, 43 insertions, 13 deletions
diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc
index 2742dc8c9c..fe88355f58 100644
--- a/libs/surfaces/mackie/gui.cc
+++ b/libs/surfaces/mackie/gui.cc
@@ -18,6 +18,8 @@
#include <gtkmm/comboboxtext.h>
#include <gtkmm/box.h>
+#include <gtkmm/spinbutton.h>
+#include <gtkmm/table.h>
#include "gtkmm2ext/utils.h"
#include "ardour/rc_configuration.h"
#include "mackie_control_protocol.h"
@@ -33,9 +35,11 @@ public:
private:
void surface_combo_changed ();
+ void extenders_changed ();
MackieControlProtocol& _cp;
Gtk::ComboBoxText _surface_combo;
+ Gtk::SpinButton _extenders;
};
void*
@@ -63,10 +67,11 @@ MackieControlProtocol::build_gui ()
MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
: _cp (p)
{
- Gtk::HBox* hbox = Gtk::manage (new Gtk::HBox);
- hbox->set_spacing (4);
- hbox->pack_start (*manage (new Gtk::Label (_("Surface to support:"))));
- hbox->pack_start (_surface_combo);
+ Gtk::Table* table = Gtk::manage (new Gtk::Table (2, 2));
+ table->set_spacings (4);
+
+ table->attach (*manage (new Gtk::Label (_("Surface type:"))), 0, 1, 0, 1);
+ table->attach (_surface_combo, 1, 2, 0, 1);
vector<string> surfaces;
surfaces.push_back (_("Mackie Control"));
@@ -79,11 +84,25 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
_surface_combo.set_active_text (surfaces.back ());
}
- pack_start (*hbox);
+ _extenders.set_range (0, 8);
+ _extenders.set_increments (1, 4);
+
+ Gtk::Label* l = manage (new Gtk::Label (_("Extenders:")));
+ l->set_alignment (0, 0.5);
+ table->attach (*l, 0, 1, 1, 2);
+ table->attach (_extenders, 1, 2, 1, 2);
+
+ pack_start (*table);
+
+ Gtk::Label* cop_out = manage (new Gtk::Label (_("<i>You must restart Ardour for changes\nto these settings to take effect.</i>")));
+ cop_out->set_use_markup (true);
+ pack_start (*cop_out);
+ set_spacing (4);
show_all ();
_surface_combo.signal_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::surface_combo_changed));
+ _extenders.signal_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::extenders_changed));
}
void
@@ -95,3 +114,9 @@ MackieControlProtocolGUI::surface_combo_changed ()
ARDOUR::Config->set_mackie_emulation (X_("bcf"));
}
}
+
+void
+MackieControlProtocolGUI::extenders_changed ()
+{
+ ARDOUR::Config->set_mackie_extenders (_extenders.get_value_as_int ());
+}
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 15a091d66d..5dddb18613 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -608,7 +608,7 @@ MackieControlProtocol::create_ports()
new MIDI::Port (string_compose (_("%1 out"), default_port_name), MIDI::Port::IsOutput, session->engine().jack())
);
- // open main port
+ /* Create main port */
if (!midi_input_port->ok() || !midi_output_port->ok()) {
ostringstream os;
@@ -619,10 +619,9 @@ MackieControlProtocol::create_ports()
add_port (*midi_input_port, *midi_output_port, 0);
- // open extender ports. Up to 9. Should be enough.
- // could also use mm->get_midi_ports()
+ /* Create extender ports */
- for (int index = 1; index <= 9; ++index) {
+ for (int index = 1; index <= Config->get_mackie_extenders(); ++index) {
MIDI::Port * midi_input_port = mm->add_port (
new MIDI::Port (string_compose (_("mcu_xt_%1 in"), index), MIDI::Port::IsInput, session->engine().jack())
);
@@ -1507,9 +1506,11 @@ MackieControlProtocol::left_press (Button &)
if (sorted.size() > route_table.size())
{
int new_initial = _current_initial_bank - route_table.size();
- if (new_initial < 0) new_initial = 0;
- if (new_initial != int (_current_initial_bank))
- {
+ if (new_initial < 0) {
+ new_initial = 0;
+ }
+
+ if (new_initial != int (_current_initial_bank)) {
session->set_dirty();
switch_banks (new_initial);
}
@@ -1534,7 +1535,11 @@ MackieControlProtocol::right_press (Button &)
Sorted sorted = get_sorted_routes();
if (sorted.size() > route_table.size()) {
uint32_t delta = sorted.size() - (route_table.size() + _current_initial_bank);
- if (delta > route_table.size()) delta = route_table.size();
+
+ if (delta > route_table.size()) {
+ delta = route_table.size();
+ }
+
if (delta > 0) {
session->set_dirty();
switch_banks (_current_initial_bank + delta);