ControlProtocolManager::ControlProtocolManager ()
{
-
}
ControlProtocolManager::~ControlProtocolManager()
if (prop && string_is_affirmative (prop->value())) {
if ((prop = (*citer)->property (X_("name"))) != 0) {
ControlProtocolInfo* cpi = cpi_by_name (prop->value());
+
if (cpi) {
- if (!(*citer)->children().empty()) {
- cpi->state = (*citer)->children().front ();
- } else {
- cpi->state = 0;
+
+ if (cpi->state) {
+ delete cpi->state;
}
+ cpi->state = new XMLNode (**citer);
+
if (_session) {
instantiate (*cpi);
} else {
XMLTree tree;
- std::cerr << "Loading " << fullpath << std::endl;
-
if (!tree.read (fullpath.c_str())) {
continue;
}
table->set_row_spacings (4);
table->set_col_spacings (6);
l = manage (new Gtk::Label (_("Device Type:")));
+ l->set_alignment (1.0, 0.5);
table->attach (*l, 0, 1, 0, 1, AttachOptions(FILL|EXPAND), AttachOptions(0));
table->attach (_surface_combo, 1, 2, 0, 1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 20);
return;
}
- uint32_t delta = sorted.size() - strip_cnt;
-
- if (delta > 0 && initial > delta) {
- DEBUG_TRACE (DEBUG::MackieControl, string_compose ("not switching to %1\n", initial));
- return;
- }
-
_current_initial_bank = initial;
_current_selected_track = -1;
}
void
-MackieControlProtocol::set_device (const string& device_name)
+MackieControlProtocol::set_device (const string& device_name, bool allow_activation)
{
map<string,DeviceInfo>::iterator d = DeviceInfo::device_info.find (device_name);
_device_info = d->second;
- if (_active) {
- create_surfaces ();
- switch_banks (0, true);
+ if (allow_activation) {
+ set_active (true);
+ } else {
+ if (_active) {
+ create_surfaces ();
+ switch_banks (0, true);
+ }
}
}
}
if ((prop = node.property (X_("device-name"))) != 0) {
- set_device (prop->value());
+ set_device (prop->value(), false);
}
if ((prop = node.property (X_("device-profile"))) != 0) {
Mackie::DeviceProfile& device_profile() { return _device_profile; }
int set_active (bool yn);
- void set_device (const std::string&);
+ void set_device (const std::string&, bool allow_activation = true);
void set_profile (const std::string&);
bool flip_mode () const { return _flip_mode; }
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <algorithm>
+
#include "pbd/memento_command.h"
#include "ardour/debug.h"
MackieControlProtocol::left_press (Button &)
{
Sorted sorted = get_sorted_routes();
- uint32_t strip_cnt = n_strips ();
+ uint32_t strip_cnt = n_strips ();
+ uint32_t route_cnt = sorted.size();
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("bank left with current initial = %1 nstrips = %2 tracks/busses = %3\n",
- _current_initial_bank, strip_cnt, sorted.size()));
+ _current_initial_bank, strip_cnt, route_cnt));
- if (sorted.size() > strip_cnt) {
- int new_initial = _current_initial_bank - strip_cnt;
- if (new_initial < 0) {
- new_initial = 0;
- }
-
- if (new_initial != int (_current_initial_bank)) {
- switch_banks (new_initial);
+ if (route_cnt && route_cnt > strip_cnt) {
+ if (_current_initial_bank > strip_cnt) {
+ switch_banks (_current_initial_bank - strip_cnt);
+ } else {
+ switch_banks (0);
}
return on;
- } else {
- return flashing;
}
+ return off;
}
LedState
{
Sorted sorted = get_sorted_routes();
uint32_t strip_cnt = n_strips();
+ uint32_t route_cnt = sorted.size();
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("bank right with current initial = %1 nstrips = %2 tracks/busses = %3\n",
_current_initial_bank, strip_cnt, sorted.size()));
- if (sorted.size() > strip_cnt) {
- uint32_t delta = sorted.size() - (strip_cnt + _current_initial_bank);
-
- if (delta > strip_cnt) {
- delta = strip_cnt;
- }
-
- if (delta > 0) {
- switch_banks (_current_initial_bank + delta);
- }
-
+ if (route_cnt && route_cnt > strip_cnt) {
+ uint32_t new_initial = std::min (_current_initial_bank + strip_cnt, route_cnt - 1);
+ switch_banks (new_initial);
return on;
- } else {
- return flashing;
}
+
return off;
}
reset_saved_values ();
if (!r) {
+ zero ();
return;
}
if ((a = automatable.find (PanWidthAutomation)) != automatable.end()) {
possible_pot_parameters.push_back (PanWidthAutomation);
}
- } else {
- std::cerr << "connected to route without a panner\n";
}
}
}
Surface::map_routes (const vector<boost::shared_ptr<Route> >& routes)
{
vector<boost::shared_ptr<Route> >::const_iterator r;
- Strips::iterator s;
+ Strips::iterator s = strips.begin();
- for (r = routes.begin(), s = strips.begin(); r != routes.end() && s != strips.end(); ++s) {
+ for (r = routes.begin(); r != routes.end() && s != strips.end(); ++s) {
/* don't try to assign routes to a locked strip. it won't
use it anyway, but if we do, then we get out of sync