mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
convert rec-enable control for a Track from PBD::COntrollable to ARDOUR::AutomatioNControl, and use in MCP
git-svn-id: svn://localhost/ardour2/branches/3.0@11956 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
d7595f71be
commit
13699251d9
7 changed files with 54 additions and 27 deletions
|
|
@ -47,6 +47,8 @@ Amp::Amp (Session& s)
|
||||||
p.set_range (0, 1.99526231f, 1, false);
|
p.set_range (0, 1.99526231f, 1, false);
|
||||||
boost::shared_ptr<AutomationList> gl (new AutomationList (p));
|
boost::shared_ptr<AutomationList> gl (new AutomationList (p));
|
||||||
_gain_control = boost::shared_ptr<GainControl> (new GainControl (X_("gaincontrol"), s, this, p, gl));
|
_gain_control = boost::shared_ptr<GainControl> (new GainControl (X_("gaincontrol"), s, this, p, gl));
|
||||||
|
_gain_control->set_flags (Controllable::GainLike);
|
||||||
|
|
||||||
add_control(_gain_control);
|
add_control(_gain_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ class AutomationControl : public PBD::Controllable, public Evoral::Control
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutomationControl(ARDOUR::Session&,
|
AutomationControl(ARDOUR::Session&,
|
||||||
const Evoral::Parameter& parameter,
|
const Evoral::Parameter& parameter,
|
||||||
boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(),
|
boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(),
|
||||||
const std::string& name="");
|
const std::string& name="");
|
||||||
|
|
||||||
boost::shared_ptr<AutomationList> alist() const {
|
boost::shared_ptr<AutomationList> alist() const {
|
||||||
return boost::dynamic_pointer_cast<AutomationList>(_list);
|
return boost::dynamic_pointer_cast<AutomationList>(_list);
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ class Track : public Route, public PublicDiskstream
|
||||||
virtual int set_state (const XMLNode&, int version);
|
virtual int set_state (const XMLNode&, int version);
|
||||||
static void zero_diskstream_id_in_xml (XMLNode&);
|
static void zero_diskstream_id_in_xml (XMLNode&);
|
||||||
|
|
||||||
boost::shared_ptr<PBD::Controllable> rec_enable_control() { return _rec_enable_control; }
|
boost::shared_ptr<AutomationControl> rec_enable_control() { return _rec_enable_control; }
|
||||||
|
|
||||||
bool record_enabled() const;
|
bool record_enabled() const;
|
||||||
void set_record_enabled (bool yn, void *src);
|
void set_record_enabled (bool yn, void *src);
|
||||||
|
|
@ -201,13 +201,13 @@ class Track : public Route, public PublicDiskstream
|
||||||
FreezeState state;
|
FreezeState state;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RecEnableControllable : public PBD::Controllable {
|
struct RecEnableControl : public AutomationControl {
|
||||||
RecEnableControllable (Track&);
|
RecEnableControl (boost::shared_ptr<Track> t);
|
||||||
|
|
||||||
void set_value (double);
|
void set_value (double);
|
||||||
double get_value (void) const;
|
double get_value (void) const;
|
||||||
|
|
||||||
Track& track;
|
boost::shared_ptr<Track> track;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void set_state_part_two () = 0;
|
virtual void set_state_part_two () = 0;
|
||||||
|
|
@ -218,7 +218,7 @@ class Track : public Route, public PublicDiskstream
|
||||||
|
|
||||||
void maybe_declick (BufferSet&, framecnt_t, int);
|
void maybe_declick (BufferSet&, framecnt_t, int);
|
||||||
|
|
||||||
boost::shared_ptr<RecEnableControllable> _rec_enable_control;
|
boost::shared_ptr<RecEnableControl> _rec_enable_control;
|
||||||
|
|
||||||
framecnt_t check_initial_delay (framecnt_t nframes, framecnt_t&);
|
framecnt_t check_initial_delay (framecnt_t nframes, framecnt_t&);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,8 @@ namespace ARDOUR {
|
||||||
MidiSystemExclusiveAutomation,
|
MidiSystemExclusiveAutomation,
|
||||||
FadeInAutomation,
|
FadeInAutomation,
|
||||||
FadeOutAutomation,
|
FadeOutAutomation,
|
||||||
EnvelopeAutomation
|
EnvelopeAutomation,
|
||||||
|
RecEnableAutomation
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AutoState {
|
enum AutoState {
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,9 @@ EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const
|
||||||
case PanFrontBackAutomation:
|
case PanFrontBackAutomation:
|
||||||
case PanLFEAutomation:
|
case PanLFEAutomation:
|
||||||
break;
|
break;
|
||||||
|
case RecEnableAutomation:
|
||||||
|
/* default 0.0 - 1.0 is fine */
|
||||||
|
break;
|
||||||
case PluginAutomation:
|
case PluginAutomation:
|
||||||
case SoloAutomation:
|
case SoloAutomation:
|
||||||
case MuteAutomation:
|
case MuteAutomation:
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, Data
|
||||||
, _saved_meter_point (_meter_point)
|
, _saved_meter_point (_meter_point)
|
||||||
, _mode (mode)
|
, _mode (mode)
|
||||||
, _monitoring (MonitorAuto)
|
, _monitoring (MonitorAuto)
|
||||||
, _rec_enable_control (new RecEnableControllable(*this))
|
|
||||||
{
|
{
|
||||||
_freeze_record.state = NoFreeze;
|
_freeze_record.state = NoFreeze;
|
||||||
_declickable = true;
|
_declickable = true;
|
||||||
|
|
@ -64,6 +63,15 @@ Track::init ()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<Route> rp (shared_from_this());
|
||||||
|
boost::shared_ptr<Track> rt = boost::dynamic_pointer_cast<Track> (rp);
|
||||||
|
_rec_enable_control = boost::shared_ptr<RecEnableControl> (new RecEnableControl(rt));
|
||||||
|
_rec_enable_control->set_flags (Controllable::Toggle);
|
||||||
|
|
||||||
|
/* don't add rec_enable_control to controls because we don't want it to
|
||||||
|
* appear as an automatable parameter
|
||||||
|
*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,23 +203,24 @@ Track::freeze_state() const
|
||||||
return _freeze_record.state;
|
return _freeze_record.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
Track::RecEnableControllable::RecEnableControllable (Track& s)
|
Track::RecEnableControl::RecEnableControl (boost::shared_ptr<Track> t)
|
||||||
: Controllable (X_("recenable"), Controllable::Toggle), track (s)
|
: AutomationControl (t->session(), RecEnableAutomation, boost::shared_ptr<AutomationList>(), X_("recenable"))
|
||||||
|
, track (t)
|
||||||
{
|
{
|
||||||
|
boost::shared_ptr<AutomationList> gl(new AutomationList(Evoral::Parameter(RecEnableAutomation)));
|
||||||
|
set_list (gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Track::RecEnableControllable::set_value (double val)
|
Track::RecEnableControl::set_value (double val)
|
||||||
{
|
{
|
||||||
bool bval = ((val >= 0.5) ? true: false);
|
track->set_record_enabled (val >= 0.5 ? true : false, this);
|
||||||
track.set_record_enabled (bval, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
Track::RecEnableControllable::get_value (void) const
|
Track::RecEnableControl::get_value (void) const
|
||||||
{
|
{
|
||||||
if (track.record_enabled()) { return 1.0; }
|
return (track->record_enabled() ? 1.0 : 0.0);
|
||||||
return 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -164,11 +164,13 @@ Strip::set_route (boost::shared_ptr<Route> r)
|
||||||
|
|
||||||
if (_solo) {
|
if (_solo) {
|
||||||
_solo->set_normal_control (_route->solo_control());
|
_solo->set_normal_control (_route->solo_control());
|
||||||
|
_solo->set_modified_control (boost::shared_ptr<AutomationControl>());
|
||||||
_route->solo_control()->Changed.connect(route_connections, invalidator(), ui_bind (&Strip::notify_solo_changed, this), ui_context());
|
_route->solo_control()->Changed.connect(route_connections, invalidator(), ui_bind (&Strip::notify_solo_changed, this), ui_context());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_mute) {
|
if (_mute) {
|
||||||
_mute->set_normal_control (_route->mute_control());
|
_mute->set_normal_control (_route->mute_control());
|
||||||
|
_mute->set_modified_control (boost::shared_ptr<AutomationControl>());
|
||||||
_route->mute_control()->Changed.connect(route_connections, invalidator(), ui_bind (&Strip::notify_mute_changed, this), ui_context());
|
_route->mute_control()->Changed.connect(route_connections, invalidator(), ui_bind (&Strip::notify_mute_changed, this), ui_context());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -181,13 +183,15 @@ Strip::set_route (boost::shared_ptr<Route> r)
|
||||||
_route->pannable()->pan_width_control->Changed.connect(route_connections, invalidator(), ui_bind (&Strip::notify_panner_changed, this, false), ui_context());
|
_route->pannable()->pan_width_control->Changed.connect(route_connections, invalidator(), ui_bind (&Strip::notify_panner_changed, this, false), ui_context());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* bind fader & pan pot, as appropriate for current flip mode */
|
||||||
|
|
||||||
flip_mode_changed (false);
|
flip_mode_changed (false);
|
||||||
|
|
||||||
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route);
|
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route);
|
||||||
|
|
||||||
if (trk) {
|
if (trk) {
|
||||||
// XXX FIX ME WHEN rec-enable IS-A AutomationControl
|
_recenable->set_normal_control (trk->rec_enable_control());
|
||||||
// _recenable->set_normal_control (trk->rec_enable_control());
|
_recenable->set_modified_control (boost::shared_ptr<AutomationControl>());
|
||||||
trk->rec_enable_control()->Changed .connect(route_connections, invalidator(), ui_bind (&Strip::notify_record_enable_changed, this), ui_context());
|
trk->rec_enable_control()->Changed .connect(route_connections, invalidator(), ui_bind (&Strip::notify_record_enable_changed, this), ui_context());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -376,6 +380,9 @@ Strip::handle_button (Button& button, ButtonState bs)
|
||||||
|
|
||||||
if (button.id() >= Button::select_base_id &&
|
if (button.id() >= Button::select_base_id &&
|
||||||
button.id() < Button::select_base_id + 8) {
|
button.id() < Button::select_base_id + 8) {
|
||||||
|
|
||||||
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("select touch, lock ? %1\n", ((ms & lock_mod) == lock_mod) ? 1 : 0));
|
||||||
|
|
||||||
if ((ms & lock_mod) == lock_mod) {
|
if ((ms & lock_mod) == lock_mod) {
|
||||||
_controls_locked = !_controls_locked;
|
_controls_locked = !_controls_locked;
|
||||||
return;
|
return;
|
||||||
|
|
@ -405,14 +412,19 @@ Strip::handle_button (Button& button, ButtonState bs)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ms & MackieControlProtocol::MODIFIER_OPTION) {
|
boost::shared_ptr<AutomationControl> control = button.control (modified);
|
||||||
/* reset to default/normal value */
|
|
||||||
|
if (control) {
|
||||||
boost::shared_ptr<AutomationControl> control = button.control (modified);
|
if (ms & MackieControlProtocol::MODIFIER_OPTION) {
|
||||||
|
/* reset to default/normal value */
|
||||||
if (control) {
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("reset %1 to default of %2\n", control->name(), control->normal()));
|
||||||
control->set_value (!control->get_value());
|
control->set_value (control->normal());
|
||||||
|
} else {
|
||||||
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("toggle %1 to default of %2\n", control->name(), control->get_value() ? 0.0 : 1.0));
|
||||||
|
control->set_value (control->get_value() ? 0.0 : 1.0);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("button has no control at present (modified ? %1)\n", modified));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue