mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +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 ()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 && string_is_affirmative (prop->value())) {
|
||||||
if ((prop = (*citer)->property (X_("name"))) != 0) {
|
if ((prop = (*citer)->property (X_("name"))) != 0) {
|
||||||
ControlProtocolInfo* cpi = cpi_by_name (prop->value());
|
ControlProtocolInfo* cpi = cpi_by_name (prop->value());
|
||||||
|
|
||||||
if (cpi) {
|
if (cpi) {
|
||||||
if (!(*citer)->children().empty()) {
|
|
||||||
cpi->state = (*citer)->children().front ();
|
if (cpi->state) {
|
||||||
} else {
|
delete cpi->state;
|
||||||
cpi->state = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cpi->state = new XMLNode (**citer);
|
||||||
|
|
||||||
if (_session) {
|
if (_session) {
|
||||||
instantiate (*cpi);
|
instantiate (*cpi);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,6 @@ DeviceProfile::reload_device_profiles ()
|
||||||
|
|
||||||
XMLTree tree;
|
XMLTree tree;
|
||||||
|
|
||||||
std::cerr << "Loading " << fullpath << std::endl;
|
|
||||||
|
|
||||||
if (!tree.read (fullpath.c_str())) {
|
if (!tree.read (fullpath.c_str())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
|
||||||
table->set_row_spacings (4);
|
table->set_row_spacings (4);
|
||||||
table->set_col_spacings (6);
|
table->set_col_spacings (6);
|
||||||
l = manage (new Gtk::Label (_("Device Type:")));
|
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 (*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);
|
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;
|
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_initial_bank = initial;
|
||||||
_current_selected_track = -1;
|
_current_selected_track = -1;
|
||||||
|
|
||||||
|
|
@ -548,7 +541,7 @@ MackieControlProtocol::set_profile (const string& profile_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
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;
|
_device_info = d->second;
|
||||||
|
|
||||||
if (_active) {
|
if (allow_activation) {
|
||||||
create_surfaces ();
|
set_active (true);
|
||||||
switch_banks (0, 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) {
|
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) {
|
if ((prop = node.property (X_("device-profile"))) != 0) {
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ class MackieControlProtocol
|
||||||
Mackie::DeviceProfile& device_profile() { return _device_profile; }
|
Mackie::DeviceProfile& device_profile() { return _device_profile; }
|
||||||
|
|
||||||
int set_active (bool yn);
|
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&);
|
void set_profile (const std::string&);
|
||||||
|
|
||||||
bool flip_mode () const { return _flip_mode; }
|
bool flip_mode () const { return _flip_mode; }
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "pbd/memento_command.h"
|
#include "pbd/memento_command.h"
|
||||||
|
|
||||||
#include "ardour/debug.h"
|
#include "ardour/debug.h"
|
||||||
|
|
@ -95,24 +97,21 @@ MackieControlProtocol::left_press (Button &)
|
||||||
{
|
{
|
||||||
Sorted sorted = get_sorted_routes();
|
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",
|
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) {
|
if (route_cnt && route_cnt > strip_cnt) {
|
||||||
int new_initial = _current_initial_bank - strip_cnt;
|
if (_current_initial_bank > strip_cnt) {
|
||||||
if (new_initial < 0) {
|
switch_banks (_current_initial_bank - strip_cnt);
|
||||||
new_initial = 0;
|
} else {
|
||||||
}
|
switch_banks (0);
|
||||||
|
|
||||||
if (new_initial != int (_current_initial_bank)) {
|
|
||||||
switch_banks (new_initial);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return on;
|
return on;
|
||||||
} else {
|
|
||||||
return flashing;
|
|
||||||
}
|
}
|
||||||
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
LedState
|
LedState
|
||||||
|
|
@ -126,25 +125,17 @@ MackieControlProtocol::right_press (Button &)
|
||||||
{
|
{
|
||||||
Sorted sorted = get_sorted_routes();
|
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 right with current initial = %1 nstrips = %2 tracks/busses = %3\n",
|
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()));
|
_current_initial_bank, strip_cnt, sorted.size()));
|
||||||
|
|
||||||
if (sorted.size() > strip_cnt) {
|
if (route_cnt && route_cnt > strip_cnt) {
|
||||||
uint32_t delta = sorted.size() - (strip_cnt + _current_initial_bank);
|
uint32_t new_initial = std::min (_current_initial_bank + strip_cnt, route_cnt - 1);
|
||||||
|
switch_banks (new_initial);
|
||||||
if (delta > strip_cnt) {
|
|
||||||
delta = strip_cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (delta > 0) {
|
|
||||||
switch_banks (_current_initial_bank + delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
return on;
|
return on;
|
||||||
} else {
|
|
||||||
return flashing;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool with_messages)
|
||||||
reset_saved_values ();
|
reset_saved_values ();
|
||||||
|
|
||||||
if (!r) {
|
if (!r) {
|
||||||
|
zero ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,8 +214,6 @@ Strip::set_route (boost::shared_ptr<Route> r, bool with_messages)
|
||||||
if ((a = automatable.find (PanWidthAutomation)) != automatable.end()) {
|
if ((a = automatable.find (PanWidthAutomation)) != automatable.end()) {
|
||||||
possible_pot_parameters.push_back (PanWidthAutomation);
|
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)
|
Surface::map_routes (const vector<boost::shared_ptr<Route> >& routes)
|
||||||
{
|
{
|
||||||
vector<boost::shared_ptr<Route> >::const_iterator r;
|
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
|
/* 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
|
use it anyway, but if we do, then we get out of sync
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue