mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
fix initialization of control protocols so that brand new sessions get working control protocols if the user's ardour.rc file indicates to do so; fix MCP bank scrolling
git-svn-id: svn://localhost/ardour2/branches/3.0@12096 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3b7e2f7d67
commit
834f94c60a
8 changed files with 36 additions and 49 deletions
|
|
@ -41,7 +41,6 @@ const string ControlProtocolManager::state_node_name = X_("ControlProtocols");
|
|||
|
||||
ControlProtocolManager::ControlProtocolManager ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ControlProtocolManager::~ControlProtocolManager()
|
||||
|
|
@ -320,13 +319,15 @@ ControlProtocolManager::set_state (const XMLNode& node, int /*version*/)
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -120,8 +120,6 @@ DeviceProfile::reload_device_profiles ()
|
|||
|
||||
XMLTree tree;
|
||||
|
||||
std::cerr << "Loading " << fullpath << std::endl;
|
||||
|
||||
if (!tree.read (fullpath.c_str())) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -321,13 +321,6 @@ MackieControlProtocol::switch_banks (uint32_t initial, bool force)
|
|||
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;
|
||||
|
||||
|
|
@ -548,7 +541,7 @@ MackieControlProtocol::set_profile (const string& profile_name)
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
@ -563,9 +556,13 @@ MackieControlProtocol::set_device (const string& 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -691,7 +688,7 @@ MackieControlProtocol::set_state (const XMLNode & node, int /*version*/)
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class MackieControlProtocol
|
|||
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; }
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "pbd/memento_command.h"
|
||||
|
||||
#include "ardour/debug.h"
|
||||
|
|
@ -94,25 +96,22 @@ LedState
|
|||
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
|
||||
|
|
@ -126,25 +125,17 @@ MackieControlProtocol::right_press (Button &)
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool with_messages)
|
|||
reset_saved_values ();
|
||||
|
||||
if (!r) {
|
||||
zero ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -213,8 +214,6 @@ Strip::set_route (boost::shared_ptr<Route> r, bool with_messages)
|
|||
if ((a = automatable.find (PanWidthAutomation)) != automatable.end()) {
|
||||
possible_pot_parameters.push_back (PanWidthAutomation);
|
||||
}
|
||||
} else {
|
||||
std::cerr << "connected to route without a panner\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -606,9 +606,9 @@ void
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue