Trim automation is planned via SlavableAC as normal AutomationMode.
Some of this code have a revival (a special "Trim+Preview" state
before merging Automation but that has to be more general than Pan & Gain.
1.0, // upper
dB_coeff_step(Config->get_max_gain()) / 10.0, // step increment
dB_coeff_step(Config->get_max_gain())) // page increment
- , gain_automation_style_button ("")
, gain_automation_state_button ("")
, meter_point_button (_("pre"))
, gain_astate_propagate (false)
peak_display.unset_flags (Gtk::CAN_FOCUS);
peak_display.set_editable (false);
- gain_automation_style_button.set_name ("mixer strip button");
gain_automation_state_button.set_name ("mixer strip button");
set_tooltip (gain_automation_state_button, _("Fader automation mode"));
- set_tooltip (gain_automation_style_button, _("Fader automation type"));
- gain_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
gain_automation_state_button.set_size_request(15, 15);
- gain_automation_style_button.set_size_request(15, 15);
-
- gain_astyle_menu.items().push_back (MenuElem (_("Trim")));
- gain_astyle_menu.items().push_back (MenuElem (_("Abs")));
gain_astate_menu.set_name ("ArdourContextMenu");
gain_astate_menu.set_reserve_toggle_size(false);
- gain_astyle_menu.set_name ("ArdourContextMenu");
meter_point_button.set_name ("mixer strip button");
gain_astate_menu.items().push_back (MenuElem (_("Touch"),
sigc::bind (sigc::mem_fun (*this, &GainMeterBase::set_gain_astate), (AutoState) ARDOUR::Touch)));
- connections.push_back (gain_automation_style_button.signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeterBase::gain_automation_style_button_event), false));
connections.push_back (gain_automation_state_button.signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeterBase::gain_automation_state_button_event), false));
connections.push_back (ChangeGainAutomationState.connect (sigc::mem_fun(*this, &GainMeterBase::set_gain_astate)));
_control->alist()->automation_state_changed.connect (model_connections, invalidator (*this), boost::bind (&GainMeter::gain_automation_state_changed, this), gui_context());
- _control->alist()->automation_style_changed.connect (model_connections, invalidator (*this), boost::bind (&GainMeter::gain_automation_style_changed, this), gui_context());
gain_automation_state_changed ();
}
return TRUE;
}
-gint
-GainMeterBase::gain_automation_style_button_event (GdkEventButton *ev)
-{
- if (ev->type == GDK_BUTTON_RELEASE) {
- return TRUE;
- }
-
- switch (ev->button) {
- case 1:
- gain_astyle_menu.popup (1, ev->time);
- break;
- default:
- break;
- }
- return TRUE;
-}
string
GainMeterBase::astate_string (AutoState state)
return sstr;
}
-string
-GainMeterBase::astyle_string (AutoStyle style)
-{
- return _astyle_string (style, false);
-}
-
-string
-GainMeterBase::short_astyle_string (AutoStyle style)
-{
- return _astyle_string (style, true);
-}
-
-string
-GainMeterBase::_astyle_string (AutoStyle style, bool shrt)
-{
- if (style & Trim) {
- return _("Trim");
- } else {
- /* XXX it might different in different languages */
-
- return (shrt ? _("Abs") : _("Abs"));
- }
-}
-
-void
-GainMeterBase::gain_automation_style_changed ()
-{
- switch (_width) {
- case Wide:
- gain_automation_style_button.set_text (astyle_string(_control->alist()->automation_style()));
- break;
- case Narrow:
- gain_automation_style_button.set_text (short_astyle_string(_control->alist()->automation_style()));
- break;
- }
-}
-
void
GainMeterBase::gain_automation_state_changed ()
{
meter_metric_area.set_name ("AudioTrackMetrics");
meter_metric_area.set_size_request(PX_SCALE(24, 24), -1);
- gain_automation_style_button.set_name ("mixer strip button");
gain_automation_state_button.set_name ("mixer strip button");
set_tooltip (gain_automation_state_button, _("Fader automation mode"));
- set_tooltip (gain_automation_style_button, _("Fader automation type"));
- gain_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
gain_automation_state_button.set_size_request (PX_SCALE(12, 15), PX_SCALE(12, 15));
- gain_automation_style_button.set_size_request (PX_SCALE(12, 15), PX_SCALE(12, 15));
fader_vbox.set_spacing (0);
fader_vbox.pack_start (*gain_slider, true, true);
static std::string short_astate_string (ARDOUR::AutoState);
static std::string _astate_string (ARDOUR::AutoState, bool);
- static std::string astyle_string (ARDOUR::AutoStyle);
- static std::string short_astyle_string (ARDOUR::AutoStyle);
- static std::string _astyle_string (ARDOUR::AutoStyle, bool);
-
protected:
friend class MixerStrip;
sigc::connection gain_watching;
- ArdourButton gain_automation_style_button;
ArdourButton gain_automation_state_button;
Gtk::Menu gain_astate_menu;
- Gtk::Menu gain_astyle_menu;
ArdourButton meter_point_button;
bool gain_astate_propagate;
static sigc::signal<void, ARDOUR::AutoState> ChangeGainAutomationState;
- gint gain_automation_style_button_event (GdkEventButton *);
gint gain_automation_state_button_event (GdkEventButton *);
- gint pan_automation_style_button_event (GdkEventButton *);
gint pan_automation_state_button_event (GdkEventButton *);
void gain_automation_state_changed();
- void gain_automation_style_changed();
void setup_gain_adjustment ();
Width _width;
show_sends_button->set_text (_("Aux"));
}
- gpm.gain_automation_style_button.set_text (
- gpm.astyle_string(gain_automation->automation_style()));
gpm.gain_automation_state_button.set_text (
gpm.astate_string(gain_automation->automation_state()));
if (_route->panner()) {
- ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
- panners.astyle_string(_route->panner()->automation_style()));
((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
panners.astate_string(_route->panner()->automation_state()));
}
show_sends_button->set_text (_("Snd"));
}
- gpm.gain_automation_style_button.set_text (
- gpm.short_astyle_string(gain_automation->automation_style()));
gpm.gain_automation_state_button.set_text (
gpm.short_astate_string(gain_automation->automation_state()));
gain_meter().setup_meters (); // recalc meter width
if (_route->panner()) {
- ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
- panners.short_astyle_string(_route->panner()->automation_style()));
((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
panners.short_astate_string(_route->panner()->automation_state()));
}
boost::shared_ptr<Pannable> p = _route->pannable ();
p->automation_state_changed.connect (panstate_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_state_changed, &panners), gui_context());
- p->automation_style_changed.connect (panstyle_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_style_changed, &panners), gui_context());
/* This call reduncant, PannerUI::set_panner() connects to _panshell->Changed itself
* However, that only works a panner was previously set.
, _current_nins (-1)
, _current_uri ("")
, _send_mode (false)
- , pan_automation_style_button ("")
, pan_automation_state_button ("")
, _panner_list()
{
_ignore_width_change = false;
_ignore_position_change = false;
- pan_automation_style_button.set_name ("MixerAutomationModeButton");
pan_automation_state_button.set_name ("MixerAutomationPlaybackButton");
set_tooltip (pan_automation_state_button, _("Pan automation mode"));
- set_tooltip (pan_automation_style_button, _("Pan automation type"));
//set_size_request_to_display_given_text (pan_automation_state_button, X_("O"), 2, 2);
- //set_size_request_to_display_given_text (pan_automation_style_button, X_("0"), 2, 2);
- pan_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
pan_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
- pan_automation_style_button.signal_button_press_event().connect (sigc::mem_fun(*this, &PannerUI::pan_automation_style_button_event), false);
pan_automation_state_button.signal_button_press_event().connect (sigc::mem_fun(*this, &PannerUI::pan_automation_state_button_event), false);
pan_vbox.set_spacing (2);
return TRUE;
}
-gint
-PannerUI::pan_automation_style_button_event (GdkEventButton *ev)
-{
- if (ev->type == GDK_BUTTON_RELEASE) {
- return TRUE;
- }
-
- switch (ev->button) {
- case 1:
- if (pan_astyle_menu == 0) {
- build_astyle_menu ();
- }
- pan_astyle_menu->popup (1, ev->time);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-void
-PannerUI::pan_automation_style_changed ()
-{
- ENSURE_GUI_THREAD (*this, &PannerUI::pan_automation_style_changed)
-
- switch (_width) {
- case Wide:
- pan_automation_style_button.set_label (astyle_string(_panner->automation_style()));
- break;
- case Narrow:
- pan_automation_style_button.set_label (short_astyle_string(_panner->automation_style()));
- break;
- }
-}
-
void
PannerUI::pan_automation_state_changed ()
{
return sstr;
}
-string
-PannerUI::astyle_string (AutoStyle style)
-{
- return _astyle_string (style, false);
-}
-
-string
-PannerUI::short_astyle_string (AutoStyle style)
-{
- return _astyle_string (style, true);
-}
-
-string
-PannerUI::_astyle_string (AutoStyle style, bool shrt)
-{
- if (style & Trim) {
- return _("Trim");
- } else {
- /* XXX it might different in different languages */
-
- return (shrt ? _("Abs") : _("Abs"));
- }
-}
-
void
PannerUI::show_width ()
{
Gtk::Menu* pan_astate_menu;
Gtk::Menu* pan_astyle_menu;
- Gtk::Button pan_automation_style_button;
Gtk::ToggleButton pan_automation_state_button;
void pan_value_changed (uint32_t which);
void pan_set_custom_type (std::string type);
void pan_automation_state_changed();
- void pan_automation_style_changed();
- gint pan_automation_style_button_event (GdkEventButton *);
gint pan_automation_state_button_event (GdkEventButton *);
sigc::connection pan_watching;
std::string short_astate_string (ARDOUR::AutoState);
std::string _astate_string (ARDOUR::AutoState, bool);
- std::string astyle_string (ARDOUR::AutoStyle);
- std::string short_astyle_string (ARDOUR::AutoStyle);
- std::string _astyle_string (ARDOUR::AutoStyle, bool);
-
void start_touch (boost::weak_ptr<ARDOUR::AutomationControl>);
void stop_touch (boost::weak_ptr<ARDOUR::AutomationControl>);
AutoState get_parameter_automation_state (Evoral::Parameter param);
virtual void set_parameter_automation_state (Evoral::Parameter param, AutoState);
- AutoStyle get_parameter_automation_style (Evoral::Parameter param);
- void set_parameter_automation_style (Evoral::Parameter param, AutoStyle);
-
void protect_automation ();
const std::set<Evoral::Parameter>& what_can_be_automated() const { return _can_automate_list; }
return alist() ? alist()->automation_state() : Off;
}
- inline AutoStyle automation_style() const {
- return alist() ? alist()->automation_style() : Absolute;
- }
-
void set_automation_state(AutoState as);
- void set_automation_style(AutoStyle as);
void start_touch(double when);
void stop_touch(bool mark, double when);
AutoState automation_state() const { return _state; }
PBD::Signal1<void, AutoState> automation_state_changed;
- void set_automation_style (AutoStyle m);
- AutoStyle automation_style() const { return _style; }
- PBD::Signal0<void> automation_style_changed;
-
bool automation_playback() const {
return (_state & Play) || ((_state & Touch) && !touching());
}
void maybe_signal_changed ();
AutoState _state;
- AutoStyle _style;
gint _touching;
bool operator== (const AutomationList&) const { /* not called */ abort(); return false; }
AutoState automation_state() const { return _auto_state; }
PBD::Signal1<void, AutoState> automation_state_changed;
- void set_automation_style (AutoStyle m);
- AutoStyle automation_style() const { return _auto_style; }
- PBD::Signal0<void> automation_style_changed;
-
bool automation_playback() const {
return (_auto_state & Play) || ((_auto_state & Touch) && !touching());
}
protected:
boost::weak_ptr<Panner> _panner;
AutoState _auto_state;
- AutoStyle _auto_style;
gint _touching;
bool _has_state;
uint32_t _responding_to_control_auto_state_change;
void set_automation_state (AutoState);
AutoState automation_state() const;
- void set_automation_style (AutoStyle);
- AutoStyle automation_style() const;
virtual std::set<Evoral::Parameter> what_can_be_automated() const;
virtual std::string describe_parameter (Evoral::Parameter);
std::string auto_state_to_string (AutoState);
AutoState string_to_auto_state (std::string);
- enum AutoStyle {
- Absolute = 0x1,
- Trim = 0x2
- };
-
- std::string auto_style_to_string (AutoStyle);
- AutoStyle string_to_auto_style (std::string);
-
enum AlignStyle {
CaptureTime,
ExistingMaterial
return true;
}
-template <>
-inline bool to_string (ARDOUR::AutoStyle val, std::string& str)
-{
- str = ARDOUR::auto_style_to_string (val);
- return true;
-}
-
-template <>
-inline bool string_to (const std::string& str, ARDOUR::AutoStyle& as)
-{
- as = ARDOUR::string_to_auto_style (str);
- return true;
-}
-
template <>
inline bool to_string (ARDOUR::DataType val, std::string& str)
{
return result;
}
-void
-Automatable::set_parameter_automation_style (Evoral::Parameter param, AutoStyle s)
-{
- Glib::Threads::Mutex::Lock lm (control_lock());
-
- boost::shared_ptr<AutomationControl> c = automation_control(param, true);
-
- if (c && (s != c->automation_style())) {
- c->set_automation_style (s);
- _a_session.set_dirty ();
- }
-}
-
-AutoStyle
-Automatable::get_parameter_automation_style (Evoral::Parameter param)
-{
- Glib::Threads::Mutex::Lock lm (control_lock());
-
- boost::shared_ptr<Evoral::Control> c = control(param);
- boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list());
-
- if (c) {
- return l->automation_style();
- } else {
- return Absolute; // whatever
- }
-}
-
void
Automatable::protect_automation ()
{
}
}
-void
-AutomationControl::set_automation_style (AutoStyle as)
-{
- if (!_list) return;
- alist()->set_automation_style (as);
-}
-
void
AutomationControl::start_touch(double when)
{
, _before (0)
{
_state = Off;
- _style = Absolute;
g_atomic_int_set (&_touching, 0);
create_curve_if_necessary();
, _before (0)
{
_state = Off;
- _style = Absolute;
g_atomic_int_set (&_touching, 0);
create_curve_if_necessary();
, StatefulDestructible()
, _before (0)
{
- _style = other._style;
_state = other._state;
g_atomic_int_set (&_touching, other.touching());
: ControlList(other, start, end)
, _before (0)
{
- _style = other._style;
_state = other._state;
g_atomic_int_set (&_touching, other.touching());
{
g_atomic_int_set (&_touching, 0);
_state = Off;
- _style = Absolute;
set_state (node, Stateful::loading_state_version);
ControlList::operator= (other);
_state = other._state;
- _style = other._style;
_touching = other._touching;
mark_dirty ();
}
}
-void
-AutomationList::set_automation_style (AutoStyle s)
-{
- if (s != _style) {
- _style = s;
- automation_style_changed (); /* EMIT SIGNAL */
- }
-}
-
void
AutomationList::start_write_pass (double when)
{
root->set_property ("state", Off);
}
- root->set_property ("style", _style);
-
if (!_events.empty()) {
root->add_child_nocopy (serialize_events());
}
_default_value = 0.0;
}
- if (!node.get_property (X_("style"), _style)) {
- _style = Absolute;
- }
-
if (node.get_property (X_("state"), _state)) {
if (_state == Write) {
_state = Off;
return (
static_cast<ControlList const &> (*this) != static_cast<ControlList const &> (other) ||
_state != other._state ||
- _style != other._style ||
_touching != other._touching
);
}
IOChange _IOChange;
AutomationType _AutomationType;
AutoState _AutoState;
- AutoStyle _AutoStyle;
AutoConnectOption _AutoConnectOption;
TracksAutoNamingRule _TracksAutoNamingRule;
Session::StateOfTheState _Session_StateOfTheState;
REGISTER_ENUM (Play);
REGISTER_BITS (_AutoState);
- REGISTER_ENUM (Absolute);
- REGISTER_ENUM (Trim);
- REGISTER_BITS (_AutoStyle);
-
REGISTER_ENUM (CaptureTime);
REGISTER_ENUM (ExistingMaterial);
REGISTER (_AlignStyle);
.addCast<Evoral::Control> ("to_ctrl")
.addCast<SlavableAutomationControl> ("to_slavable")
.addFunction ("automation_state", &AutomationControl::automation_state)
- .addFunction ("automation_style", &AutomationControl::automation_style)
.addFunction ("set_automation_state", &AutomationControl::set_automation_state)
- .addFunction ("set_automation_style", &AutomationControl::set_automation_style)
.addFunction ("start_touch", &AutomationControl::start_touch)
.addFunction ("stop_touch", &AutomationControl::stop_touch)
.addFunction ("get_value", &AutomationControl::get_value)
.endNamespace ()
.endNamespace ()
- .beginNamespace ("AutoStyle")
- .addConst ("Absolute", ARDOUR::AutoStyle(Absolute))
- .addConst ("Trim", ARDOUR::AutoStyle(Trim))
- .endNamespace ()
-
.beginNamespace ("AutoState")
.addConst ("Off", ARDOUR::AutoState(Off))
.addConst ("Write", ARDOUR::AutoState(Write))
, pan_frontback_control (new PanControllable (s, "", this, PanFrontBackAutomation))
, pan_lfe_control (new PanControllable (s, "", this, PanLFEAutomation))
, _auto_state (Off)
- , _auto_style (Absolute)
, _has_state (false)
, _responding_to_control_auto_state_change (0)
{
}
}
-void
-Pannable::set_automation_style (AutoStyle style)
-{
- if (style != _auto_style) {
- _auto_style = style;
-
- const Controls& c (controls());
-
- for (Controls::const_iterator ci = c.begin(); ci != c.end(); ++ci) {
- boost::shared_ptr<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl>(ci->second);
- if (ac) {
- ac->alist()->set_automation_style (style);
- }
- }
-
- session().set_dirty ();
- automation_style_changed ();
- }
-}
-
void
Pannable::start_touch (double when)
{
}
}
-void
-Panner::set_automation_style (AutoStyle style)
-{
- _pannable->set_automation_style (style);
-}
-
void
Panner::set_automation_state (AutoState state)
{
return _pannable->automation_state();
}
-AutoStyle
-Panner::automation_style () const
-{
- return _pannable->automation_style ();
-}
-
bool
Panner::touching () const
{
return "";
}
-AutoStyle
-ARDOUR::string_to_auto_style (std::string str)
-{
- if (str == X_("Absolute")) {
- return Absolute;
- } else if (str == X_("Trim")) {
- return Trim;
- }
-
- fatal << string_compose (_("programming error: %1 %2"), "illegal AutoStyle string: ", str) << endmsg;
- abort(); /*NOTREACHED*/
- return Trim;
-}
-
-string
-ARDOUR::auto_style_to_string (AutoStyle as)
-{
- /* to be used only for XML serialization, no i18n done */
-
- switch (as) {
- case Absolute:
- return X_("Absolute");
- break;
- case Trim:
- return X_("Trim");
- break;
- }
-
- fatal << string_compose (_("programming error: %1 %2"), "illegal AutoStyle type: ", as) << endmsg;
- abort(); /*NOTREACHED*/
- return "";
-}
-
std::string
bool_as_string (bool yn)
{