implement more Faderport buttons (window and fader automation). ToDo: automation LEDs, fader banking

This commit is contained in:
Ben Loftis 2015-11-25 17:33:42 -06:00
parent d6186fba32
commit d138f8981d
3 changed files with 99 additions and 8 deletions

View file

@ -100,10 +100,10 @@ FaderPort::FaderPort (Session& s)
buttons.insert (std::make_pair (Bank, ButtonInfo (*this, _("Bank"), Bank, 19)));
buttons.insert (std::make_pair (Right, ButtonInfo (*this, _("Right"), Right, 18)));
buttons.insert (std::make_pair (Output, ButtonInfo (*this, _("Output"), Output, 17)));
buttons.insert (std::make_pair (Read, ButtonInfo (*this, _("Read"), Read, 13)));
buttons.insert (std::make_pair (Write, ButtonInfo (*this, _("Write"), Write, 14)));
buttons.insert (std::make_pair (Touch, ButtonInfo (*this, _("Touch"), Touch, 15)));
buttons.insert (std::make_pair (Off, ButtonInfo (*this, _("Off"), Off, 16)));
buttons.insert (std::make_pair (FP_Read, ButtonInfo (*this, _("Read"), FP_Read, 13)));
buttons.insert (std::make_pair (FP_Write, ButtonInfo (*this, _("Write"), FP_Write, 14)));
buttons.insert (std::make_pair (FP_Touch, ButtonInfo (*this, _("Touch"), FP_Touch, 15)));
buttons.insert (std::make_pair (FP_Off, ButtonInfo (*this, _("Off"), FP_Off, 16)));
buttons.insert (std::make_pair (Mix, ButtonInfo (*this, _("Mix"), Mix, 12)));
buttons.insert (std::make_pair (Proj, ButtonInfo (*this, _("Proj"), Proj, 11)));
buttons.insert (std::make_pair (Trns, ButtonInfo (*this, _("Trns"), Trns, 10)));
@ -119,10 +119,22 @@ FaderPort::FaderPort (Session& s)
buttons.insert (std::make_pair (RecEnable, ButtonInfo (*this, _("RecEnable"), RecEnable, 0)));
buttons.insert (std::make_pair (FaderTouch, ButtonInfo (*this, _("Fader (touch)"), FaderTouch, -1)));
button_info (Mix).set_action ( string("Common/toggle-editor-mixer"), true);
button_info (Proj).set_action ( string("Common/toggle-meterbridge"), true);
button_info (Trns).set_action ( string("Window/toggle-locations"), true);
button_info (Left).set_action ( boost::bind (&FaderPort::left, this), true);
button_info (Right).set_action ( boost::bind (&FaderPort::right, this), true);
button_info (Undo).set_action (boost::bind (&FaderPort::undo, this), true);
button_info (Undo).set_action (boost::bind (&FaderPort::redo, this), true, ShiftDown);
button_info (Undo).set_flash (true);
button_info (FP_Read).set_action (boost::bind (&FaderPort::read, this), true);
button_info (FP_Write).set_action (boost::bind (&FaderPort::write, this), true);
button_info (FP_Touch).set_action (boost::bind (&FaderPort::touch, this), true);
button_info (FP_Off).set_action (boost::bind (&FaderPort::off, this), true);
button_info (Play).set_action (boost::bind (&BasicUI::transport_play, this, true), true);
button_info (RecEnable).set_action (boost::bind (&BasicUI::rec_enable_toggle, this), true);
/* Stop is a modifier, so we have to use its own button state to get
@ -796,6 +808,8 @@ FaderPort::set_current_route (boost::shared_ptr<Route> r)
mp->cut_control()->Changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_cut, this), this);
}
}
//ToDo: subscribe to the fader automation modes so we can light the LEDs
map_route_state ();
}

View file

@ -148,10 +148,10 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
Bank = 20,
Right = 21,
Output = 22,
Read = 10,
Write = 9,
Touch = 8,
Off = 23,
FP_Read = 10,
FP_Write = 9,
FP_Touch = 8,
FP_Off = 23,
Mix = 11,
Proj = 12,
Trns = 13,
@ -264,6 +264,15 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
/* operations (defined in operations.cc) */
void read ();
void write ();
void left ();
void right ();
void touch ();
void off ();
void undo ();
void redo ();
void solo ();

View file

@ -22,12 +22,80 @@
#include "ardour/rc_configuration.h"
#include "ardour/session.h"
#include "ardour/track.h"
#include "ardour/types.h"
#include "faderport.h"
using namespace ARDOUR;
using namespace ArdourSurface;
void
FaderPort::left ()
{
access_action ("Editor/select-prev-route");
//ToDo: bank by 8?
//if ( (button_state & ShiftDown) == ShiftDown )
}
void
FaderPort::right ()
{
access_action ("Editor/select-next-route");
//ToDo: bank by 8?
//if ( (button_state & ShiftDown) == ShiftDown )
}
void
FaderPort::read ()
{
if (_current_route) {
boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
if (gain) {
gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Play );
}
}
}
void
FaderPort::write ()
{
if (_current_route) {
boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
if (gain) {
gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Write );
}
}
}
void
FaderPort::touch ()
{
if (_current_route) {
boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
if (gain) {
gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Touch );
}
}
}
void
FaderPort::off ()
{
if (_current_route) {
boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
if (gain) {
gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Off );
}
}
}
void
FaderPort::undo ()
{