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
|
@ -47,6 +47,8 @@ Amp::Amp (Session& s)
|
|||
p.set_range (0, 1.99526231f, 1, false);
|
||||
boost::shared_ptr<AutomationList> gl (new AutomationList (p));
|
||||
_gain_control = boost::shared_ptr<GainControl> (new GainControl (X_("gaincontrol"), s, this, p, gl));
|
||||
_gain_control->set_flags (Controllable::GainLike);
|
||||
|
||||
add_control(_gain_control);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ class AutomationControl : public PBD::Controllable, public Evoral::Control
|
|||
{
|
||||
public:
|
||||
AutomationControl(ARDOUR::Session&,
|
||||
const Evoral::Parameter& parameter,
|
||||
boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(),
|
||||
const std::string& name="");
|
||||
const Evoral::Parameter& parameter,
|
||||
boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(),
|
||||
const std::string& name="");
|
||||
|
||||
boost::shared_ptr<AutomationList> alist() const {
|
||||
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);
|
||||
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;
|
||||
void set_record_enabled (bool yn, void *src);
|
||||
|
@ -201,13 +201,13 @@ class Track : public Route, public PublicDiskstream
|
|||
FreezeState state;
|
||||
};
|
||||
|
||||
struct RecEnableControllable : public PBD::Controllable {
|
||||
RecEnableControllable (Track&);
|
||||
struct RecEnableControl : public AutomationControl {
|
||||
RecEnableControl (boost::shared_ptr<Track> t);
|
||||
|
||||
void set_value (double);
|
||||
double get_value (void) const;
|
||||
|
||||
Track& track;
|
||||
boost::shared_ptr<Track> track;
|
||||
};
|
||||
|
||||
virtual void set_state_part_two () = 0;
|
||||
|
@ -218,7 +218,7 @@ class Track : public Route, public PublicDiskstream
|
|||
|
||||
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&);
|
||||
|
||||
|
|
|
@ -145,7 +145,8 @@ namespace ARDOUR {
|
|||
MidiSystemExclusiveAutomation,
|
||||
FadeInAutomation,
|
||||
FadeOutAutomation,
|
||||
EnvelopeAutomation
|
||||
EnvelopeAutomation,
|
||||
RecEnableAutomation
|
||||
};
|
||||
|
||||
enum AutoState {
|
||||
|
|
|
@ -159,6 +159,9 @@ EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const
|
|||
case PanFrontBackAutomation:
|
||||
case PanLFEAutomation:
|
||||
break;
|
||||
case RecEnableAutomation:
|
||||
/* default 0.0 - 1.0 is fine */
|
||||
break;
|
||||
case PluginAutomation:
|
||||
case SoloAutomation:
|
||||
case MuteAutomation:
|
||||
|
|
|
@ -44,7 +44,6 @@ Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, Data
|
|||
, _saved_meter_point (_meter_point)
|
||||
, _mode (mode)
|
||||
, _monitoring (MonitorAuto)
|
||||
, _rec_enable_control (new RecEnableControllable(*this))
|
||||
{
|
||||
_freeze_record.state = NoFreeze;
|
||||
_declickable = true;
|
||||
|
@ -64,6 +63,15 @@ Track::init ()
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -195,23 +203,24 @@ Track::freeze_state() const
|
|||
return _freeze_record.state;
|
||||
}
|
||||
|
||||
Track::RecEnableControllable::RecEnableControllable (Track& s)
|
||||
: Controllable (X_("recenable"), Controllable::Toggle), track (s)
|
||||
Track::RecEnableControl::RecEnableControl (boost::shared_ptr<Track> t)
|
||||
: 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
|
||||
Track::RecEnableControllable::set_value (double val)
|
||||
Track::RecEnableControl::set_value (double val)
|
||||
{
|
||||
bool bval = ((val >= 0.5) ? true: false);
|
||||
track.set_record_enabled (bval, this);
|
||||
track->set_record_enabled (val >= 0.5 ? true : false, this);
|
||||
}
|
||||
|
||||
double
|
||||
Track::RecEnableControllable::get_value (void) const
|
||||
Track::RecEnableControl::get_value (void) const
|
||||
{
|
||||
if (track.record_enabled()) { return 1.0; }
|
||||
return 0.0;
|
||||
return (track->record_enabled() ? 1.0 : 0.0);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -164,11 +164,13 @@ Strip::set_route (boost::shared_ptr<Route> r)
|
|||
|
||||
if (_solo) {
|
||||
_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());
|
||||
}
|
||||
|
||||
if (_mute) {
|
||||
_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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
/* bind fader & pan pot, as appropriate for current flip mode */
|
||||
|
||||
flip_mode_changed (false);
|
||||
|
||||
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -376,6 +380,9 @@ Strip::handle_button (Button& button, ButtonState bs)
|
|||
|
||||
if (button.id() >= Button::select_base_id &&
|
||||
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) {
|
||||
_controls_locked = !_controls_locked;
|
||||
return;
|
||||
|
@ -405,14 +412,19 @@ Strip::handle_button (Button& button, ButtonState bs)
|
|||
return;
|
||||
}
|
||||
|
||||
if (ms & MackieControlProtocol::MODIFIER_OPTION) {
|
||||
/* reset to default/normal value */
|
||||
|
||||
boost::shared_ptr<AutomationControl> control = button.control (modified);
|
||||
|
||||
if (control) {
|
||||
control->set_value (!control->get_value());
|
||||
boost::shared_ptr<AutomationControl> control = button.control (modified);
|
||||
|
||||
if (control) {
|
||||
if (ms & MackieControlProtocol::MODIFIER_OPTION) {
|
||||
/* reset to default/normal value */
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("reset %1 to default of %2\n", control->name(), control->normal()));
|
||||
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…
Reference in New Issue
Block a user