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
This commit is contained in:
Carl Hetherington 2011-05-05 22:44:50 +00:00
parent e89d8af65b
commit 143dddd9a7
3 changed files with 44 additions and 13 deletions

View file

@ -50,6 +50,7 @@ CONFIG_VARIABLE (int, mtc_qf_speed_tolerance, "mtc-qf-speed-tolerance", 5)
CONFIG_VARIABLE (uint32_t, feedback_interval_ms, "feedback-interval-ms", 100)
CONFIG_VARIABLE (bool, use_tranzport, "use-tranzport", false)
CONFIG_VARIABLE (std::string, mackie_emulation, "mackie-emulation", "mcu")
CONFIG_VARIABLE (uint32_t, mackie_extenders, "mackie-extenders", 0)
CONFIG_VARIABLE (RemoteModel, remote_model, "remote-model", MixerOrdered)
/* disk operations */

View file

@ -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 ());
}

View file

@ -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);