2015-11-24 18:00:11 -05:00
|
|
|
/*
|
2019-08-03 08:34:29 -04:00
|
|
|
* Copyright (C) 2015-2018 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
* Copyright (C) 2015-2018 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2016-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2015-11-24 18:00:11 -05:00
|
|
|
|
2015-11-24 21:10:22 -05:00
|
|
|
#include <cstdlib>
|
2015-11-24 18:00:11 -05:00
|
|
|
#include <sstream>
|
|
|
|
#include <algorithm>
|
|
|
|
|
2015-11-24 21:10:22 -05:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2015-11-24 18:00:11 -05:00
|
|
|
#include <glibmm/fileutils.h>
|
|
|
|
#include <glibmm/miscutils.h>
|
|
|
|
|
|
|
|
#include "pbd/error.h"
|
|
|
|
#include "pbd/failed_constructor.h"
|
|
|
|
#include "pbd/file_utils.h"
|
2015-11-24 21:41:44 -05:00
|
|
|
#include "pbd/pthread_utils.h"
|
2015-11-24 18:00:11 -05:00
|
|
|
#include "pbd/compose.h"
|
2015-11-24 21:41:44 -05:00
|
|
|
#include "pbd/xml++.h"
|
2015-11-24 18:00:11 -05:00
|
|
|
|
|
|
|
#include "midi++/port.h"
|
|
|
|
|
2015-11-25 12:37:29 -05:00
|
|
|
#include "ardour/async_midi_port.h"
|
2015-11-24 18:00:11 -05:00
|
|
|
#include "ardour/audioengine.h"
|
2015-11-25 15:52:58 -05:00
|
|
|
#include "ardour/amp.h"
|
2015-12-03 12:44:21 -05:00
|
|
|
#include "ardour/bundle.h"
|
2015-11-25 12:37:29 -05:00
|
|
|
#include "ardour/debug.h"
|
2015-11-24 18:00:11 -05:00
|
|
|
#include "ardour/filesystem_paths.h"
|
|
|
|
#include "ardour/midi_port.h"
|
|
|
|
#include "ardour/midiport_manager.h"
|
2015-11-25 17:20:00 -05:00
|
|
|
#include "ardour/monitor_processor.h"
|
2015-11-27 16:34:01 -05:00
|
|
|
#include "ardour/profile.h"
|
2015-11-25 12:37:29 -05:00
|
|
|
#include "ardour/rc_configuration.h"
|
2016-05-27 16:11:55 -04:00
|
|
|
#include "ardour/record_enable_control.h"
|
2016-05-17 11:42:31 -04:00
|
|
|
#include "ardour/stripable.h"
|
2015-11-25 12:37:29 -05:00
|
|
|
#include "ardour/session.h"
|
2015-12-01 18:45:43 -05:00
|
|
|
#include "ardour/session_configuration.h"
|
2015-11-25 12:37:29 -05:00
|
|
|
#include "ardour/track.h"
|
2015-11-24 18:00:11 -05:00
|
|
|
|
|
|
|
#include "faderport.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
2015-11-24 20:12:01 -05:00
|
|
|
using namespace ArdourSurface;
|
2015-11-24 18:00:11 -05:00
|
|
|
using namespace PBD;
|
|
|
|
using namespace Glib;
|
|
|
|
using namespace std;
|
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2015-11-24 18:00:11 -05:00
|
|
|
|
2015-11-24 21:41:44 -05:00
|
|
|
#include "pbd/abstract_ui.cc" // instantiate template
|
2015-11-24 18:00:11 -05:00
|
|
|
|
|
|
|
FaderPort::FaderPort (Session& s)
|
2022-10-20 13:34:26 -04:00
|
|
|
: MIDISurface (s, X_("PreSonus FaderPort"), X_("FaderPort"), false)
|
2015-11-24 18:00:11 -05:00
|
|
|
, gui (0)
|
|
|
|
, fader_msb (0)
|
|
|
|
, fader_lsb (0)
|
2015-11-25 13:22:35 -05:00
|
|
|
, fader_is_touched (false)
|
2015-11-24 22:32:40 -05:00
|
|
|
, button_state (ButtonState (0))
|
2015-11-24 23:06:19 -05:00
|
|
|
, blink_state (false)
|
2016-02-02 09:05:00 -05:00
|
|
|
, rec_enable_state (false)
|
2015-11-24 18:00:11 -05:00
|
|
|
{
|
2015-11-25 15:52:58 -05:00
|
|
|
last_encoder_time = 0;
|
2015-11-25 16:34:11 -05:00
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
buttons.insert (std::make_pair (Mute, Button (*this, _("Mute"), Mute, 21)));
|
|
|
|
buttons.insert (std::make_pair (Solo, Button (*this, _("Solo"), Solo, 22)));
|
|
|
|
buttons.insert (std::make_pair (Rec, Button (*this, _("Rec"), Rec, 23)));
|
|
|
|
buttons.insert (std::make_pair (Left, Button (*this, _("Left"), Left, 20)));
|
|
|
|
buttons.insert (std::make_pair (Bank, Button (*this, _("Bank"), Bank, 19)));
|
|
|
|
buttons.insert (std::make_pair (Right, Button (*this, _("Right"), Right, 18)));
|
|
|
|
buttons.insert (std::make_pair (Output, Button (*this, _("Output"), Output, 17)));
|
|
|
|
buttons.insert (std::make_pair (FP_Read, Button (*this, _("Read"), FP_Read, 13)));
|
|
|
|
buttons.insert (std::make_pair (FP_Write, Button (*this, _("Write"), FP_Write, 14)));
|
|
|
|
buttons.insert (std::make_pair (FP_Touch, Button (*this, _("Touch"), FP_Touch, 15)));
|
|
|
|
buttons.insert (std::make_pair (FP_Off, Button (*this, _("Off"), FP_Off, 16)));
|
|
|
|
buttons.insert (std::make_pair (Mix, Button (*this, _("Mix"), Mix, 12)));
|
|
|
|
buttons.insert (std::make_pair (Proj, Button (*this, _("Proj"), Proj, 11)));
|
|
|
|
buttons.insert (std::make_pair (Trns, Button (*this, _("Trns"), Trns, 10)));
|
|
|
|
buttons.insert (std::make_pair (Undo, Button (*this, _("Undo"), Undo, 9)));
|
|
|
|
buttons.insert (std::make_pair (Shift, Button (*this, _("Shift"), Shift, 5)));
|
|
|
|
buttons.insert (std::make_pair (Punch, Button (*this, _("Punch"), Punch, 6)));
|
|
|
|
buttons.insert (std::make_pair (User, Button (*this, _("User"), User, 7)));
|
|
|
|
buttons.insert (std::make_pair (Loop, Button (*this, _("Loop"), Loop, 8)));
|
|
|
|
buttons.insert (std::make_pair (Rewind, Button (*this, _("Rewind"), Rewind, 4)));
|
|
|
|
buttons.insert (std::make_pair (Ffwd, Button (*this, _("Ffwd"), Ffwd, 3)));
|
|
|
|
buttons.insert (std::make_pair (Stop, Button (*this, _("Stop"), Stop, 2)));
|
|
|
|
buttons.insert (std::make_pair (Play, Button (*this, _("Play"), Play, 1)));
|
|
|
|
buttons.insert (std::make_pair (RecEnable, Button (*this, _("RecEnable"), RecEnable, 0)));
|
2016-01-25 14:32:09 -05:00
|
|
|
buttons.insert (std::make_pair (Footswitch, Button (*this, _("Footswitch"), Footswitch, -1)));
|
2015-11-30 12:51:18 -05:00
|
|
|
buttons.insert (std::make_pair (FaderTouch, Button (*this, _("Fader (touch)"), FaderTouch, -1)));
|
|
|
|
|
2015-12-01 13:15:38 -05:00
|
|
|
get_button (Shift).set_flash (true);
|
|
|
|
get_button (Mix).set_flash (true);
|
|
|
|
get_button (Proj).set_flash (true);
|
|
|
|
get_button (Trns).set_flash (true);
|
|
|
|
get_button (User).set_flash (true);
|
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (Left).set_action ( boost::bind (&FaderPort::left, this), true);
|
|
|
|
get_button (Right).set_action ( boost::bind (&FaderPort::right, this), true);
|
|
|
|
|
|
|
|
get_button (Undo).set_action (boost::bind (&FaderPort::undo, this), true);
|
|
|
|
get_button (Undo).set_action (boost::bind (&FaderPort::redo, this), true, ShiftDown);
|
|
|
|
get_button (Undo).set_flash (true);
|
|
|
|
|
|
|
|
get_button (FP_Read).set_action (boost::bind (&FaderPort::read, this), true);
|
2015-12-14 14:42:12 -05:00
|
|
|
get_button (FP_Read).set_action (boost::bind (&FaderPort::off, this), false, LongPress);
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (FP_Write).set_action (boost::bind (&FaderPort::write, this), true);
|
2015-12-14 14:42:12 -05:00
|
|
|
get_button (FP_Write).set_action (boost::bind (&FaderPort::off, this), false, LongPress);
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (FP_Touch).set_action (boost::bind (&FaderPort::touch, this), true);
|
2015-12-14 14:42:12 -05:00
|
|
|
get_button (FP_Touch).set_action (boost::bind (&FaderPort::off, this), false, LongPress);
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (FP_Off).set_action (boost::bind (&FaderPort::off, this), true);
|
|
|
|
|
|
|
|
get_button (Play).set_action (boost::bind (&BasicUI::transport_play, this, true), true);
|
|
|
|
get_button (RecEnable).set_action (boost::bind (&BasicUI::rec_enable_toggle, this), true);
|
2015-11-24 23:06:19 -05:00
|
|
|
/* Stop is a modifier, so we have to use its own button state to get
|
|
|
|
the default action (since StopDown will be set when looking for the
|
|
|
|
action to invoke.
|
|
|
|
*/
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (Stop).set_action (boost::bind (&BasicUI::transport_stop, this), true, StopDown);
|
|
|
|
get_button (Ffwd).set_action (boost::bind (&BasicUI::ffwd, this), true);
|
2015-11-24 23:06:19 -05:00
|
|
|
|
|
|
|
/* See comments about Stop above .. */
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (Rewind).set_action (boost::bind (&BasicUI::rewind, this), true, RewindDown);
|
|
|
|
get_button (Rewind).set_action (boost::bind (&BasicUI::goto_zero, this), true, ButtonState (RewindDown|StopDown));
|
2016-06-17 15:49:06 -04:00
|
|
|
get_button (Rewind).set_action (boost::bind (&BasicUI::goto_start, this, false), true, ButtonState (RewindDown|ShiftDown));
|
2015-11-24 23:41:10 -05:00
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (Ffwd).set_action (boost::bind (&BasicUI::ffwd, this), true);
|
|
|
|
get_button (Ffwd).set_action (boost::bind (&BasicUI::goto_end, this), true, ShiftDown);
|
2015-11-24 23:27:55 -05:00
|
|
|
|
2015-12-01 10:35:30 -05:00
|
|
|
get_button (Punch).set_action (boost::bind (&FaderPort::punch, this), true);
|
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (Loop).set_action (boost::bind (&BasicUI::loop_toggle, this), true);
|
|
|
|
get_button (Loop).set_action (boost::bind (&BasicUI::add_marker, this, string()), true, ShiftDown);
|
2015-11-24 23:27:55 -05:00
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (Punch).set_action (boost::bind (&BasicUI::prev_marker, this), true, ShiftDown);
|
2018-10-04 20:29:14 -04:00
|
|
|
get_button (User).set_action (boost::bind (&BasicUI::next_marker, this), true, ShiftDown);
|
2015-11-24 23:27:55 -05:00
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (Mute).set_action (boost::bind (&FaderPort::mute, this), true);
|
|
|
|
get_button (Solo).set_action (boost::bind (&FaderPort::solo, this), true);
|
|
|
|
get_button (Rec).set_action (boost::bind (&FaderPort::rec_enable, this), true);
|
2015-11-25 16:34:11 -05:00
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button (Output).set_action (boost::bind (&FaderPort::use_master, this), true);
|
|
|
|
get_button (Output).set_action (boost::bind (&FaderPort::use_monitor, this), true, ShiftDown);
|
2022-10-20 13:34:26 -04:00
|
|
|
|
2023-09-14 14:14:55 -04:00
|
|
|
run_event_loop ();
|
2022-10-20 13:34:26 -04:00
|
|
|
port_setup ();
|
2015-11-24 18:00:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
FaderPort::~FaderPort ()
|
|
|
|
{
|
2022-10-20 13:34:26 -04:00
|
|
|
all_lights_out ();
|
2016-02-01 13:27:08 -05:00
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
MIDISurface::drop ();
|
2015-11-24 18:00:11 -05:00
|
|
|
|
|
|
|
tear_down_gui ();
|
2016-01-14 10:59:27 -05:00
|
|
|
|
|
|
|
/* stop event loop */
|
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, "BaseUI::quit ()\n");
|
2015-11-24 21:41:44 -05:00
|
|
|
|
|
|
|
BaseUI::quit ();
|
|
|
|
}
|
|
|
|
|
2015-11-24 21:10:22 -05:00
|
|
|
void
|
|
|
|
FaderPort::all_lights_out ()
|
|
|
|
{
|
|
|
|
for (ButtonMap::iterator b = buttons.begin(); b != buttons.end(); ++b) {
|
2022-10-20 13:34:26 -04:00
|
|
|
b->second.set_led_state (false);
|
2015-11-24 21:10:22 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
FaderPort::Button&
|
|
|
|
FaderPort::get_button (ButtonID id) const
|
2015-11-24 21:02:18 -05:00
|
|
|
{
|
2015-11-24 21:10:22 -05:00
|
|
|
ButtonMap::const_iterator b = buttons.find (id);
|
2015-11-24 21:02:18 -05:00
|
|
|
assert (b != buttons.end());
|
2015-11-30 12:51:18 -05:00
|
|
|
return const_cast<Button&>(b->second);
|
2015-11-24 21:02:18 -05:00
|
|
|
}
|
|
|
|
|
2015-12-01 13:15:38 -05:00
|
|
|
bool
|
|
|
|
FaderPort::button_long_press_timeout (ButtonID id)
|
|
|
|
{
|
|
|
|
if (buttons_down.find (id) != buttons_down.end()) {
|
2018-03-26 18:26:39 -04:00
|
|
|
if (get_button (id).invoke (ButtonState (LongPress|button_state), false)) {
|
|
|
|
/* whichever button this was, we've used it ... don't invoke the
|
|
|
|
release action.
|
|
|
|
*/
|
|
|
|
consumed.insert (id);
|
|
|
|
}
|
2015-12-01 13:15:38 -05:00
|
|
|
} else {
|
|
|
|
/* release happened and somehow we were not cancelled */
|
|
|
|
}
|
|
|
|
|
|
|
|
return false; /* don't get called again */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FaderPort::start_press_timeout (Button& button, ButtonID id)
|
|
|
|
{
|
|
|
|
Glib::RefPtr<Glib::TimeoutSource> timeout = Glib::TimeoutSource::create (500); // milliseconds
|
|
|
|
button.timeout_connection = timeout->connect (sigc::bind (sigc::mem_fun (*this, &FaderPort::button_long_press_timeout), id));
|
|
|
|
timeout->attach (main_loop()->get_context());
|
|
|
|
}
|
|
|
|
|
2015-11-24 18:00:11 -05:00
|
|
|
void
|
2022-10-20 13:34:26 -04:00
|
|
|
FaderPort::handle_midi_polypressure_message (MIDI::Parser &, MIDI::EventTwoBytes* tb)
|
2015-11-24 18:00:11 -05:00
|
|
|
{
|
2015-11-24 22:32:40 -05:00
|
|
|
ButtonID id (ButtonID (tb->controller_number));
|
2015-11-30 12:51:18 -05:00
|
|
|
Button& button (get_button (id));
|
|
|
|
|
2016-01-11 05:07:09 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("button event for ID %1 press ? %2\n", (int) tb->controller_number, (tb->value ? "yes" : "no")));
|
2016-01-07 16:40:14 -05:00
|
|
|
|
2015-12-01 13:15:38 -05:00
|
|
|
if (tb->value) {
|
|
|
|
buttons_down.insert (id);
|
|
|
|
} else {
|
|
|
|
buttons_down.erase (id);
|
|
|
|
button.timeout_connection.disconnect ();
|
|
|
|
}
|
2015-11-24 22:32:40 -05:00
|
|
|
|
2015-12-01 16:19:16 -05:00
|
|
|
ButtonState bs (ButtonState (0));
|
|
|
|
|
2015-11-24 22:32:40 -05:00
|
|
|
switch (id) {
|
|
|
|
case Shift:
|
2016-01-10 23:32:15 -05:00
|
|
|
bs = ShiftDown;
|
2015-11-24 22:32:40 -05:00
|
|
|
break;
|
|
|
|
case Stop:
|
2015-12-01 16:19:16 -05:00
|
|
|
bs = StopDown;
|
2015-11-24 22:32:40 -05:00
|
|
|
break;
|
|
|
|
case Rewind:
|
2015-12-01 16:19:16 -05:00
|
|
|
bs = RewindDown;
|
2015-11-24 22:32:40 -05:00
|
|
|
break;
|
2015-11-25 13:22:35 -05:00
|
|
|
case FaderTouch:
|
|
|
|
fader_is_touched = tb->value;
|
2016-05-17 11:42:31 -04:00
|
|
|
if (_current_stripable) {
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> gain = _current_stripable->gain_control ();
|
2015-11-27 10:22:01 -05:00
|
|
|
if (gain) {
|
2020-09-21 16:28:23 -04:00
|
|
|
timepos_t now = timepos_t (session->engine().sample_time());
|
2015-11-27 10:22:01 -05:00
|
|
|
if (tb->value) {
|
|
|
|
gain->start_touch (now);
|
|
|
|
} else {
|
2017-07-23 19:22:50 -04:00
|
|
|
gain->stop_touch (now);
|
2015-11-27 10:22:01 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-11-25 13:22:35 -05:00
|
|
|
break;
|
2015-11-24 22:32:40 -05:00
|
|
|
default:
|
2015-12-01 13:15:38 -05:00
|
|
|
if (tb->value) {
|
|
|
|
start_press_timeout (button, id);
|
|
|
|
}
|
2015-11-24 22:32:40 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-01 16:19:16 -05:00
|
|
|
if (bs) {
|
|
|
|
button_state = (tb->value ? ButtonState (button_state|bs) : ButtonState (button_state&~bs));
|
2016-01-10 23:32:15 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("reset button state to %1 using %2\n", button_state, (int) bs));
|
2015-12-01 16:19:16 -05:00
|
|
|
}
|
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
if (button.uses_flash()) {
|
2022-10-20 13:34:26 -04:00
|
|
|
button.set_led_state ((int)tb->value);
|
2015-11-24 21:41:44 -05:00
|
|
|
}
|
2015-11-24 22:32:40 -05:00
|
|
|
|
2015-12-03 18:38:09 -05:00
|
|
|
set<ButtonID>::iterator c = consumed.find (id);
|
|
|
|
|
|
|
|
if (c == consumed.end()) {
|
2018-03-26 18:26:39 -04:00
|
|
|
(void) button.invoke (button_state, tb->value ? true : false);
|
2015-12-03 18:38:09 -05:00
|
|
|
} else {
|
2016-01-10 23:32:15 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, "button was consumed, ignored\n");
|
2015-12-03 18:38:09 -05:00
|
|
|
consumed.erase (c);
|
|
|
|
}
|
2015-11-24 18:00:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-10-20 13:34:26 -04:00
|
|
|
FaderPort::handle_midi_pitchbend_message (MIDI::Parser &, MIDI::pitchbend_t pb)
|
2015-11-24 18:00:11 -05:00
|
|
|
{
|
2015-11-25 15:52:58 -05:00
|
|
|
int delta = 1;
|
2015-11-27 16:34:01 -05:00
|
|
|
|
|
|
|
if (pb >= 8192) {
|
2015-11-25 15:52:58 -05:00
|
|
|
delta = -1;
|
2015-11-24 18:00:11 -05:00
|
|
|
}
|
2015-11-25 15:52:58 -05:00
|
|
|
|
|
|
|
//knob debouncing and hysteresis. The presonus encoder often sends bursts of events, or goes the wrong direction
|
|
|
|
{
|
|
|
|
last_last_encoder_delta = last_encoder_delta;
|
|
|
|
last_encoder_delta = delta;
|
|
|
|
microseconds_t now = get_microseconds ();
|
|
|
|
if ((now - last_encoder_time) < 10*1000) { //require at least 10ms interval between changes, because the device sometimes sends multiple deltas
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((now - last_encoder_time) < 100*1000) { //avoid directional changes while "spinning", 100ms window
|
|
|
|
if ( (delta == last_encoder_delta) && (delta == last_last_encoder_delta) ) {
|
|
|
|
last_good_encoder_delta = delta; //3 in a row, grudgingly accept this as the new direction
|
|
|
|
}
|
|
|
|
if (delta != last_good_encoder_delta) { //otherwise ensure we keep going the same way
|
|
|
|
delta = last_good_encoder_delta;
|
|
|
|
}
|
|
|
|
} else { //we aren't yet in a spin window, just assume this move is really what we want
|
|
|
|
//NOTE: if you are worried about where these get initialized, here it is.
|
|
|
|
last_last_encoder_delta = delta;
|
|
|
|
last_encoder_delta = delta;
|
|
|
|
}
|
|
|
|
last_encoder_time = now;
|
|
|
|
last_good_encoder_delta = delta;
|
|
|
|
}
|
2015-11-25 16:34:11 -05:00
|
|
|
|
2016-05-17 11:42:31 -04:00
|
|
|
if (_current_stripable) {
|
2015-11-25 15:52:58 -05:00
|
|
|
|
2015-11-27 16:41:26 -05:00
|
|
|
ButtonState trim_modifier;
|
|
|
|
ButtonState width_modifier;
|
|
|
|
|
2024-07-23 20:20:51 -04:00
|
|
|
trim_modifier = ShiftDown;
|
|
|
|
width_modifier = ButtonState (0);
|
2015-11-27 16:41:26 -05:00
|
|
|
|
|
|
|
if ((button_state & trim_modifier) == trim_modifier ) { // mod+encoder = input trim
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> trim = _current_stripable->trim_control ();
|
2015-12-03 18:38:09 -05:00
|
|
|
if (trim) {
|
2017-06-21 11:05:03 -04:00
|
|
|
float val = accurate_coefficient_to_dB (trim->get_value());
|
|
|
|
val += delta * .5f; // use 1/2 dB Steps -20..+20
|
|
|
|
trim->set_value (dB_to_coefficient (val), Controllable::UseGroup);
|
2015-11-25 15:52:58 -05:00
|
|
|
}
|
2015-11-27 16:41:26 -05:00
|
|
|
} else if (width_modifier && ((button_state & width_modifier) == width_modifier)) {
|
2019-09-25 06:03:06 -04:00
|
|
|
pan_width (delta);
|
2015-11-27 16:41:26 -05:00
|
|
|
|
|
|
|
} else { // pan/balance
|
2019-09-25 06:03:06 -04:00
|
|
|
pan_azimuth (delta);
|
2015-11-25 15:52:58 -05:00
|
|
|
}
|
|
|
|
}
|
2015-11-24 18:00:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-10-20 13:34:26 -04:00
|
|
|
FaderPort::handle_midi_controller_message (MIDI::Parser &, MIDI::EventTwoBytes* tb)
|
2015-11-24 18:00:11 -05:00
|
|
|
{
|
|
|
|
bool was_fader = false;
|
|
|
|
|
|
|
|
if (tb->controller_number == 0x0) {
|
|
|
|
fader_msb = tb->value;
|
|
|
|
was_fader = true;
|
|
|
|
} else if (tb->controller_number == 0x20) {
|
|
|
|
fader_lsb = tb->value;
|
|
|
|
was_fader = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (was_fader) {
|
2016-05-17 11:42:31 -04:00
|
|
|
if (_current_stripable) {
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> gain = _current_stripable->gain_control ();
|
2015-11-25 13:22:35 -05:00
|
|
|
if (gain) {
|
|
|
|
int ival = (fader_msb << 7) | fader_lsb;
|
2021-05-07 19:02:24 -04:00
|
|
|
float val = gain->interface_to_internal (ival/16383.0);
|
2016-01-18 10:52:15 -05:00
|
|
|
/* even though the faderport only controls a
|
2016-05-17 11:42:31 -04:00
|
|
|
single stripable at a time, allow the fader to
|
2016-01-18 10:52:15 -05:00
|
|
|
modify the group, if appropriate.
|
|
|
|
*/
|
2016-05-17 11:42:31 -04:00
|
|
|
_current_stripable->gain_control()->set_value (val, Controllable::UseGroup);
|
2015-11-25 13:22:35 -05:00
|
|
|
}
|
|
|
|
}
|
2015-11-24 18:00:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-10-20 13:34:26 -04:00
|
|
|
FaderPort::handle_midi_sysex (MIDI::Parser &p, MIDI::byte *buf, size_t sz)
|
2015-11-24 18:00:11 -05:00
|
|
|
{
|
2016-01-07 16:40:14 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("sysex message received, size = %1\n", sz));
|
|
|
|
|
2015-11-24 18:00:11 -05:00
|
|
|
if (sz < 17) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-11-24 23:06:19 -05:00
|
|
|
if (buf[2] != 0x7f ||
|
|
|
|
buf[3] != 0x06 ||
|
|
|
|
buf[4] != 0x02 ||
|
|
|
|
buf[5] != 0x0 ||
|
|
|
|
buf[6] != 0x1 ||
|
|
|
|
buf[7] != 0x06 ||
|
|
|
|
buf[8] != 0x02 ||
|
|
|
|
buf[9] != 0x0 ||
|
|
|
|
buf[10] != 0x01 ||
|
|
|
|
buf[11] != 0x0) {
|
|
|
|
return;
|
|
|
|
}
|
2015-11-24 18:00:11 -05:00
|
|
|
|
2015-11-30 20:13:49 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, "FaderPort identified via MIDI Device Inquiry response\n");
|
2015-11-24 18:00:11 -05:00
|
|
|
|
2015-11-24 23:06:19 -05:00
|
|
|
/* put it into native mode */
|
2015-11-24 18:00:11 -05:00
|
|
|
|
2015-11-24 23:06:19 -05:00
|
|
|
MIDI::byte native[3];
|
|
|
|
native[0] = 0x91;
|
|
|
|
native[1] = 0x00;
|
|
|
|
native[2] = 0x64;
|
2015-11-24 21:10:22 -05:00
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
MIDISurface::write (native, 3);
|
2015-11-24 23:06:19 -05:00
|
|
|
|
|
|
|
all_lights_out ();
|
|
|
|
|
|
|
|
/* catch up on state */
|
|
|
|
|
2016-02-02 09:05:00 -05:00
|
|
|
/* make sure that rec_enable_state is consistent with current device state */
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (RecEnable).set_led_state (rec_enable_state);
|
2016-02-02 09:05:00 -05:00
|
|
|
|
2015-12-08 11:07:37 -05:00
|
|
|
map_transport_state ();
|
|
|
|
map_recenable_state ();
|
2015-11-24 18:00:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2015-11-24 21:41:44 -05:00
|
|
|
FaderPort::set_active (bool yn)
|
2015-11-24 18:00:11 -05:00
|
|
|
{
|
2023-09-14 14:14:55 -04:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose("Faderport::set_active init with yn: '%1' while active = %2\n", yn, active()));
|
2015-11-24 21:41:44 -05:00
|
|
|
|
|
|
|
if (yn == active()) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yn) {
|
|
|
|
|
2023-09-14 14:14:55 -04:00
|
|
|
if (device_acquire ()) {
|
|
|
|
return -1;
|
|
|
|
}
|
2015-12-14 13:28:24 -05:00
|
|
|
|
2015-11-24 21:41:44 -05:00
|
|
|
} else {
|
2022-10-20 13:34:26 -04:00
|
|
|
/* Control Protocol Manager never calls us with false, but
|
|
|
|
* insteads destroys us.
|
|
|
|
*/
|
2015-11-24 21:41:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
ControlProtocol::set_active (yn);
|
|
|
|
|
2015-12-14 11:48:09 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose("Faderport::set_active done with yn: '%1'\n", yn));
|
2015-11-24 21:41:44 -05:00
|
|
|
|
2015-11-24 18:00:11 -05:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-12-14 13:28:24 -05:00
|
|
|
bool
|
|
|
|
FaderPort::periodic ()
|
|
|
|
{
|
2016-05-17 11:42:31 -04:00
|
|
|
if (!_current_stripable) {
|
2015-12-14 13:28:24 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-05-17 11:42:31 -04:00
|
|
|
ARDOUR::AutoState gain_state = _current_stripable->gain_control()->automation_state();
|
2015-12-14 13:28:24 -05:00
|
|
|
|
|
|
|
if (gain_state == ARDOUR::Touch || gain_state == ARDOUR::Play) {
|
|
|
|
map_gain ();
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-12-03 08:36:56 -05:00
|
|
|
void
|
|
|
|
FaderPort::stop_blinking (ButtonID id)
|
|
|
|
{
|
|
|
|
blinkers.remove (id);
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (id).set_led_state (false);
|
2015-12-03 08:36:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FaderPort::start_blinking (ButtonID id)
|
|
|
|
{
|
|
|
|
blinkers.push_back (id);
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (id).set_led_state (true);
|
2015-12-03 08:36:56 -05:00
|
|
|
}
|
|
|
|
|
2015-11-24 23:06:19 -05:00
|
|
|
bool
|
|
|
|
FaderPort::blink ()
|
|
|
|
{
|
|
|
|
blink_state = !blink_state;
|
|
|
|
|
|
|
|
for (Blinkers::iterator b = blinkers.begin(); b != blinkers.end(); b++) {
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button(*b).set_led_state (blink_state);
|
2015-11-24 23:06:19 -05:00
|
|
|
}
|
|
|
|
|
2016-02-02 09:05:00 -05:00
|
|
|
map_recenable_state ();
|
|
|
|
|
2015-11-24 23:06:19 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-12-08 11:07:37 -05:00
|
|
|
FaderPort::map_recenable_state ()
|
2015-11-24 23:06:19 -05:00
|
|
|
{
|
2016-02-02 09:05:00 -05:00
|
|
|
/* special case for RecEnable because its status can change as a
|
|
|
|
* confluence of unrelated parameters: (a) session rec-enable state (b)
|
|
|
|
* rec-enabled tracks. So we don't add the button to the blinkers list,
|
|
|
|
* we just call this:
|
|
|
|
*
|
|
|
|
* * from the blink callback
|
|
|
|
* * when the session tells us about a status change
|
|
|
|
*
|
|
|
|
* We do the last one so that the button changes state promptly rather
|
|
|
|
* than waiting for the next blink callback. The change in "blinking"
|
|
|
|
* based on having record-enabled tracks isn't urgent, and that happens
|
|
|
|
* during the blink callback.
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool onoff;
|
|
|
|
|
2015-11-24 23:06:19 -05:00
|
|
|
switch (session->record_status()) {
|
|
|
|
case Session::Disabled:
|
2016-02-02 09:05:00 -05:00
|
|
|
onoff = false;
|
2015-11-24 23:06:19 -05:00
|
|
|
break;
|
|
|
|
case Session::Enabled:
|
2016-02-02 09:05:00 -05:00
|
|
|
onoff = blink_state;
|
2015-11-24 23:06:19 -05:00
|
|
|
break;
|
|
|
|
case Session::Recording:
|
2016-02-02 09:05:00 -05:00
|
|
|
if (session->have_rec_enabled_track ()) {
|
|
|
|
onoff = true;
|
|
|
|
} else {
|
|
|
|
onoff = blink_state;
|
|
|
|
}
|
2015-11-24 23:06:19 -05:00
|
|
|
break;
|
2022-06-21 20:42:17 -04:00
|
|
|
default:
|
|
|
|
return; /* stupid compilers */
|
2015-11-24 23:06:19 -05:00
|
|
|
}
|
2016-02-02 09:05:00 -05:00
|
|
|
|
|
|
|
if (onoff != rec_enable_state) {
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button(RecEnable).set_led_state (onoff);
|
2016-02-02 09:05:00 -05:00
|
|
|
rec_enable_state = onoff;
|
|
|
|
}
|
2015-11-24 23:06:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-12-08 11:07:37 -05:00
|
|
|
FaderPort::map_transport_state ()
|
2015-11-24 23:06:19 -05:00
|
|
|
{
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (Loop).set_led_state (session->get_play_loop());
|
2015-12-08 11:07:37 -05:00
|
|
|
|
2020-02-23 09:49:40 -05:00
|
|
|
float ts = get_transport_speed();
|
2015-12-08 11:07:37 -05:00
|
|
|
|
|
|
|
if (ts == 0) {
|
|
|
|
stop_blinking (Play);
|
|
|
|
} else if (fabs (ts) == 1.0) {
|
|
|
|
stop_blinking (Play);
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (Play).set_led_state (true);
|
2015-12-08 11:07:37 -05:00
|
|
|
} else {
|
|
|
|
start_blinking (Play);
|
|
|
|
}
|
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (Stop).set_led_state (stop_button_onoff());
|
|
|
|
get_button (Rewind).set_led_state (rewind_button_onoff ());
|
|
|
|
get_button (Ffwd).set_led_state (ffwd_button_onoff());
|
2015-11-24 23:06:19 -05:00
|
|
|
}
|
|
|
|
|
2015-12-01 18:45:43 -05:00
|
|
|
void
|
|
|
|
FaderPort::parameter_changed (string what)
|
|
|
|
{
|
|
|
|
if (what == "punch-in" || what == "punch-out") {
|
|
|
|
bool in = session->config.get_punch_in ();
|
|
|
|
bool out = session->config.get_punch_out ();
|
|
|
|
if (in && out) {
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (Punch).set_led_state (true);
|
2015-12-01 18:45:43 -05:00
|
|
|
blinkers.remove (Punch);
|
|
|
|
} else if (in || out) {
|
2015-12-03 08:36:56 -05:00
|
|
|
start_blinking (Punch);
|
2015-12-01 18:45:43 -05:00
|
|
|
} else {
|
2015-12-03 08:36:56 -05:00
|
|
|
stop_blinking (Punch);
|
2015-12-01 18:45:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-24 18:00:11 -05:00
|
|
|
XMLNode&
|
2022-04-06 23:56:32 -04:00
|
|
|
FaderPort::get_state () const
|
2015-11-24 18:00:11 -05:00
|
|
|
{
|
2022-10-20 13:34:26 -04:00
|
|
|
XMLNode& node (MIDISurface::get_state());
|
2015-11-24 18:00:11 -05:00
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
/* Save action state for Mix, Proj, Trns and User buttons, since these
|
|
|
|
* are user controlled. We can only save named-action operations, since
|
|
|
|
* internal functions are just pointers to functions and hard to
|
|
|
|
* serialize without enumerating them all somewhere.
|
|
|
|
*/
|
|
|
|
|
|
|
|
node.add_child_nocopy (get_button (Mix).get_state());
|
|
|
|
node.add_child_nocopy (get_button (Proj).get_state());
|
|
|
|
node.add_child_nocopy (get_button (Trns).get_state());
|
|
|
|
node.add_child_nocopy (get_button (User).get_state());
|
2016-02-03 11:53:56 -05:00
|
|
|
node.add_child_nocopy (get_button (Footswitch).get_state());
|
2015-11-30 12:51:18 -05:00
|
|
|
|
2015-11-24 18:00:11 -05:00
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
FaderPort::set_state (const XMLNode& node, int version)
|
|
|
|
{
|
|
|
|
XMLNodeList nlist;
|
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
if (MIDISurface::set_state (node, version)) {
|
2015-11-24 18:00:11 -05:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
for (XMLNodeList::const_iterator n = node.children().begin(); n != node.children().end(); ++n) {
|
|
|
|
if ((*n)->name() == X_("Button")) {
|
2016-08-29 20:22:01 -04:00
|
|
|
int32_t xid;
|
|
|
|
if (!(*n)->get_property (X_("id"), xid)) {
|
2015-11-30 12:51:18 -05:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ButtonMap::iterator b = buttons.find (ButtonID (xid));
|
|
|
|
if (b == buttons.end()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
b->second.set_state (**n);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-24 18:00:11 -05:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
std::string
|
|
|
|
FaderPort::input_port_name () const
|
2015-11-24 18:00:11 -05:00
|
|
|
{
|
2022-10-20 13:34:26 -04:00
|
|
|
#ifdef __APPLE__
|
|
|
|
/* the origin of the numeric magic identifiers is known only to Ableton
|
|
|
|
and may change in time. This is part of how CoreMIDI works.
|
|
|
|
*/
|
|
|
|
return X_("system:midi_capture_1319078870");
|
|
|
|
#else
|
|
|
|
return X_("FaderPort MIDI 1 (in)");
|
|
|
|
#endif
|
|
|
|
}
|
2015-12-04 19:11:05 -05:00
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
std::string
|
|
|
|
FaderPort::output_port_name () const
|
|
|
|
{
|
|
|
|
#ifdef __APPLE__
|
|
|
|
/* the origin of the numeric magic identifiers is known only to Ableton
|
|
|
|
and may change in time. This is part of how CoreMIDI works.
|
|
|
|
*/
|
|
|
|
return X_("system:midi_playback_3409210341");
|
|
|
|
#else
|
|
|
|
return X_("FaderPort MIDI 1 (out)");
|
|
|
|
#endif
|
2015-11-24 18:00:11 -05:00
|
|
|
}
|
|
|
|
|
2023-09-14 14:14:55 -04:00
|
|
|
void
|
|
|
|
FaderPort::run_event_loop ()
|
|
|
|
{
|
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, "start event loop\n");
|
|
|
|
BaseUI::run ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FaderPort::stop_event_loop ()
|
|
|
|
{
|
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, "stop event loop\n");
|
|
|
|
BaseUI::quit ();
|
|
|
|
}
|
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
int
|
|
|
|
FaderPort::begin_using_device()
|
2015-11-24 18:00:11 -05:00
|
|
|
{
|
2023-09-14 14:14:55 -04:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, "begin using device\n");
|
|
|
|
|
|
|
|
connect_session_signals ();
|
|
|
|
|
|
|
|
Glib::RefPtr<Glib::TimeoutSource> blink_timeout = Glib::TimeoutSource::create (200); // milliseconds
|
|
|
|
blink_connection = blink_timeout->connect (sigc::mem_fun (*this, &FaderPort::blink));
|
|
|
|
blink_timeout->attach (main_loop()->get_context());
|
|
|
|
|
|
|
|
Glib::RefPtr<Glib::TimeoutSource> periodic_timeout = Glib::TimeoutSource::create (100); // milliseconds
|
|
|
|
periodic_connection = periodic_timeout->connect (sigc::mem_fun (*this, &FaderPort::periodic));
|
|
|
|
periodic_timeout->attach (main_loop()->get_context());
|
2015-11-24 18:00:11 -05:00
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
if (MIDISurface::begin_using_device ()) {
|
|
|
|
return -1;
|
|
|
|
}
|
2015-11-24 21:41:44 -05:00
|
|
|
|
2023-09-14 14:14:55 -04:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, "sending device inquiry message...\n");
|
|
|
|
|
2015-11-24 18:00:11 -05:00
|
|
|
/* send device inquiry */
|
|
|
|
|
|
|
|
MIDI::byte buf[6];
|
|
|
|
|
|
|
|
buf[0] = 0xf0;
|
|
|
|
buf[1] = 0x7e;
|
|
|
|
buf[2] = 0x7f;
|
|
|
|
buf[3] = 0x06;
|
|
|
|
buf[4] = 0x01;
|
|
|
|
buf[5] = 0xf7;
|
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
MIDISurface::write (buf, 6);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
FaderPort::stop_using_device ()
|
|
|
|
{
|
|
|
|
blink_connection.disconnect ();
|
|
|
|
selection_connection.disconnect ();
|
|
|
|
stripable_connections.drop_connections ();
|
|
|
|
periodic_connection.disconnect ();
|
|
|
|
|
|
|
|
return 0;
|
2015-11-24 18:00:11 -05:00
|
|
|
}
|
2015-11-24 21:02:18 -05:00
|
|
|
|
2019-04-19 14:35:40 -04:00
|
|
|
bool
|
2015-11-30 12:51:18 -05:00
|
|
|
FaderPort::Button::invoke (FaderPort::ButtonState bs, bool press)
|
2015-11-24 21:02:18 -05:00
|
|
|
{
|
2015-12-01 11:20:09 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("invoke button %1 for %2 state %3%4%5\n", id, (press ? "press":"release"), hex, bs, dec));
|
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
ToDoMap::iterator x;
|
|
|
|
|
|
|
|
if (press) {
|
|
|
|
if ((x = on_press.find (bs)) == on_press.end()) {
|
2016-01-10 23:32:15 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("no press action for button %1 state %2 @ %3 in %4\n", id, bs, this, &on_press));
|
2018-03-26 18:26:39 -04:00
|
|
|
return false;
|
2015-11-30 12:51:18 -05:00
|
|
|
}
|
|
|
|
} else {
|
2015-11-30 15:05:30 -05:00
|
|
|
if ((x = on_release.find (bs)) == on_release.end()) {
|
2016-01-10 23:32:15 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("no release action for button %1 state %2 @%3 in %4\n", id, bs, this, &on_release));
|
2018-03-26 18:26:39 -04:00
|
|
|
return false;
|
2015-11-30 12:51:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (x->second.type) {
|
2015-11-24 21:02:18 -05:00
|
|
|
case NamedAction:
|
2015-11-30 12:51:18 -05:00
|
|
|
if (!x->second.action_name.empty()) {
|
|
|
|
fp.access_action (x->second.action_name);
|
2018-03-26 18:26:39 -04:00
|
|
|
return true;
|
2015-11-24 21:02:18 -05:00
|
|
|
}
|
2015-11-30 20:13:49 -05:00
|
|
|
break;
|
2015-11-24 21:02:18 -05:00
|
|
|
case InternalFunction:
|
2015-11-30 12:51:18 -05:00
|
|
|
if (x->second.function) {
|
|
|
|
x->second.function ();
|
2018-03-26 18:26:39 -04:00
|
|
|
return true;
|
2015-11-30 12:51:18 -05:00
|
|
|
}
|
|
|
|
}
|
2018-03-26 18:26:39 -04:00
|
|
|
|
|
|
|
return false;
|
2015-11-30 12:51:18 -05:00
|
|
|
}
|
|
|
|
|
2015-11-24 21:02:18 -05:00
|
|
|
void
|
2015-11-30 12:51:18 -05:00
|
|
|
FaderPort::Button::set_action (string const& name, bool when_pressed, FaderPort::ButtonState bs)
|
2015-11-24 21:02:18 -05:00
|
|
|
{
|
2015-11-24 22:32:40 -05:00
|
|
|
ToDo todo;
|
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
todo.type = NamedAction;
|
2015-11-24 22:32:40 -05:00
|
|
|
|
2015-11-24 21:02:18 -05:00
|
|
|
if (when_pressed) {
|
2015-11-30 12:51:18 -05:00
|
|
|
if (name.empty()) {
|
|
|
|
on_press.erase (bs);
|
|
|
|
} else {
|
2020-02-20 14:51:47 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("set button %1 to action %2 on press + %3\n", id, name, bs));
|
2015-11-30 12:51:18 -05:00
|
|
|
todo.action_name = name;
|
|
|
|
on_press[bs] = todo;
|
|
|
|
}
|
2015-11-24 21:02:18 -05:00
|
|
|
} else {
|
2015-11-30 12:51:18 -05:00
|
|
|
if (name.empty()) {
|
|
|
|
on_release.erase (bs);
|
|
|
|
} else {
|
2020-02-20 14:51:47 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("set button %1 to action %2 on release + %3\n", id, name, bs));
|
2015-11-30 12:51:18 -05:00
|
|
|
todo.action_name = name;
|
|
|
|
on_release[bs] = todo;
|
|
|
|
}
|
2015-11-24 21:02:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-30 13:50:33 -05:00
|
|
|
string
|
|
|
|
FaderPort::Button::get_action (bool press, FaderPort::ButtonState bs)
|
|
|
|
{
|
|
|
|
ToDoMap::iterator x;
|
|
|
|
|
|
|
|
if (press) {
|
|
|
|
if ((x = on_press.find (bs)) == on_press.end()) {
|
|
|
|
return string();
|
|
|
|
}
|
|
|
|
if (x->second.type != NamedAction) {
|
|
|
|
return string ();
|
|
|
|
}
|
|
|
|
return x->second.action_name;
|
|
|
|
} else {
|
|
|
|
if ((x = on_release.find (bs)) == on_release.end()) {
|
|
|
|
return string();
|
|
|
|
}
|
|
|
|
if (x->second.type != NamedAction) {
|
|
|
|
return string ();
|
|
|
|
}
|
|
|
|
return x->second.action_name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-24 21:02:18 -05:00
|
|
|
void
|
2015-11-30 12:51:18 -05:00
|
|
|
FaderPort::Button::set_action (boost::function<void()> f, bool when_pressed, FaderPort::ButtonState bs)
|
2015-11-24 21:02:18 -05:00
|
|
|
{
|
2015-11-24 22:32:40 -05:00
|
|
|
ToDo todo;
|
2015-11-30 12:51:18 -05:00
|
|
|
todo.type = InternalFunction;
|
2015-11-24 22:32:40 -05:00
|
|
|
|
2015-11-24 21:02:18 -05:00
|
|
|
if (when_pressed) {
|
2016-01-10 23:32:15 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("set button %1 (%2) @ %5 to some functor on press + %3 in %4\n", id, name, bs, &on_press, this));
|
2015-11-24 22:32:40 -05:00
|
|
|
todo.function = f;
|
|
|
|
on_press[bs] = todo;
|
2015-11-24 21:02:18 -05:00
|
|
|
} else {
|
2016-01-10 23:32:15 -05:00
|
|
|
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("set button %1 (%2) @ %5 to some functor on release + %3\n", id, name, bs, this));
|
2015-11-24 22:32:40 -05:00
|
|
|
todo.function = f;
|
|
|
|
on_release[bs] = todo;
|
2015-11-24 21:02:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-10-20 13:34:26 -04:00
|
|
|
FaderPort::Button::set_led_state (bool onoff)
|
2015-11-24 21:02:18 -05:00
|
|
|
{
|
2015-11-24 21:10:22 -05:00
|
|
|
if (out < 0) {
|
|
|
|
/* fader button ID - no LED */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-11-24 21:02:18 -05:00
|
|
|
MIDI::byte buf[3];
|
|
|
|
buf[0] = 0xa0;
|
|
|
|
buf[1] = out;
|
|
|
|
buf[2] = onoff ? 1 : 0;
|
2022-10-20 13:34:26 -04:00
|
|
|
|
|
|
|
/* C++ can be irritating */
|
|
|
|
|
|
|
|
MIDISurface* ms (&fp);
|
|
|
|
ms->write (buf, 3);
|
2015-11-24 21:02:18 -05:00
|
|
|
}
|
2015-11-25 12:37:29 -05:00
|
|
|
|
2015-11-30 12:51:18 -05:00
|
|
|
int
|
|
|
|
FaderPort::Button::set_state (XMLNode const& node)
|
|
|
|
{
|
2016-08-29 20:22:01 -04:00
|
|
|
int32_t xid;
|
|
|
|
if (!node.get_property ("id", xid) || xid != id) {
|
2015-11-30 12:51:18 -05:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef pair<string,FaderPort::ButtonState> state_pair_t;
|
|
|
|
vector<state_pair_t> state_pairs;
|
|
|
|
|
|
|
|
state_pairs.push_back (make_pair (string ("plain"), ButtonState (0)));
|
|
|
|
state_pairs.push_back (make_pair (string ("shift"), ShiftDown));
|
|
|
|
state_pairs.push_back (make_pair (string ("long"), LongPress));
|
|
|
|
|
|
|
|
for (vector<state_pair_t>::const_iterator sp = state_pairs.begin(); sp != state_pairs.end(); ++sp) {
|
|
|
|
|
2016-08-29 20:22:01 -04:00
|
|
|
string propname = sp->first + X_("-press");
|
|
|
|
string value;
|
|
|
|
if (node.get_property (propname.c_str(), value)) {
|
|
|
|
set_action (value, true, sp->second);
|
2015-11-30 12:51:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
propname = sp->first + X_("-release");
|
2016-08-29 20:22:01 -04:00
|
|
|
if (node.get_property (propname.c_str(), value)) {
|
|
|
|
set_action (value, false, sp->second);
|
2015-11-30 12:51:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLNode&
|
|
|
|
FaderPort::Button::get_state () const
|
|
|
|
{
|
|
|
|
XMLNode* node = new XMLNode (X_("Button"));
|
|
|
|
|
2016-08-29 20:22:01 -04:00
|
|
|
node->set_property (X_("id"), to_string<int32_t>(id));
|
2015-11-30 12:51:18 -05:00
|
|
|
|
|
|
|
ToDoMap::const_iterator x;
|
|
|
|
ToDo null;
|
|
|
|
null.type = NamedAction;
|
|
|
|
|
|
|
|
typedef pair<string,FaderPort::ButtonState> state_pair_t;
|
|
|
|
vector<state_pair_t> state_pairs;
|
|
|
|
|
|
|
|
state_pairs.push_back (make_pair (string ("plain"), ButtonState (0)));
|
|
|
|
state_pairs.push_back (make_pair (string ("shift"), ShiftDown));
|
|
|
|
state_pairs.push_back (make_pair (string ("long"), LongPress));
|
|
|
|
|
|
|
|
for (vector<state_pair_t>::const_iterator sp = state_pairs.begin(); sp != state_pairs.end(); ++sp) {
|
|
|
|
if ((x = on_press.find (sp->second)) != on_press.end()) {
|
|
|
|
if (x->second.type == NamedAction) {
|
2016-08-29 20:22:01 -04:00
|
|
|
node->set_property (string (sp->first + X_("-press")).c_str(), x->second.action_name);
|
2015-11-30 12:51:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((x = on_release.find (sp->second)) != on_release.end()) {
|
|
|
|
if (x->second.type == NamedAction) {
|
2016-08-29 20:22:01 -04:00
|
|
|
node->set_property (string (sp->first + X_("-release")).c_str(), x->second.action_name);
|
2015-11-30 12:51:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *node;
|
|
|
|
}
|
|
|
|
|
2015-11-25 12:37:29 -05:00
|
|
|
void
|
2017-05-12 09:51:31 -04:00
|
|
|
FaderPort::stripable_selection_changed ()
|
2015-11-25 12:37:29 -05:00
|
|
|
{
|
2017-02-25 13:56:51 -05:00
|
|
|
set_current_stripable (ControlProtocol::first_selected_stripable());
|
2015-11-25 16:34:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-05-17 11:42:31 -04:00
|
|
|
FaderPort::drop_current_stripable ()
|
2015-11-25 16:34:11 -05:00
|
|
|
{
|
2016-05-17 11:42:31 -04:00
|
|
|
if (_current_stripable) {
|
|
|
|
if (_current_stripable == session->monitor_out()) {
|
|
|
|
set_current_stripable (session->master_out());
|
2015-11-25 16:34:11 -05:00
|
|
|
} else {
|
2023-02-16 18:33:28 -05:00
|
|
|
set_current_stripable (std::shared_ptr<Stripable>());
|
2015-11-25 16:34:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
FaderPort::set_current_stripable (std::shared_ptr<Stripable> r)
|
2015-11-25 16:34:11 -05:00
|
|
|
{
|
2016-05-17 11:42:31 -04:00
|
|
|
stripable_connections.drop_connections ();
|
2015-11-25 12:37:29 -05:00
|
|
|
|
2016-05-17 11:42:31 -04:00
|
|
|
_current_stripable = r;
|
2015-11-25 16:34:11 -05:00
|
|
|
|
2015-11-25 17:56:22 -05:00
|
|
|
/* turn this off. It will be turned on back on in use_master() or
|
|
|
|
use_monitor() as appropriate.
|
|
|
|
*/
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button(Output).set_led_state (false);
|
2015-11-25 17:56:22 -05:00
|
|
|
|
2016-05-17 11:42:31 -04:00
|
|
|
if (_current_stripable) {
|
|
|
|
_current_stripable->DropReferences.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::drop_current_stripable, this), this);
|
2015-11-25 16:34:11 -05:00
|
|
|
|
2016-05-17 11:42:31 -04:00
|
|
|
_current_stripable->mute_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_mute, this), this);
|
|
|
|
_current_stripable->solo_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_solo, this), this);
|
2015-11-25 13:22:35 -05:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Track> t = std::dynamic_pointer_cast<Track> (_current_stripable);
|
2015-11-25 12:37:29 -05:00
|
|
|
if (t) {
|
2016-05-17 11:42:31 -04:00
|
|
|
t->rec_enable_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_recenable, this), this);
|
2015-11-25 12:37:29 -05:00
|
|
|
}
|
2015-11-25 13:22:35 -05:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> control = _current_stripable->gain_control ();
|
2015-11-25 13:22:35 -05:00
|
|
|
if (control) {
|
2016-05-17 11:42:31 -04:00
|
|
|
control->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_gain, this), this);
|
|
|
|
control->alist()->automation_state_changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_auto, this), this);
|
2015-11-25 13:22:35 -05:00
|
|
|
}
|
2015-11-25 17:20:00 -05:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<MonitorProcessor> mp = _current_stripable->monitor_control();
|
2015-11-25 17:20:00 -05:00
|
|
|
if (mp) {
|
2016-05-17 11:42:31 -04:00
|
|
|
mp->cut_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_cut, this), this);
|
2015-11-25 17:20:00 -05:00
|
|
|
}
|
2015-11-25 12:37:29 -05:00
|
|
|
}
|
2015-11-27 16:41:26 -05:00
|
|
|
|
2015-11-25 18:33:42 -05:00
|
|
|
//ToDo: subscribe to the fader automation modes so we can light the LEDs
|
2015-11-25 12:37:29 -05:00
|
|
|
|
2016-05-17 11:42:31 -04:00
|
|
|
map_stripable_state ();
|
2015-11-25 12:37:29 -05:00
|
|
|
}
|
|
|
|
|
2015-12-02 21:06:29 -05:00
|
|
|
void
|
|
|
|
FaderPort::map_auto ()
|
|
|
|
{
|
2015-12-14 14:42:12 -05:00
|
|
|
/* Under no circumstances send a message to "enable" the LED state of
|
|
|
|
* the Off button, because this will disable the fader.
|
|
|
|
*/
|
2015-12-14 13:27:50 -05:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> control = _current_stripable->gain_control ();
|
2015-12-02 21:06:29 -05:00
|
|
|
const AutoState as = control->automation_state ();
|
|
|
|
|
|
|
|
switch (as) {
|
|
|
|
case ARDOUR::Play:
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (FP_Read).set_led_state (true);
|
|
|
|
get_button (FP_Write).set_led_state (false);
|
|
|
|
get_button (FP_Touch).set_led_state (false);
|
2015-12-02 21:06:29 -05:00
|
|
|
break;
|
|
|
|
case ARDOUR::Write:
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (FP_Read).set_led_state (false);
|
|
|
|
get_button (FP_Write).set_led_state (true);
|
|
|
|
get_button (FP_Touch).set_led_state (false);
|
2015-12-02 21:06:29 -05:00
|
|
|
break;
|
|
|
|
case ARDOUR::Touch:
|
2019-04-01 16:30:16 -04:00
|
|
|
case ARDOUR::Latch: // XXX
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (FP_Read).set_led_state (false);
|
|
|
|
get_button (FP_Write).set_led_state (false);
|
|
|
|
get_button (FP_Touch).set_led_state (true);
|
2015-12-02 21:06:29 -05:00
|
|
|
break;
|
|
|
|
case ARDOUR::Off:
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (FP_Read).set_led_state (false);
|
|
|
|
get_button (FP_Write).set_led_state (false);
|
|
|
|
get_button (FP_Touch).set_led_state (false);
|
2015-12-02 21:06:29 -05:00
|
|
|
break;
|
|
|
|
}
|
2015-12-03 12:44:21 -05:00
|
|
|
|
2015-12-02 21:06:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-25 17:20:00 -05:00
|
|
|
void
|
|
|
|
FaderPort::map_cut ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<MonitorProcessor> mp = _current_stripable->monitor_control();
|
2015-11-25 17:20:00 -05:00
|
|
|
|
|
|
|
if (mp) {
|
|
|
|
bool yn = mp->cut_all ();
|
|
|
|
if (yn) {
|
2015-12-03 08:36:56 -05:00
|
|
|
start_blinking (Mute);
|
2015-11-25 17:20:00 -05:00
|
|
|
} else {
|
2015-12-03 08:36:56 -05:00
|
|
|
stop_blinking (Mute);
|
2015-11-25 17:20:00 -05:00
|
|
|
}
|
|
|
|
} else {
|
2015-12-03 08:36:56 -05:00
|
|
|
stop_blinking (Mute);
|
2015-11-25 17:20:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-25 12:37:29 -05:00
|
|
|
void
|
2016-01-21 11:03:14 -05:00
|
|
|
FaderPort::map_mute ()
|
2015-11-25 12:37:29 -05:00
|
|
|
{
|
2016-05-17 11:42:31 -04:00
|
|
|
if (_current_stripable) {
|
|
|
|
if (_current_stripable->mute_control()->muted()) {
|
2015-12-08 11:07:37 -05:00
|
|
|
stop_blinking (Mute);
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (Mute).set_led_state (true);
|
2016-05-17 11:42:31 -04:00
|
|
|
} else if (_current_stripable->mute_control()->muted_by_others_soloing () || _current_stripable->mute_control()->muted_by_masters()) {
|
2015-12-08 11:07:37 -05:00
|
|
|
start_blinking (Mute);
|
|
|
|
} else {
|
|
|
|
stop_blinking (Mute);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
stop_blinking (Mute);
|
|
|
|
}
|
2015-11-25 12:37:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-01-21 11:03:14 -05:00
|
|
|
FaderPort::map_solo ()
|
2015-11-25 12:37:29 -05:00
|
|
|
{
|
2016-05-17 11:42:31 -04:00
|
|
|
if (_current_stripable) {
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (Solo).set_led_state (_current_stripable->solo_control()->soloed());
|
2015-12-08 11:07:37 -05:00
|
|
|
} else {
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (Solo).set_led_state (false);
|
2015-12-08 11:07:37 -05:00
|
|
|
}
|
2015-11-25 12:37:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FaderPort::map_recenable ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Track> t = std::dynamic_pointer_cast<Track> (_current_stripable);
|
2015-11-25 12:37:29 -05:00
|
|
|
if (t) {
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (Rec).set_led_state (t->rec_enable_control()->get_value());
|
2015-11-25 12:37:29 -05:00
|
|
|
} else {
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (Rec).set_led_state (false);
|
2015-11-25 12:37:29 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-25 13:22:35 -05:00
|
|
|
void
|
|
|
|
FaderPort::map_gain ()
|
|
|
|
{
|
|
|
|
if (fader_is_touched) {
|
|
|
|
/* Do not send fader moves while the user is touching the fader */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-17 11:42:31 -04:00
|
|
|
if (!_current_stripable) {
|
2015-11-25 13:22:35 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> control = _current_stripable->gain_control ();
|
2015-11-25 13:22:35 -05:00
|
|
|
double val;
|
|
|
|
|
|
|
|
if (!control) {
|
|
|
|
val = 0.0;
|
|
|
|
} else {
|
|
|
|
val = control->internal_to_interface (control->get_value ());
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Faderport sends fader position with range 0..16384 (though some of
|
|
|
|
* the least-significant bits at the top end are missing - it may only
|
|
|
|
* get to 1636X or so).
|
|
|
|
*
|
|
|
|
* But ... position must be sent in the range 0..1023.
|
|
|
|
*
|
|
|
|
* Thanks, Obama.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int ival = (int) lrintf (val * 1023.0);
|
|
|
|
|
|
|
|
/* MIDI normalization requires that we send two separate messages here,
|
|
|
|
* not one single 6 byte one.
|
|
|
|
*/
|
|
|
|
|
|
|
|
MIDI::byte buf[3];
|
|
|
|
|
|
|
|
buf[0] = 0xb0;
|
|
|
|
buf[1] = 0x0;
|
|
|
|
buf[2] = ival >> 7;
|
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
MIDISurface::write (buf, 3);
|
2015-11-25 13:22:35 -05:00
|
|
|
|
|
|
|
buf[1] = 0x20;
|
|
|
|
buf[2] = ival & 0x7f;
|
|
|
|
|
2022-10-20 13:34:26 -04:00
|
|
|
MIDISurface::write (buf, 3);
|
2015-11-25 13:22:35 -05:00
|
|
|
}
|
|
|
|
|
2015-11-25 12:37:29 -05:00
|
|
|
void
|
2016-05-17 11:42:31 -04:00
|
|
|
FaderPort::map_stripable_state ()
|
2015-11-25 12:37:29 -05:00
|
|
|
{
|
2016-05-17 11:42:31 -04:00
|
|
|
if (!_current_stripable) {
|
2015-12-03 08:36:56 -05:00
|
|
|
stop_blinking (Mute);
|
|
|
|
stop_blinking (Solo);
|
2022-10-20 13:34:26 -04:00
|
|
|
get_button (Rec).set_led_state (false);
|
2015-11-25 12:37:29 -05:00
|
|
|
} else {
|
2016-01-21 11:03:14 -05:00
|
|
|
map_solo ();
|
2015-11-25 12:37:29 -05:00
|
|
|
map_recenable ();
|
2015-11-25 13:22:35 -05:00
|
|
|
map_gain ();
|
2015-12-02 21:06:29 -05:00
|
|
|
map_auto ();
|
2015-12-08 11:07:37 -05:00
|
|
|
|
2016-05-17 11:42:31 -04:00
|
|
|
if (_current_stripable == session->monitor_out()) {
|
2015-12-08 11:07:37 -05:00
|
|
|
map_cut ();
|
|
|
|
} else {
|
2016-01-21 11:03:14 -05:00
|
|
|
map_mute ();
|
2015-12-08 11:07:37 -05:00
|
|
|
}
|
2015-11-25 12:37:29 -05:00
|
|
|
}
|
|
|
|
}
|
2015-11-29 11:32:28 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
FaderPort::set_action (ButtonID id, std::string const& action_name, bool on_press, ButtonState bs)
|
|
|
|
{
|
2015-11-30 12:51:18 -05:00
|
|
|
get_button(id).set_action (action_name, on_press, bs);
|
2015-11-29 11:32:28 -05:00
|
|
|
}
|
2015-11-30 13:50:33 -05:00
|
|
|
|
|
|
|
string
|
|
|
|
FaderPort::get_action (ButtonID id, bool press, ButtonState bs)
|
|
|
|
{
|
|
|
|
return get_button(id).get_action (press, bs);
|
|
|
|
}
|
2022-10-20 13:34:26 -04:00
|
|
|
|
2023-09-14 14:14:55 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
FaderPort::notify_record_state_changed ()
|
|
|
|
{
|
|
|
|
map_recenable_state ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FaderPort::notify_transport_state_changed()
|
|
|
|
{
|
|
|
|
map_transport_state ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FaderPort::notify_loop_state_changed ()
|
|
|
|
{
|
|
|
|
map_transport_state ();
|
|
|
|
}
|