_surface->number(), index, Button::id_to_name (bb->bid()),
bb->id(), b->second.base_id));
}
-}
+}
Strip::~Strip ()
{
}
route_connections.drop_connections ();
-
+
_solo->set_control (boost::shared_ptr<AutomationControl>());
_mute->set_control (boost::shared_ptr<AutomationControl>());
_select->set_control (boost::shared_ptr<AutomationControl>());
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface %1 strip %2 now mapping route %3\n",
_surface->number(), _index, _route->name()));
-
+
_solo->set_control (_route->solo_control());
_mute->set_control (_route->mute_control());
set_vpot_parameter (PanAzimuthAutomation);
-
+
_route->solo_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_solo_changed, this), ui_context());
_route->listen_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_solo_changed, this), ui_context());
}
_route->gain_control()->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_gain_changed, this, false), ui_context());
_route->PropertyChanged.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_property_changed, this, _1), ui_context());
-
+
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route);
-
+
if (trk) {
_recenable->set_control (trk->rec_enable_control());
trk->rec_enable_control()->Changed .connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_record_enable_changed, this), ui_context());
-
+
}
-
+
// TODO this works when a currently-banked route is made inactive, but not
// when a route is activated which should be currently banked.
-
+
_route->active_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_active_changed, this), ui_context());
_route->DropReferences.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_route_deleted, this), ui_context());
-
+
/* Update */
-
+
notify_all ();
/* setup legal VPot modes for this route */
-
+
build_input_list (_route->input()->n_ports());
build_output_list (_route->output()->n_ports());
if (panner) {
set<Evoral::Parameter> automatable = panner->what_can_be_automated ();
set<Evoral::Parameter>::iterator a;
-
+
if ((a = automatable.find (PanAzimuthAutomation)) != automatable.end()) {
possible_pot_parameters.push_back (PanAzimuthAutomation);
}
-
+
if ((a = automatable.find (PanWidthAutomation)) != automatable.end()) {
possible_pot_parameters.push_back (PanWidthAutomation);
}
Strip::notify_gain_changed (bool force_update)
{
if (_route) {
-
+
Control* control;
if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
}
boost::shared_ptr<AutomationControl> ac = _route->gain_control();
-
+
float gain_coefficient = ac->get_value();
float normalized_position = ac->internal_to_interface (gain_coefficient);
if (force_update || normalized_position != _last_gain_position_written) {
-
+
if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
if (!control->in_use()) {
_surface->write (_vpot->set (normalized_position, true, Pot::wrap));
if (_route) {
string line1;
string fullname = _route->name();
-
+
if (fullname.length() <= 6) {
line1 = fullname;
} else {
line1 = PBD::short_version (fullname, 6);
}
-
+
_surface->write (display (0, line1));
}
}
}
double pos = pannable->pan_azimuth_control->internal_to_interface (pannable->pan_azimuth_control->get_value());
-
+
if (force_update || pos != _last_pan_azi_position_written) {
if (control == _fader) {
} else if (control == _vpot) {
_surface->write (_vpot->set (pos, true, Pot::dot));
}
-
+
queue_parameter_display (PanAzimuthAutomation, pos);
queue_display_reset (2000);
_last_pan_azi_position_written = pos;
if (!control) {
return;
- }
-
+ }
+
double pos = pannable->pan_width_control->internal_to_interface (pannable->pan_width_control->get_value());
-
+
if (force_update || pos != _last_pan_azi_position_written) {
-
+
if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
if (control == _fader) {
} else if (control == _vpot) {
_surface->write (_vpot->set (pos, true, Pot::spread));
}
-
+
queue_parameter_display (PanWidthAutomation, pos);
queue_display_reset (2000);
_last_pan_azi_position_written = pos;
Strip::select_event (Button&, ButtonState bs)
{
DEBUG_TRACE (DEBUG::MackieControl, "select button\n");
-
+
if (bs == press) {
-
+
int ms = _surface->mcp().main_modifier_state();
if (ms & MackieControlProtocol::MODIFIER_CMDALT) {
queue_display_reset (1000);
return;
}
-
+
if (ms & MackieControlProtocol::MODIFIER_SHIFT) {
/* reset to default */
boost::shared_ptr<AutomationControl> ac = _fader->control ();
}
return;
}
-
+
DEBUG_TRACE (DEBUG::MackieControl, "add select button on press\n");
- _surface->mcp().add_down_select_button (_surface->number(), _index);
+ _surface->mcp().add_down_select_button (_surface->number(), _index);
_surface->mcp().select_range ();
-
+
} else {
DEBUG_TRACE (DEBUG::MackieControl, "remove select button on release\n");
- _surface->mcp().remove_down_select_button (_surface->number(), _index);
+ _surface->mcp().remove_down_select_button (_surface->number(), _index);
}
}
if (bs == press) {
int ms = _surface->mcp().main_modifier_state();
-
+
if (ms & MackieControlProtocol::MODIFIER_SHIFT) {
boost::shared_ptr<AutomationControl> ac = _vpot->control ();
-
+
if (ac) {
-
+
/* reset to default/normal value */
ac->set_value (ac->normal());
}
Strip::fader_touch_event (Button&, ButtonState bs)
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("fader touch, press ? %1\n", (bs == press)));
-
+
if (bs == press) {
boost::shared_ptr<AutomationControl> ac = _fader->control ();
_fader->set_in_use (true);
_fader->start_touch (_surface->mcp().transport_frame());
-
+
if (ac) {
queue_parameter_display ((AutomationType) ac->parameter().type(), ac->internal_to_interface (ac->get_value()));
queue_display_reset (2000);
}
}
-
+
} else {
-
+
_fader->set_in_use (false);
_fader->stop_touch (_surface->mcp().transport_frame(), true);
-
+
}
-}
+}
void
}
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("strip %1 handling button %2 press ? %3\n", _index, button.bid(), (bs == press)));
-
+
switch (button.bid()) {
case Button::Select:
select_event (button, bs);
break;
-
+
case Button::VSelect:
vselect_event (button, bs);
break;
if (bs == press) {
DEBUG_TRACE (DEBUG::MackieControl, "add button on press\n");
_surface->mcp().add_down_button ((AutomationType) control->parameter().type(), _surface->number(), _index);
-
+
float new_value;
int ms = _surface->mcp().main_modifier_state();
-
+
if (ms & MackieControlProtocol::MODIFIER_SHIFT) {
/* reset to default/normal value */
new_value = control->normal();
} else {
new_value = control->get_value() ? 0.0 : 1.0;
}
-
+
/* get all controls that either have their
* button down or are within a range of
* several down buttons
*/
-
+
MackieControlProtocol::ControlList controls = _surface->mcp().down_controls ((AutomationType) control->parameter().type());
-
-
+
+
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("there are %1 buttons down for control type %2, new value = %3\n",
controls.size(), control->parameter().type(), new_value));
/* apply change */
-
+
for (MackieControlProtocol::ControlList::iterator c = controls.begin(); c != controls.end(); ++c) {
(*c)->set_value (new_value);
}
-
+
} else {
DEBUG_TRACE (DEBUG::MackieControl, "remove button on release\n");
_surface->mcp().remove_down_button ((AutomationType) control->parameter().type(), _surface->number(), _index);
float dB = accurate_coefficient_to_dB (val);
snprintf (buf, sizeof (buf), "%6.1f", dB);
_surface->write (display (1, buf));
- }
+ }
break;
case PanAzimuthAutomation:
/* Pots only emit events when they move, not when they
stop moving. So to get a stop event, we need to use a timeout.
*/
-
+
boost::shared_ptr<AutomationControl> ac = pot.control();
double p = pot.get_value ();
p += delta;
// sysex header
retval << _surface->sysex_hdr();
-
+
// code for display
retval << 0x12;
// offset (0 to 0x37 first line, 0x38 to 0x6f for second line)
retval << (_index * 7 + (line_number * 0x38));
-
+
// ascii data to display. @param line is UTF-8
string ascii = Glib::convert_with_fallback (line, "UTF-8", "ISO-8859-1", "_");
string::size_type len = ascii.length();
for (int i = len; i < 6; ++i) {
retval << ' ';
}
-
+
// column spacer, unless it's the right-hand column
if (_index < 7) {
retval << ' ';
// sysex trailer
retval << MIDI::eox;
-
+
return retval;
}
Strip::vpot_mode_string () const
{
boost::shared_ptr<AutomationControl> ac = _vpot->control();
-
+
if (!ac) {
return string();
}
struct timeval delta;
struct timeval when;
gettimeofday (&now, 0);
-
+
delta.tv_sec = msecs/1000;
delta.tv_usec = (msecs - ((msecs/1000) * 1000)) * 1000;
-
+
timeradd (&now, &delta, &when);
_reset_display_at = (when.tv_sec * 1000000) + when.tv_usec;
} else {
_surface->write (blank_display (1));
}
-
+
clear_display_reset ();
}
-
+
struct RouteCompareByName {
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
return a->name().compare (b->name()) < 0;
input_bundles.clear ();
/* give user bundles first chance at being in the menu */
-
+
for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
maybe_add_to_bundle_map (input_bundles, *i, true, channels);
}
}
-
+
for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
maybe_add_to_bundle_map (input_bundles, *i, true, channels);
}
}
-
+
boost::shared_ptr<ARDOUR::RouteList> routes = _surface->mcp().get_session().get_routes ();
RouteList copy = *routes;
copy.sort (RouteCompareByName ());
output_bundles.clear ();
/* give user bundles first chance at being in the menu */
-
+
for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
maybe_add_to_bundle_map (output_bundles, *i, false, channels);
}
}
-
+
for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
maybe_add_to_bundle_map (output_bundles, *i, false, channels);
}
}
-
+
boost::shared_ptr<ARDOUR::RouteList> routes = _surface->mcp().get_session().get_routes ();
RouteList copy = *routes;
copy.sort (RouteCompareByName ());
if (!_route || !_meter) {
return;
}
-
+
bool transport_is_rolling = (_surface->mcp().get_transport_speed () != 0.0f);
bool metering_active = _surface->mcp().metering_active ();
-
+
if ((_transport_is_rolling == transport_is_rolling) && (_metering_active == metering_active)) {
return;
}
-
+
_meter->notify_metering_state_changed (*_surface, transport_is_rolling, metering_active);
-
+
if (!transport_is_rolling || !metering_active) {
notify_property_changed (PBD::PropertyChange (ARDOUR::Properties::name));
notify_panner_azi_changed (true);
}
-
+
_transport_is_rolling = transport_is_rolling;
_metering_active = metering_active;
}