#include <glibmm/convert.h>
+#include "pbd/stacktrace.h"
+
#include "midi++/port.h"
#include "ardour/audioengine.h"
#include "jog.h"
#include "meter.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
#ifdef PLATFORM_WINDOWS
#define random() rand()
using namespace std;
using namespace PBD;
-using ARDOUR::Route;
+using ARDOUR::Stripable;
using ARDOUR::Panner;
using ARDOUR::Profile;
using ARDOUR::AutomationControl;
void
Surface::master_monitor_may_have_changed ()
{
- setup_master ();
+ if (_number == _mcp.device_info().master_position()) {
+ setup_master ();
+ }
}
void
Surface::setup_master ()
{
- boost::shared_ptr<Route> m;
+ boost::shared_ptr<Stripable> m;
if ((m = _mcp.get_session().monitor_out()) == 0) {
m = _mcp.get_session().master_out();
}
if (!m) {
- _master_fader->set_control (boost::shared_ptr<AutomationControl>());
+ if (_master_fader) {
+ _master_fader->set_control (boost::shared_ptr<AutomationControl>());
+ }
master_connection.disconnect ();
return;
}
if (!_master_fader) {
- _master_fader = dynamic_cast<Fader*> (Fader::factory (*this, _mcp.device_info().strip_cnt(), "master", *groups["master"]));
-
Groups::iterator group_it;
+ Group* master_group;
group_it = groups.find("master");
+ if (group_it == groups.end()) {
+ groups["master"] = master_group = new Group ("master");
+ } else {
+ master_group = group_it->second;
+ }
+
+ _master_fader = dynamic_cast<Fader*> (Fader::factory (*this, _mcp.device_info().strip_cnt(), "master", *master_group));
+
DeviceInfo device_info = _mcp.device_info();
GlobalButtonInfo master_button = device_info.get_global_button(Button::MasterFaderTouch);
Button* bb = dynamic_cast<Button*> (Button::factory (
turn_it_on ();
}
- if (_mcp.main_modifier_state() & MackieControlProtocol::MODIFIER_SHIFT) {
- /* user is doing a reset to unity gain but device sends a PB
- * message in the middle of the touch on/off messages. Ignore
- * it.
- */
- return;
- }
-
Fader* fader = faders[fader_id];
if (fader) {
}
float delta = 0;
- if (mcp().main_modifier_state() == MackieControlProtocol::MODIFIER_CONTROL) {
+ if (mcp().main_modifier_state() == MackieControlProtocol::MODIFIER_SHIFT) {
delta = sign * (ticks / (float) 0xff);
} else {
delta = sign * (ticks / (float) 0x3f);
{
MidiByteArray bytes (count, raw_bytes);
- DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
-
if (_mcp.device_info().no_handshake()) {
turn_it_on ();
}
switch (bytes[5]) {
case 0x01:
+ if (!_active) {
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
+ }
/* MCP: Device Ready
LCP: Connection Challenge
*/
DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device connection challenge\n");
write_sysex (host_connection_query (bytes));
} else {
- DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mackie Control Device ready, current status = %1\n", _active));
+ if (!_active) {
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mackie Control Device ready, current status = %1\n", _active));
+ }
turn_it_on ();
}
break;
+ case 0x06:
+ if (!_active) {
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
+ }
+ /* Behringer X-Touch Compact: Device Ready
+ */
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Behringer X-Touch Compact ready, current status = %1\n", _active));
+ turn_it_on ();
+ break;
+
case 0x03: /* LCP Connection Confirmation */
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device confirms connection, ardour replies\n");
if (bytes[4] == 0x10 || bytes[4] == 0x11) {
write_sysex (host_connection_confirmation (bytes));
break;
case 0x04: /* LCP: Confirmation Denied */
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device denies connection\n");
_active = false;
break;
+
default:
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("unknown device ID byte %1", (int) bytes[5]));
error << "MCP: unknown sysex: " << bytes << endmsg;
}
}
(*s)->notify_all ();
}
- update_view_mode_display ();
+ update_view_mode_display (false);
- if (_mcp.device_info ().has_global_controls ()) {
- _mcp.update_global_button (Button::Read, _mcp.metering_active ());
- }
+// if (_mcp.device_info ().has_global_controls ()) {
+// _mcp.update_global_button (Button::Read, _mcp.metering_active ());
+// }
}
void
}
void
-Surface::redisplay (ARDOUR::microseconds_t now)
+Surface::redisplay (ARDOUR::microseconds_t now, bool force)
{
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
- (*s)->redisplay (now);
+ (*s)->redisplay (now, force);
}
}
}
void
-Surface::map_routes (const vector<boost::shared_ptr<Route> >& routes)
+Surface::map_stripables (const vector<boost::shared_ptr<Stripable> >& stripables)
{
- vector<boost::shared_ptr<Route> >::const_iterator r;
+ vector<boost::shared_ptr<Stripable> >::const_iterator r;
Strips::iterator s = strips.begin();
- DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mapping %1 routes\n", routes.size()));
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mapping %1 stripables to %2 strips\n", stripables.size(), strips.size()));
- for (r = routes.begin(); r != routes.end() && s != strips.end(); ++s) {
+ for (r = stripables.begin(); r != stripables.end() && s != strips.end(); ++s) {
- /* don't try to assign routes to a locked strip. it won't
+ /* don't try to assign stripables to a locked strip. it won't
use it anyway, but if we do, then we get out of sync
with the proposed mapping.
*/
if (!(*s)->locked()) {
- (*s)->set_route (*r);
+ (*s)->set_stripable (*r);
++r;
}
}
for (; s != strips.end(); ++s) {
- (*s)->set_route (boost::shared_ptr<Route>());
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("strip %1 being set to null stripable\n", (*s)->index()));
+ (*s)->set_stripable (boost::shared_ptr<Stripable>());
}
-
-
}
static char
Surface::update_flip_mode_display ()
{
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
- (*s)->potmode_changed (true);
- }
-}
-
-void
-Surface::update_potmode ()
-{
- for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
- (*s)->potmode_changed (false);
+ (*s)->flip_mode_changed ();
}
}
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
(*s)->subview_mode_changed ();
}
-
- if (_mcp.subview_mode() == MackieControlProtocol::None) {
- update_view_mode_display ();
- }
}
void
-Surface::update_view_mode_display ()
+Surface::update_view_mode_display (bool with_helpful_text)
{
string text;
int id = -1;
id = Button::Aux;
text = _("Auxes");
break;
+ case MackieControlProtocol::Hidden:
+ show_two_char_display ("HI");
+ id = Button::Outputs;
+ text = _("Hidden Tracks");
+ break;
case MackieControlProtocol::Selected:
show_two_char_display ("SE");
id = Button::User;
- text = _("Selected Routes");
+ text = _("Selected Tracks");
break;
default:
break;
view_mode_buttons.push_back (Button::AudioTracks);
view_mode_buttons.push_back (Button::MidiTracks);
view_mode_buttons.push_back (Button::Aux);
+ view_mode_buttons.push_back (Button::Outputs);
view_mode_buttons.push_back (Button::User);
if (id >= 0) {
}
}
- if (!text.empty()) {
+ if (with_helpful_text && !text.empty()) {
display_message_for (text, 1000);
}
}
-void
-Surface::gui_selection_changed (const ARDOUR::StrongRouteNotificationList& routes)
-{
- for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
- (*s)->gui_selection_changed (routes);
- }
-}
-
void
Surface::say_hello ()
{
}
bool
-Surface::route_is_locked_to_strip (boost::shared_ptr<Route> r) const
+Surface::stripable_is_locked_to_strip (boost::shared_ptr<Stripable> stripable) const
+{
+ for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) {
+ if ((*s)->stripable() == stripable && (*s)->locked()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool
+Surface::stripable_is_mapped (boost::shared_ptr<Stripable> stripable) const
{
for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) {
- if ((*s)->route() == r && (*s)->locked()) {
+ if ((*s)->stripable() == stripable) {
return true;
}
}
+
return false;
}