2017-10-05 11:54:46 -04:00
|
|
|
/*
|
2019-08-03 08:34:29 -04:00
|
|
|
* Copyright (C) 2017 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
* Copyright (C) 2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
#include <vector>
|
|
|
|
#include <climits>
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
#include <glibmm/convert.h>
|
|
|
|
|
|
|
|
#include "midi++/port.h"
|
|
|
|
|
|
|
|
#include "pbd/compose.h"
|
|
|
|
#include "pbd/convert.h"
|
|
|
|
|
2020-09-21 16:28:23 -04:00
|
|
|
#include "temporal/timeline.h"
|
|
|
|
|
2017-10-05 11:54:46 -04:00
|
|
|
#include "ardour/amp.h"
|
|
|
|
#include "ardour/bundle.h"
|
|
|
|
#include "ardour/debug.h"
|
|
|
|
#include "ardour/midi_ui.h"
|
|
|
|
#include "ardour/meter.h"
|
|
|
|
#include "ardour/monitor_control.h"
|
|
|
|
#include "ardour/plugin_insert.h"
|
|
|
|
#include "ardour/panner.h"
|
|
|
|
#include "ardour/panner_shell.h"
|
|
|
|
#include "ardour/phase_control.h"
|
|
|
|
#include "ardour/rc_configuration.h"
|
|
|
|
#include "ardour/record_enable_control.h"
|
|
|
|
#include "ardour/route.h"
|
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "ardour/send.h"
|
|
|
|
#include "ardour/solo_isolate_control.h"
|
|
|
|
#include "ardour/track.h"
|
|
|
|
#include "ardour/midi_track.h"
|
|
|
|
#include "ardour/user_bundle.h"
|
|
|
|
#include "ardour/profile.h"
|
|
|
|
#include "ardour/value_as_string.h"
|
2024-01-12 21:08:51 -05:00
|
|
|
#include "ardour/well_known_enum.h"
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
#include "us2400_control_protocol.h"
|
|
|
|
#include "surface_port.h"
|
|
|
|
#include "surface.h"
|
|
|
|
#include "strip.h"
|
|
|
|
#include "button.h"
|
|
|
|
#include "led.h"
|
|
|
|
#include "pot.h"
|
|
|
|
#include "fader.h"
|
|
|
|
#include "jog.h"
|
|
|
|
#include "meter.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace PBD;
|
|
|
|
using namespace ArdourSurface;
|
|
|
|
using namespace US2400;
|
|
|
|
|
|
|
|
#ifndef timeradd /// only avail with __USE_BSD
|
|
|
|
#define timeradd(a,b,result) \
|
|
|
|
do { \
|
|
|
|
(result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
|
|
|
|
(result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
|
|
|
|
if ((result)->tv_usec >= 1000000) \
|
|
|
|
{ \
|
|
|
|
++(result)->tv_sec; \
|
|
|
|
(result)->tv_usec -= 1000000; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define ui_context() US2400Protocol::instance() /* a UICallback-derived object that specifies the event loop for signal handling */
|
|
|
|
|
|
|
|
Strip::Strip (Surface& s, const std::string& name, int index, const map<Button::ID,StripButtonInfo>& strip_buttons)
|
|
|
|
: Group (name)
|
|
|
|
, _solo (0)
|
|
|
|
, _mute (0)
|
|
|
|
, _select (0)
|
|
|
|
, _fader_touch (0)
|
|
|
|
, _vpot (0)
|
|
|
|
, _fader (0)
|
|
|
|
, _meter (0)
|
|
|
|
, _index (index)
|
|
|
|
, _surface (&s)
|
|
|
|
, _controls_locked (false)
|
|
|
|
, _transport_is_rolling (false)
|
|
|
|
, _metering_active (true)
|
|
|
|
, _pan_mode (PanAzimuthAutomation)
|
|
|
|
{
|
|
|
|
_fader = dynamic_cast<Fader*> (Fader::factory (*_surface, index, "fader", *this));
|
|
|
|
_vpot = dynamic_cast<Pot*> (Pot::factory (*_surface, Pot::ID + index, "vpot", *this));
|
|
|
|
|
|
|
|
if (s.mcp().device_info().has_meters()) {
|
|
|
|
_meter = dynamic_cast<Meter*> (Meter::factory (*_surface, index, "meter", *this));
|
|
|
|
}
|
|
|
|
|
|
|
|
for (map<Button::ID,StripButtonInfo>::const_iterator b = strip_buttons.begin(); b != strip_buttons.end(); ++b) {
|
2022-06-21 23:46:54 -04:00
|
|
|
DEBUG_RESULT_CAST (Button*, bb, dynamic_cast<Button*>, (Button::factory (*_surface, b->first, b->second.base_id + index, b->second.name, *this)));
|
2017-10-05 11:54:46 -04:00
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose ("surface %1 strip %2 new button BID %3 id %4 from base %5\n",
|
|
|
|
_surface->number(), index, Button::id_to_name (bb->bid()),
|
|
|
|
bb->id(), b->second.base_id));
|
|
|
|
}
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-05 11:54:46 -04:00
|
|
|
_trickle_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Strip::~Strip ()
|
|
|
|
{
|
|
|
|
/* surface is responsible for deleting all controls */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::add (Control & control)
|
|
|
|
{
|
|
|
|
Button* button;
|
|
|
|
|
|
|
|
Group::add (control);
|
|
|
|
|
|
|
|
/* fader, vpot, meter were all set explicitly */
|
|
|
|
|
|
|
|
if ((button = dynamic_cast<Button*>(&control)) != 0) {
|
|
|
|
switch (button->bid()) {
|
|
|
|
case Button::Mute:
|
|
|
|
_mute = button;
|
|
|
|
break;
|
|
|
|
case Button::Solo:
|
|
|
|
_solo = button;
|
|
|
|
break;
|
|
|
|
case Button::Select:
|
|
|
|
_select = button;
|
|
|
|
break;
|
|
|
|
case Button::FaderTouch:
|
|
|
|
_fader_touch = button;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
Strip::set_stripable (std::shared_ptr<Stripable> r, bool /*with_messages*/)
|
2017-10-05 11:54:46 -04:00
|
|
|
{
|
|
|
|
if (_controls_locked) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
stripable_connections.drop_connections ();
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
_solo->set_control (std::shared_ptr<AutomationControl>());
|
|
|
|
_mute->set_control (std::shared_ptr<AutomationControl>());
|
|
|
|
_select->set_control (std::shared_ptr<AutomationControl>());
|
2017-10-05 11:54:46 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
_fader->set_control (std::shared_ptr<AutomationControl>());
|
|
|
|
_vpot->set_control (std::shared_ptr<AutomationControl>());
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
_stripable = r;
|
|
|
|
|
2017-10-19 12:53:08 -04:00
|
|
|
mark_dirty ();
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
if (!r) {
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose ("Surface %1 Strip %2 mapped to null route\n", _surface->number(), _index));
|
|
|
|
zero ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose ("Surface %1 strip %2 now mapping stripable %3\n",
|
|
|
|
_surface->number(), _index, _stripable->name()));
|
|
|
|
|
|
|
|
_solo->set_control (_stripable->solo_control());
|
|
|
|
_mute->set_control (_stripable->mute_control());
|
|
|
|
|
2024-10-18 19:51:44 -04:00
|
|
|
_stripable->solo_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, std::bind (&Strip::notify_solo_changed, this), ui_context());
|
|
|
|
_stripable->mute_control()->Changed.connect(stripable_connections, MISSING_INVALIDATOR, std::bind (&Strip::notify_mute_changed, this), ui_context());
|
2017-10-05 11:54:46 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> pan_control = _stripable->pan_azimuth_control();
|
2017-10-05 11:54:46 -04:00
|
|
|
if (pan_control) {
|
2024-10-18 19:51:44 -04:00
|
|
|
pan_control->Changed.connect(stripable_connections, MISSING_INVALIDATOR, std::bind (&Strip::notify_panner_azi_changed, this, false), ui_context());
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
pan_control = _stripable->pan_width_control();
|
|
|
|
if (pan_control) {
|
2024-10-18 19:51:44 -04:00
|
|
|
pan_control->Changed.connect(stripable_connections, MISSING_INVALIDATOR, std::bind (&Strip::notify_panner_width_changed, this, false), ui_context());
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
|
|
|
|
2024-10-18 19:51:44 -04:00
|
|
|
_stripable->gain_control()->Changed.connect(stripable_connections, MISSING_INVALIDATOR, std::bind (&Strip::notify_gain_changed, this, false), ui_context());
|
|
|
|
_stripable->PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, std::bind (&Strip::notify_property_changed, this, _1), ui_context());
|
|
|
|
_stripable->presentation_info().PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, std::bind (&Strip::notify_property_changed, this, _1), ui_context());
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
// TODO this works when a currently-banked stripable is made inactive, but not
|
|
|
|
// when a stripable is activated which should be currently banked.
|
|
|
|
|
2024-10-18 19:51:44 -04:00
|
|
|
_stripable->DropReferences.connect (stripable_connections, MISSING_INVALIDATOR, std::bind (&Strip::notify_stripable_deleted, this), ui_context());
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
/* setup legal VPot modes for this stripable */
|
|
|
|
|
|
|
|
possible_pot_parameters.clear();
|
|
|
|
|
|
|
|
if (_stripable->pan_azimuth_control()) {
|
|
|
|
possible_pot_parameters.push_back (PanAzimuthAutomation);
|
|
|
|
}
|
|
|
|
if (_stripable->pan_width_control()) {
|
|
|
|
possible_pot_parameters.push_back (PanWidthAutomation);
|
|
|
|
}
|
|
|
|
if (_stripable->pan_elevation_control()) {
|
|
|
|
possible_pot_parameters.push_back (PanElevationAutomation);
|
|
|
|
}
|
|
|
|
if (_stripable->pan_frontback_control()) {
|
|
|
|
possible_pot_parameters.push_back (PanFrontBackAutomation);
|
|
|
|
}
|
|
|
|
if (_stripable->pan_lfe_control()) {
|
|
|
|
possible_pot_parameters.push_back (PanLFEAutomation);
|
|
|
|
}
|
|
|
|
|
|
|
|
_pan_mode = PanAzimuthAutomation;
|
|
|
|
|
|
|
|
if (_surface->mcp().subview_mode() == US2400Protocol::None) {
|
|
|
|
set_vpot_parameter (_pan_mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
_fader->set_control (_stripable->gain_control());
|
|
|
|
|
|
|
|
notify_all ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::reset_stripable ()
|
|
|
|
{
|
|
|
|
stripable_connections.drop_connections ();
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
_solo->set_control (std::shared_ptr<AutomationControl>());
|
|
|
|
_mute->set_control (std::shared_ptr<AutomationControl>());
|
|
|
|
_select->set_control (std::shared_ptr<AutomationControl>());
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
_fader->reset_control ();
|
|
|
|
_vpot->reset_control ();
|
|
|
|
|
|
|
|
_stripable.reset();
|
|
|
|
|
2017-10-19 12:53:08 -04:00
|
|
|
mark_dirty ();
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
notify_all ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_all()
|
|
|
|
{
|
2019-04-13 13:19:29 -04:00
|
|
|
#if 0
|
|
|
|
if (!_stripable) {
|
|
|
|
zero ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2017-10-05 11:54:46 -04:00
|
|
|
// The active V-pot control may not be active for this strip
|
|
|
|
// But if we zero it in the controls function it may erase
|
|
|
|
// the one we do want
|
2019-04-13 13:19:29 -04:00
|
|
|
#if 0
|
|
|
|
_surface->write (_vpot->zero());
|
|
|
|
#endif
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
notify_solo_changed ();
|
|
|
|
notify_mute_changed ();
|
|
|
|
notify_gain_changed ();
|
|
|
|
notify_property_changed (PBD::PropertyChange (ARDOUR::Properties::name));
|
|
|
|
notify_property_changed (PBD::PropertyChange (ARDOUR::Properties::selected));
|
|
|
|
notify_panner_azi_changed ();
|
|
|
|
notify_vpot_change ();
|
|
|
|
notify_panner_width_changed ();
|
|
|
|
notify_record_enable_changed ();
|
2019-04-13 13:19:29 -04:00
|
|
|
#if 0
|
|
|
|
notify_processor_changed ();
|
|
|
|
#endif
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_solo_changed ()
|
|
|
|
{
|
2019-04-13 13:19:29 -04:00
|
|
|
#if 0
|
|
|
|
if (_stripable && _solo) {
|
|
|
|
_surface->write (_solo->set_state (_stripable->solo_control()->soloed() ? on : off));
|
|
|
|
}
|
|
|
|
#endif
|
2017-10-05 11:54:46 -04:00
|
|
|
|
2017-10-19 12:53:08 -04:00
|
|
|
_solo->mark_dirty ();
|
2017-10-05 11:54:46 -04:00
|
|
|
_trickle_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_mute_changed ()
|
|
|
|
{
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose ("Strip %1 mute changed\n", _index));
|
2019-04-13 13:19:29 -04:00
|
|
|
#if 0
|
|
|
|
if (_stripable && _mute) {
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose ("\tstripable muted ? %1\n", _stripable->mute_control()->muted()));
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose ("mute message: %1\n", _mute->set_state (_stripable->mute_control()->muted() ? on : off)));
|
|
|
|
|
|
|
|
_surface->write (_mute->set_state (_stripable->mute_control()->muted() ? on : off));
|
|
|
|
} else {
|
|
|
|
_surface->write (_mute->zero());
|
|
|
|
}
|
|
|
|
#endif
|
2017-10-05 11:54:46 -04:00
|
|
|
|
2017-10-19 12:53:08 -04:00
|
|
|
_mute->mark_dirty ();
|
2017-10-05 11:54:46 -04:00
|
|
|
_trickle_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_record_enable_changed ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_stripable_deleted ()
|
|
|
|
{
|
|
|
|
_surface->mcp().notify_stripable_removed ();
|
|
|
|
_surface->mcp().refresh_current_bank();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_gain_changed (bool force_update)
|
|
|
|
{
|
2017-10-19 12:53:08 -04:00
|
|
|
_fader->mark_dirty();
|
2017-10-05 11:54:46 -04:00
|
|
|
_trickle_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_processor_changed (bool force_update)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_property_changed (const PropertyChange& what_changed)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::update_selection_state ()
|
|
|
|
{
|
2017-10-19 12:53:08 -04:00
|
|
|
_select->mark_dirty ();
|
2017-10-05 11:54:46 -04:00
|
|
|
_trickle_counter = 0;
|
2019-04-13 13:19:29 -04:00
|
|
|
#if 0
|
|
|
|
if(_stripable) {
|
|
|
|
_surface->write (_select->set_state (_stripable->is_selected()));
|
|
|
|
}
|
|
|
|
#endif
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::show_stripable_name ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_vpot_change ()
|
|
|
|
{
|
2017-10-19 12:53:08 -04:00
|
|
|
_vpot->mark_dirty();
|
2017-10-05 11:54:46 -04:00
|
|
|
_trickle_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_panner_azi_changed (bool force_update)
|
|
|
|
{
|
2017-10-19 12:53:08 -04:00
|
|
|
_vpot->mark_dirty();
|
2017-10-05 11:54:46 -04:00
|
|
|
_trickle_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_panner_width_changed (bool force_update)
|
|
|
|
{
|
|
|
|
_trickle_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::select_event (Button&, ButtonState bs)
|
|
|
|
{
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, "select button\n");
|
|
|
|
|
|
|
|
if (bs == press) {
|
|
|
|
|
|
|
|
int ms = _surface->mcp().main_modifier_state();
|
|
|
|
|
|
|
|
if (ms & US2400Protocol::MODIFIER_CMDALT) {
|
|
|
|
_controls_locked = !_controls_locked;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, "add select button on press\n");
|
|
|
|
_surface->mcp().add_down_select_button (_surface->number(), _index);
|
|
|
|
_surface->mcp().select_range (_surface->mcp().global_index (*this));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, "remove select button on release\n");
|
|
|
|
_surface->mcp().remove_down_select_button (_surface->number(), _index);
|
|
|
|
}
|
2017-10-19 12:53:08 -04:00
|
|
|
|
|
|
|
_trickle_counter = 0;
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::vselect_event (Button&, ButtonState bs)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::fader_touch_event (Button&, ButtonState bs)
|
|
|
|
{
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose ("fader touch, press ? %1\n", (bs == press)));
|
|
|
|
|
|
|
|
if (bs == press) {
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> ac = _fader->control ();
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
_fader->set_in_use (true);
|
2020-09-21 16:28:23 -04:00
|
|
|
_fader->start_touch (timepos_t (_surface->mcp().transport_sample()));
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
_fader->set_in_use (false);
|
2020-09-21 16:28:23 -04:00
|
|
|
_fader->stop_touch (timepos_t (_surface->mcp().transport_sample()));
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::handle_button (Button& button, ButtonState bs)
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> control;
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
if (bs == press) {
|
|
|
|
button.set_in_use (true);
|
|
|
|
} else {
|
|
|
|
button.set_in_use (false);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, 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::FaderTouch:
|
|
|
|
fader_touch_event (button, bs);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if ((control = button.control ())) {
|
|
|
|
if (bs == press) {
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, "add button on press\n");
|
|
|
|
_surface->mcp().add_down_button ((AutomationType) control->parameter().type(), _surface->number(), _index);
|
|
|
|
|
|
|
|
float 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
US2400Protocol::ControlList controls = _surface->mcp().down_controls ((AutomationType) control->parameter().type(),
|
|
|
|
_surface->mcp().global_index(*this));
|
|
|
|
|
|
|
|
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose ("there are %1 buttons down for control type %2, new value = %3\n",
|
|
|
|
controls.size(), control->parameter().type(), new_value));
|
|
|
|
|
|
|
|
/* apply change, with potential modifier semantics */
|
|
|
|
|
|
|
|
Controllable::GroupControlDisposition gcd;
|
|
|
|
|
|
|
|
if (_surface->mcp().main_modifier_state() & US2400Protocol::MODIFIER_SHIFT) {
|
|
|
|
gcd = Controllable::InverseGroup;
|
|
|
|
} else {
|
|
|
|
gcd = Controllable::UseGroup;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (US2400Protocol::ControlList::iterator c = controls.begin(); c != controls.end(); ++c) {
|
|
|
|
(*c)->set_value (new_value, gcd);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, "remove button on release\n");
|
|
|
|
_surface->mcp().remove_down_button ((AutomationType) control->parameter().type(), _surface->number(), _index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::handle_fader_touch (Fader& fader, bool touch_on)
|
|
|
|
{
|
|
|
|
if (touch_on) {
|
2020-09-21 16:28:23 -04:00
|
|
|
fader.start_touch (timepos_t (_surface->mcp().transport_sample()));
|
2017-10-05 11:54:46 -04:00
|
|
|
} else {
|
2020-09-21 16:28:23 -04:00
|
|
|
fader.stop_touch (timepos_t (_surface->mcp().transport_sample()));
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::handle_fader (Fader& fader, float position)
|
|
|
|
{
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose ("fader to %1\n", position));
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> ac = fader.control();
|
2017-10-05 11:54:46 -04:00
|
|
|
if (!ac) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Controllable::GroupControlDisposition gcd = Controllable::UseGroup;
|
|
|
|
|
|
|
|
if (_surface->mcp().main_modifier_state() & US2400Protocol::MODIFIER_SHIFT) {
|
|
|
|
gcd = Controllable::InverseGroup;
|
|
|
|
}
|
|
|
|
|
|
|
|
fader.set_value (position, gcd);
|
|
|
|
|
|
|
|
/* From the Mackie Control MIDI implementation docs:
|
|
|
|
|
|
|
|
In order to ensure absolute synchronization with the host software,
|
|
|
|
Mackie Control uses a closed-loop servo system for the faders,
|
|
|
|
meaning the faders will always move to their last received position.
|
|
|
|
When a host receives a Fader Position Message, it must then
|
|
|
|
re-transmit that message to the Mackie Control or else the faders
|
|
|
|
will return to their last position.
|
|
|
|
*/
|
|
|
|
|
|
|
|
_surface->write (fader.set_position (position));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::handle_pot (Pot& pot, float delta)
|
|
|
|
{
|
|
|
|
/* Pots only emit events when they move, not when they
|
|
|
|
stop moving. So to get a stop event, we need to use a timeout.
|
|
|
|
*/
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> ac = pot.control();
|
2017-10-05 11:54:46 -04:00
|
|
|
if (!ac) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Controllable::GroupControlDisposition gcd;
|
|
|
|
|
|
|
|
if (_surface->mcp().main_modifier_state() & US2400Protocol::MODIFIER_SHIFT) {
|
|
|
|
gcd = Controllable::InverseGroup;
|
|
|
|
} else {
|
|
|
|
gcd = Controllable::UseGroup;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ac->toggled()) {
|
|
|
|
|
|
|
|
/* make it like a single-step, directional switch */
|
|
|
|
|
|
|
|
if (delta > 0) {
|
|
|
|
ac->set_value (1.0, gcd);
|
|
|
|
} else {
|
|
|
|
ac->set_value (0.0, gcd);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (ac->desc().enumeration || ac->desc().integer_step) {
|
|
|
|
|
|
|
|
/* use Controllable::get_value() to avoid the
|
|
|
|
* "scaling-to-interface" that takes place in
|
|
|
|
* Control::get_value() via the pot member.
|
|
|
|
*
|
|
|
|
* an enumeration with 4 values will have interface values of
|
|
|
|
* 0.0, 0.25, 0.5 and 0.75 or some similar oddness. Lets not
|
|
|
|
* deal with that.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (delta > 0) {
|
|
|
|
ac->set_value (min (ac->upper(), ac->get_value() + 1.0), gcd);
|
|
|
|
} else {
|
|
|
|
ac->set_value (max (ac->lower(), ac->get_value() - 1.0), gcd);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
2020-06-17 18:19:29 -04:00
|
|
|
ac->set_interface ((ac->internal_to_interface (ac->get_value(), true) + delta), true, gcd);
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-06-27 11:32:12 -04:00
|
|
|
Strip::periodic (PBD::microseconds_t now)
|
2017-10-05 11:54:46 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
update_meter ();
|
|
|
|
|
2017-10-19 12:53:08 -04:00
|
|
|
if ( _trickle_counter %24 == 0 ) {
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
if ( _fader->control() ) {
|
|
|
|
_surface->write (_fader->set_position (_fader->control()->internal_to_interface (_fader->control()->get_value ())));
|
|
|
|
} else {
|
|
|
|
_surface->write (_fader->set_position(0.0));
|
|
|
|
}
|
|
|
|
|
2021-08-03 11:36:39 -04:00
|
|
|
bool showing_pan = false;
|
|
|
|
if (_pan_mode >= PanAzimuthAutomation && _pan_mode <= PanLFEAutomation) {
|
|
|
|
showing_pan = true;
|
|
|
|
}
|
|
|
|
if (_pan_mode == SendAzimuthAutomation) {
|
|
|
|
showing_pan = true;
|
|
|
|
}
|
|
|
|
|
2017-10-05 11:54:46 -04:00
|
|
|
if ( _vpot->control() ) {
|
2021-08-03 11:36:39 -04:00
|
|
|
_surface->write (_vpot->set (_vpot->control()->internal_to_interface (_vpot->control()->get_value (), showing_pan ? true: false), true));
|
2017-10-05 11:54:46 -04:00
|
|
|
} else {
|
|
|
|
_surface->write (_vpot->set(0.0, false));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_stripable) {
|
|
|
|
_surface->write (_solo->set_state (_stripable->solo_control()->soloed() ? on : off));
|
|
|
|
_surface->write (_mute->set_state (_stripable->mute_control()->muted() ? on : off));
|
|
|
|
_surface->write (_select->set_state (_stripable->is_selected()));
|
|
|
|
} else {
|
|
|
|
_surface->write (_solo->set_state (off));
|
|
|
|
_surface->write (_mute->set_state (off));
|
|
|
|
_surface->write (_select->set_state (off));
|
|
|
|
}
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-19 12:53:08 -04:00
|
|
|
//after a hard write, queue us for trickling data later
|
|
|
|
if (_trickle_counter == 0)
|
|
|
|
_trickle_counter = global_index()+1;
|
|
|
|
|
2017-10-05 11:54:46 -04:00
|
|
|
_trickle_counter++;
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-06-27 11:32:12 -04:00
|
|
|
Strip::redisplay (PBD::microseconds_t now, bool force)
|
2017-10-05 11:54:46 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::update_automation ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::update_meter ()
|
|
|
|
{
|
|
|
|
if (!_stripable) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_meter && _transport_is_rolling && _metering_active && _stripable->peak_meter()) {
|
|
|
|
float dB = _stripable->peak_meter()->meter_level (0, MeterMCP);
|
|
|
|
_meter->send_update (*_surface, dB);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::zero ()
|
|
|
|
{
|
|
|
|
_trickle_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::lock_controls ()
|
|
|
|
{
|
|
|
|
_controls_locked = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::unlock_controls ()
|
|
|
|
{
|
|
|
|
_controls_locked = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
string
|
|
|
|
Strip::vpot_mode_string ()
|
|
|
|
{
|
|
|
|
return "???";
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::next_pot_mode ()
|
|
|
|
{
|
|
|
|
vector<AutomationType>::iterator i;
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> ac = _vpot->control();
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
if (!ac) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_surface->mcp().subview_mode() != US2400Protocol::None) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (possible_pot_parameters.empty() || (possible_pot_parameters.size() == 1 && possible_pot_parameters.front() == ac->parameter().type())) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = possible_pot_parameters.begin(); i != possible_pot_parameters.end(); ++i) {
|
|
|
|
if ((*i) == ac->parameter().type()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* move to the next mode in the list, or back to the start (which will
|
|
|
|
also happen if the current mode is not in the current pot mode list)
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (i != possible_pot_parameters.end()) {
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == possible_pot_parameters.end()) {
|
|
|
|
i = possible_pot_parameters.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
set_vpot_parameter (*i);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
/*
|
2017-10-26 15:46:00 -04:00
|
|
|
*
|
2017-10-05 11:54:46 -04:00
|
|
|
* name: Strip::subview_mode_changed
|
|
|
|
* @param
|
|
|
|
* @return
|
2017-10-26 15:46:00 -04:00
|
|
|
*
|
2017-10-05 11:54:46 -04:00
|
|
|
*/
|
|
|
|
Strip::subview_mode_changed ()
|
|
|
|
{
|
|
|
|
switch (_surface->mcp().subview_mode()) {
|
|
|
|
|
|
|
|
case US2400Protocol::None:
|
|
|
|
set_vpot_parameter (_pan_mode);
|
|
|
|
notify_metering_state_changed ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case US2400Protocol::TrackView:
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Stripable> r = _surface->mcp().subview_stripable();
|
2017-10-05 11:54:46 -04:00
|
|
|
if (r) {
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose("subview_mode_changed strip %1:%2- assigning trackview pot\n", _surface->number(), _index));
|
|
|
|
setup_trackview_vpot (r);
|
|
|
|
} else {
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose("subview_mode_changed strip %1:%2 - no stripable\n", _surface->number(), _index));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_trickle_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
Strip::setup_dyn_vpot (std::shared_ptr<Stripable> r)
|
2017-10-05 11:54:46 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
Strip::setup_eq_vpot (std::shared_ptr<Stripable> r)
|
2017-10-05 11:54:46 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
Strip::setup_sends_vpot (std::shared_ptr<Stripable> r)
|
2017-10-05 11:54:46 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
Strip::setup_trackview_vpot (std::shared_ptr<Stripable> r)
|
2017-10-05 11:54:46 -04:00
|
|
|
{
|
|
|
|
subview_connections.drop_connections ();
|
|
|
|
|
|
|
|
if (!r) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-10-18 19:51:44 -04:00
|
|
|
r->MappedControlsChanged.connect (subview_connections, MISSING_INVALIDATOR, std::bind (&Strip::subview_mode_changed, this), ui_context());
|
2017-10-05 11:54:46 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> pc;
|
|
|
|
std::shared_ptr<Track> track = std::dynamic_pointer_cast<Track> (r);
|
2017-10-05 11:54:46 -04:00
|
|
|
string label;
|
|
|
|
|
|
|
|
_vpot->set_mode(Pot::wrap);
|
|
|
|
|
2017-10-26 15:45:16 -04:00
|
|
|
const uint32_t global_pos = _surface->mcp().global_index (*this);
|
2017-10-15 19:13:28 -04:00
|
|
|
|
2022-04-20 12:58:48 -04:00
|
|
|
#ifdef MIXBUS
|
|
|
|
|
2017-10-15 19:13:28 -04:00
|
|
|
//Trim & dynamics
|
|
|
|
switch (global_pos) {
|
|
|
|
case 0:
|
|
|
|
pc = r->trim_control ();
|
|
|
|
_vpot->set_mode(Pot::boost_cut);
|
|
|
|
break;
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-15 19:13:28 -04:00
|
|
|
case 1:
|
|
|
|
pc = r->pan_azimuth_control ();
|
|
|
|
_vpot->set_mode(Pot::dot);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2024-01-12 21:08:51 -05:00
|
|
|
pc = r->mapped_control (Comp_Threshold);
|
2017-10-15 19:13:28 -04:00
|
|
|
break;
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-15 19:13:28 -04:00
|
|
|
case 3:
|
2024-01-12 21:08:51 -05:00
|
|
|
pc = r->mapped_control (Comp_Attack);
|
2017-10-15 19:13:28 -04:00
|
|
|
break;
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-15 19:13:28 -04:00
|
|
|
case 4:
|
2024-01-12 21:08:51 -05:00
|
|
|
pc = r->mapped_control (Comp_Mode);
|
2017-10-15 19:13:28 -04:00
|
|
|
_vpot->set_mode(Pot::wrap);
|
|
|
|
break;
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-15 19:13:28 -04:00
|
|
|
case 5:
|
2024-01-12 21:08:51 -05:00
|
|
|
pc = r->mapped_control (Comp_Makeup);
|
2017-10-15 19:13:28 -04:00
|
|
|
break;
|
2017-10-26 15:46:00 -04:00
|
|
|
|
|
|
|
|
2017-10-15 19:13:28 -04:00
|
|
|
} //trim & dynamics
|
2017-10-26 15:46:00 -04:00
|
|
|
|
|
|
|
|
2017-10-15 19:13:28 -04:00
|
|
|
//EQ
|
2017-10-05 11:54:46 -04:00
|
|
|
int eq_band = -1;
|
2017-10-17 14:27:08 -04:00
|
|
|
if (r->mixbus () || r->is_master()) {
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-15 19:13:28 -04:00
|
|
|
switch (global_pos) {
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
pc = r->pan_width_control();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7:
|
2024-01-12 21:08:51 -05:00
|
|
|
pc = r->mapped_control (TapeDrive_Drive);
|
2017-10-15 19:13:28 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
case 10:
|
|
|
|
eq_band = (global_pos-8);
|
2024-01-15 09:28:30 -05:00
|
|
|
pc = r->mapped_control (EQ_BandGain, eq_band);
|
2017-10-15 19:13:28 -04:00
|
|
|
_vpot->set_mode(Pot::boost_cut);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (r->is_input_strip ()) {
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
switch (global_pos) {
|
|
|
|
case 6:
|
2024-01-12 21:08:51 -05:00
|
|
|
pc = r->mapped_control (HPF_Freq);
|
2017-10-05 11:54:46 -04:00
|
|
|
break;
|
|
|
|
case 7:
|
2024-01-12 21:08:51 -05:00
|
|
|
pc = r->mapped_control (LPF_Freq);
|
2017-10-05 11:54:46 -04:00
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
case 10:
|
|
|
|
case 12:
|
|
|
|
case 14: {
|
|
|
|
eq_band = (global_pos-8) / 2;
|
2024-01-15 09:28:30 -05:00
|
|
|
pc = r->mapped_control (EQ_BandFreq, eq_band);
|
2017-10-05 11:54:46 -04:00
|
|
|
} break;
|
|
|
|
case 9:
|
|
|
|
case 11:
|
|
|
|
case 13:
|
|
|
|
case 15: {
|
|
|
|
eq_band = (global_pos-8) / 2;
|
2024-01-15 09:28:30 -05:00
|
|
|
pc = r->mapped_control (EQ_BandGain, eq_band);
|
2017-10-05 11:54:46 -04:00
|
|
|
_vpot->set_mode(Pot::boost_cut);
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//mixbus sends
|
|
|
|
switch (global_pos) {
|
|
|
|
case 16:
|
|
|
|
case 17:
|
|
|
|
case 18:
|
|
|
|
case 19:
|
|
|
|
case 20:
|
|
|
|
case 21:
|
|
|
|
case 22:
|
|
|
|
case 23:
|
2022-04-22 10:17:01 -04:00
|
|
|
pc = r->send_level_controllable ( global_pos - 16 + (_surface->mcp().get_sends_bank() * 8));
|
2017-10-05 11:54:46 -04:00
|
|
|
break;
|
|
|
|
} //global_pos switch
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-05 11:54:46 -04:00
|
|
|
} //if input_strip
|
2022-04-20 12:58:48 -04:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
switch (global_pos) {
|
|
|
|
// Track view equivalent
|
|
|
|
case 0:
|
|
|
|
pc = r->trim_control ();
|
|
|
|
_vpot->set_mode(Pot::boost_cut);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
pc = r->monitoring_control ();
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
pc = r->solo_isolate_control ();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
pc = r->solo_safe_control ();
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
pc = r->phase_control ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Sends
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
case 14:
|
|
|
|
case 15:
|
|
|
|
case 16:
|
|
|
|
case 17:
|
|
|
|
case 18:
|
|
|
|
case 19:
|
|
|
|
case 20:
|
|
|
|
case 21:
|
|
|
|
case 22:
|
|
|
|
case 23:
|
2022-04-20 14:08:03 -04:00
|
|
|
pc = r->send_level_controllable (global_pos - 8 + (_surface->mcp().get_sends_bank() * 16));
|
2022-04-20 12:58:48 -04:00
|
|
|
break;
|
|
|
|
}
|
2017-10-05 11:54:46 -04:00
|
|
|
#endif //ifdef MIXBUS
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-05 11:54:46 -04:00
|
|
|
if (pc) { //control found; set our knob to watch for changes in it
|
|
|
|
_vpot->set_control (pc);
|
2024-10-18 19:51:44 -04:00
|
|
|
pc->Changed.connect (subview_connections, MISSING_INVALIDATOR, std::bind (&Strip::notify_vpot_change, this), ui_context());
|
2017-10-05 11:54:46 -04:00
|
|
|
} else { //no control, just set the knob to "empty"
|
|
|
|
_vpot->reset_control ();
|
|
|
|
}
|
2017-10-26 15:46:00 -04:00
|
|
|
|
2017-10-05 11:54:46 -04:00
|
|
|
notify_vpot_change ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::set_vpot_parameter (AutomationType p)
|
|
|
|
{
|
|
|
|
if (!_stripable || (p == NullAutomation)) {
|
2023-02-16 18:33:28 -05:00
|
|
|
_vpot->set_control (std::shared_ptr<AutomationControl>());
|
2017-10-05 11:54:46 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> pan_control;
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
DEBUG_TRACE (DEBUG::US2400, string_compose ("switch to vpot mode %1\n", p));
|
|
|
|
|
2017-10-19 12:53:08 -04:00
|
|
|
mark_dirty ();
|
2017-10-05 11:54:46 -04:00
|
|
|
|
|
|
|
switch (p) {
|
|
|
|
case PanAzimuthAutomation:
|
|
|
|
pan_control = _stripable->pan_azimuth_control ();
|
|
|
|
break;
|
|
|
|
case PanWidthAutomation:
|
|
|
|
pan_control = _stripable->pan_width_control ();
|
|
|
|
break;
|
|
|
|
case PanElevationAutomation:
|
|
|
|
break;
|
|
|
|
case PanFrontBackAutomation:
|
|
|
|
break;
|
|
|
|
case PanLFEAutomation:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pan_control) {
|
|
|
|
_pan_mode = p;
|
|
|
|
_vpot->set_mode (Pot::dot);
|
|
|
|
_vpot->set_control (pan_control);
|
|
|
|
}
|
|
|
|
|
|
|
|
notify_panner_azi_changed (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Strip::is_midi_track () const
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
return std::dynamic_pointer_cast<MidiTrack>(_stripable) != 0;
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-10-19 12:53:08 -04:00
|
|
|
Strip::mark_dirty ()
|
2017-10-05 11:54:46 -04:00
|
|
|
{
|
2017-10-19 12:53:08 -04:00
|
|
|
_fader->mark_dirty();
|
|
|
|
_vpot->mark_dirty();
|
|
|
|
_solo->mark_dirty();
|
|
|
|
_mute->mark_dirty();
|
|
|
|
_trickle_counter=0;
|
2017-10-05 11:54:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Strip::notify_metering_state_changed()
|
|
|
|
{
|
|
|
|
if (_surface->mcp().subview_mode() != US2400Protocol::None) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_stripable || !_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;
|
|
|
|
}
|