Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VST3 non optimal calls #9619 #920

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 24 additions & 14 deletions gtk2_ardour/processor_box.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ ProcessorEntry::Control::Control (ProcessorEntry& e,std::shared_ptr<AutomationCo

_button.signal_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked));
_button.signal_led_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked_event));
c->Changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_changed, this), gui_context ());
c->Changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_changed, this, _3), gui_context ());
if (c->alist ()) {
c->alist()->automation_state_changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_automation_state_changed, this), gui_context());
control_automation_state_changed ();
Expand Down Expand Up @@ -1056,15 +1056,16 @@ ProcessorEntry::Control::Control (ProcessorEntry& e,std::shared_ptr<AutomationCo
_slider.signal_button_release_event().connect (sigc::mem_fun(*this, &Control::button_released));

_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &Control::slider_adjusted));
c->Changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_changed, this), gui_context ());
c->Changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_changed, this, _3), gui_context ());
if (c->alist ()) {
c->alist()->automation_state_changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_automation_state_changed, this), gui_context());
control_automation_state_changed ();
}
}

control_changed ();
set_tooltip ();
double control_value = c->get_value();
control_changed (control_value);
set_tooltip (control_value);

/* We're providing our own PersistentTooltip */
set_no_tooltip_whatsoever (_slider);
Expand All @@ -1075,14 +1076,15 @@ ProcessorEntry::Control::~Control ()
}

void
ProcessorEntry::Control::set_tooltip ()
ProcessorEntry::Control::set_tooltip (double control_value)
{
std::shared_ptr<AutomationControl> c = _control.lock ();

if (!c) {
return;
}
std::string tt = _name + ": " + ARDOUR::value_as_string (c->desc(), c->get_value ());

std::string tt = _name + ": " + ARDOUR::value_as_string (c->desc(), control_value);
string sm = Gtkmm2ext::markup_escape_text (tt);
_slider_persistant_tooltip.set_tip (sm);
ArdourWidgets::set_tooltip (_button, Gtkmm2ext::markup_escape_text (sm));
Expand All @@ -1101,8 +1103,10 @@ ProcessorEntry::Control::slider_adjusted ()
return;
}

c->set_value ( c->interface_to_internal(_adjustment.get_value (), true) , Controllable::NoGroup);
set_tooltip ();
double control_value = c->interface_to_internal(_adjustment.get_value (), true);

c->set_value (control_value , Controllable::NoGroup);
set_tooltip (control_value);
}

void
Expand Down Expand Up @@ -1146,9 +1150,11 @@ ProcessorEntry::Control::button_clicked ()

bool const n = _button.get_active ();

c->set_value (n ? 0 : 1, Controllable::NoGroup);
double control_value = n ? 0 : 1;

c->set_value (control_value, Controllable::NoGroup);
_button.set_active (!n);
set_tooltip ();
set_tooltip (control_value);
}

void
Expand All @@ -1175,23 +1181,27 @@ ProcessorEntry::Control::control_automation_state_changed ()
}

void
ProcessorEntry::Control::control_changed ()
ProcessorEntry::Control::control_changed (boost::optional<double> control_value)
{
std::shared_ptr<AutomationControl> c = _control.lock ();
if (!c) {
return;
}

if (control_value == boost::none) {
control_value = boost::optional<double> (c->get_value());
}

_ignore_ui_adjustment = true;

if (c->toggled ()) {
_button.set_active (c->get_value() > 0.5);
_button.set_active (control_value.value() > 0.5);
} else {
// Note: the _slider watches the controllable by itself
const double nval = c->internal_to_interface (c->get_value (), true);
const double nval = c->internal_to_interface (control_value.value(), true);
if (_adjustment.get_value() != nval) {
_adjustment.set_value (nval);
set_tooltip ();
set_tooltip (nval);
}
}

Expand Down
4 changes: 2 additions & 2 deletions gtk2_ardour/processor_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ class ProcessorEntry : public Gtkmm2ext::DnDVBoxChild, public sigc::trackable
void slider_adjusted ();
void button_clicked ();
void button_clicked_event (GdkEventButton *);
void control_changed ();
void control_changed (boost::optional<double> control_value);
void control_automation_state_changed ();
std::string state_id () const;
void set_tooltip ();
void set_tooltip (double control_value);

void start_touch (int);
void end_touch (int);
Expand Down
2 changes: 1 addition & 1 deletion gtk2_ardour/virtual_keyboard_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class VKBDControl : public PBD::Controllable
{
if (v != _value) {
_value = std::max (_lower, std::min (_upper, v));
Changed (true, gcd); /* EMIT SIGNAL */
Changed (true, gcd, v); /* EMIT SIGNAL */
ValueChanged ((int)_value); /* EMIT SIGNAL */
}
}
Expand Down
2 changes: 1 addition & 1 deletion libs/ardour/amp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Amp::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t /*end_sample*/,
/* see note in PluginInsert::connect_and_run ()
* set_value_unchecked() won't emit a signal since the value is effectively unchanged
*/
_gain_control->Changed (false, PBD::Controllable::NoGroup);
_gain_control->Changed (false, PBD::Controllable::NoGroup, boost::none);

} else if (target_gain != GAIN_COEFF_UNITY) {

Expand Down
4 changes: 2 additions & 2 deletions libs/ardour/ardour/monitor_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class /*LIBARDOUR_API*/ MPControl : public PBD::Controllable {
T newval = (T) v;
if (newval != _value) {
_value = std::max (_lower, std::min (_upper, newval));
Changed (true, gcd); /* EMIT SIGNAL */
Changed (true, gcd, v); /* EMIT SIGNAL */
}
}

Expand All @@ -84,7 +84,7 @@ class /*LIBARDOUR_API*/ MPControl : public PBD::Controllable {
MPControl& operator=(const T& v) {
if (v != _value) {
_value = std::max (_lower, std::min (_upper, v));
Changed (true, PBD::Controllable::UseGroup); /* EMIT SIGNAL */
Changed (true, PBD::Controllable::UseGroup, boost::none); /* EMIT SIGNAL */ // FIXME(bonsembiante): I don't know if here I should use _value or boost:none
}
return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/ardour/ardour/proxy_controllable.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LIBARDOUR_API ProxyControllable : public PBD::Controllable {
, _getter (getter)
{}

void set_value (double v, PBD::Controllable::GroupControlDisposition gcd) { if (_setter (v)) { Changed (true, gcd); /* EMIT SIGNAL */ } }
void set_value (double v, PBD::Controllable::GroupControlDisposition gcd) { if (_setter (v)) { Changed (true, gcd, v); /* EMIT SIGNAL */ } }
double get_value () const { return _getter (); }

std::string get_user_string () const {
Expand Down
2 changes: 1 addition & 1 deletion libs/ardour/audioregion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2473,7 +2473,7 @@ AudioRegion::_add_plugin (std::shared_ptr<RegionFxPlugin> rfx, std::shared_ptr<R
for (auto& ec : acs) {
std::shared_ptr<AutomationControl> ac (std::dynamic_pointer_cast<AutomationControl>(ec));
std::weak_ptr<AutomationControl> wc (ac);
ec->Changed.connect_same_thread (*this, [this, wc] (bool, PBD::Controllable::GroupControlDisposition)
ec->Changed.connect_same_thread (*this, [this, wc] (bool, PBD::Controllable::GroupControlDisposition, boost::optional<double>)
{
std::shared_ptr<AutomationControl> ac = wc.lock ();
if (ac && ac->automation_playback ()) {
Expand Down
8 changes: 4 additions & 4 deletions libs/ardour/automation_control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ AutomationControl::actually_set_value (double value, PBD::Controllable::GroupCon
<< " (was " << old_value << ") @ " << this << std::endl;
#endif

Changed (true, gcd);
Changed (true, gcd, value);
if (!al || !al->automation_playback ()) {
_session.set_dirty ();
}
Expand All @@ -238,7 +238,7 @@ void
AutomationControl::set_list (std::shared_ptr<Evoral::ControlList> list)
{
Control::set_list (list);
Changed (true, Controllable::NoGroup);
Changed (true, Controllable::NoGroup, boost::none);
}

void
Expand All @@ -264,7 +264,7 @@ AutomationControl::set_automation_state (AutoState as)
Control::set_double (val, timepos_t (_session.current_start ().beats()), true);
Control::set_double (val, timepos_t (_session.current_end ().beats()), true);
}
Changed (true, Controllable::NoGroup);
Changed (true, Controllable::NoGroup, val);
}
if (!touching()) {
AutomationWatch::instance().remove_automation_watch (std::dynamic_pointer_cast<AutomationControl>(shared_from_this()));
Expand All @@ -278,7 +278,7 @@ AutomationControl::set_automation_state (AutoState as)
}
} else {
AutomationWatch::instance().remove_automation_watch (std::dynamic_pointer_cast<AutomationControl>(shared_from_this()));
Changed (false, Controllable::NoGroup);
Changed (false, Controllable::NoGroup, val);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions libs/ardour/control_group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,13 @@ GainControlGroup::set_group_value (std::shared_ptr<AutomationControl> control, d
if (factor > 0.0f) {
factor = get_max_factor (factor);
if (factor == 0.0f) {
control->Changed (true, Controllable::ForGroup); /* EMIT SIGNAL */
control->Changed (true, Controllable::ForGroup, val); /* EMIT SIGNAL */
return;
}
} else {
factor = get_min_factor (factor);
if (factor == 0.0f) {
control->Changed (true, Controllable::ForGroup); /* EMIT SIGNAL */
control->Changed (true, Controllable::ForGroup, val); /* EMIT SIGNAL */
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion libs/ardour/gain_control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ GainControl::post_add_master (std::shared_ptr<AutomationControl> m)
{
if (m->get_value() == 0) {
/* master is at -inf, which forces this ctrl to -inf on assignment */
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
}
}

Expand Down
2 changes: 1 addition & 1 deletion libs/ardour/lv2_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2809,7 +2809,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
AutomationCtrlPtr c = get_automation_control (_bpm_control_port_index);
if (c && c->ac) {
/* may be NULL for replicated instances - only one custom UI/ctrl */
c->ac->Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
c->ac->Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
}
}

Expand Down
2 changes: 1 addition & 1 deletion libs/ardour/midi_track.cc
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ MidiTrack::update_controls (BufferSet const& bufs)
double old = control->get_double ();
control->set_double (ev.value(), timepos_t::zero (false), false);
if (old != ev.value()) {
control->Changed (false, Controllable::NoGroup);
control->Changed (false, Controllable::NoGroup, ev.value());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions libs/ardour/monitor_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace ARDOUR {
bool newval = fabs (v) >= 0.5;
if (newval != _value) {
_value = newval;
Changed (true, gcd); /* EMIT SIGNAL */
Changed (true, gcd, v); /* EMIT SIGNAL */
}
}
}
Expand Down Expand Up @@ -112,7 +112,7 @@ MonitorProcessor::allocate_channels (uint32_t size)
/* update solo_cnt when Solo changes */
std::shared_ptr<Controllable> sc = _channels.back()->soloed_control;
std::weak_ptr<Controllable> wc (sc);
sc->Changed.connect_same_thread (*this, [this, wc](bool, PBD::Controllable::GroupControlDisposition)
sc->Changed.connect_same_thread (*this, [this, wc](bool, PBD::Controllable::GroupControlDisposition, boost::optional<double>)
{
std::shared_ptr<Controllable> ac = wc.lock ();
if (ac && ac->get_value () > 0) {
Expand Down
12 changes: 6 additions & 6 deletions libs/ardour/mute_control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ MuteControl::post_add_master (std::shared_ptr<AutomationControl> m)

if (!muted_by_self() && !get_boolean_masters()) {
_muteable.mute_master()->set_muted_by_masters (true);
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
}
}
}
Expand All @@ -71,7 +71,7 @@ MuteControl::pre_remove_master (std::shared_ptr<AutomationControl> m)
if (m->get_value() && get_boolean_masters() == 1) {
_muteable.mute_master()->set_muted_by_masters (false);
if (!muted_by_self()) {
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
}
}
}
Expand Down Expand Up @@ -142,7 +142,7 @@ MuteControl::set_mute_points (MuteMaster::MutePoint mp)
_muteable.mute_points_changed (); /* EMIT SIGNAL */

if (_muteable.mute_master()->muted_by_self()) {
Changed (true, Controllable::UseGroup); /* EMIT SIGNAL */
Changed (true, Controllable::UseGroup, boost::none); /* EMIT SIGNAL */
}
}

Expand Down Expand Up @@ -202,16 +202,16 @@ MuteControl::automation_run (samplepos_t start, pframes_t len)
*/
if (muted_by_self () != mute) {
set_value_unchecked (mute ? 1. : 0.);
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
}
return;
}

if (mute && !muted()) {
set_value_unchecked (1.0); // mute
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
} else if (!mute && muted()) {
set_value_unchecked (0.0); // unmute
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
}
}
4 changes: 2 additions & 2 deletions libs/ardour/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,11 @@ Plugin::set_parameter (uint32_t /* which */, float /* value */, sampleoffset_t /
}

void
Plugin::parameter_changed_externally (uint32_t which, float /* value */)
Plugin::parameter_changed_externally (uint32_t which, float value)
{
_parameter_changed_since_last_preset = true;
_session.set_dirty ();
ParameterChangedExternally (which, get_parameter (which)); /* EMIT SIGNAL */
ParameterChangedExternally (which, value); /* EMIT SIGNAL */
PresetDirty (); /* EMIT SIGNAL */
}

Expand Down
2 changes: 1 addition & 1 deletion libs/ardour/plugin_insert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2727,7 +2727,7 @@ PluginInsert::set_state(const XMLNode& node, int version)
for (Controls::const_iterator li = controls().begin(); li != controls().end(); ++li) {
std::shared_ptr<PBD::Controllable> c = std::dynamic_pointer_cast<PBD::Controllable> (li->second);
if (c) {
c->Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
c->Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
}
}

Expand Down
4 changes: 2 additions & 2 deletions libs/ardour/region_fx_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class TimedPluginControl : public PlugInsertBase::PluginControl
*/
actually_set_value (current, PBD::Controllable::NoGroup);
} else { // generic UI, LV2
Changed (true, Controllable::NoGroup);
Changed (true, Controllable::NoGroup, boost::none);
}
return true;
}
Expand Down Expand Up @@ -381,7 +381,7 @@ RegionFxPlugin::set_state (const XMLNode& node, int version)
for (auto const& i : _controls) {
std::shared_ptr<AutomationControl> ac = std::dynamic_pointer_cast<AutomationControl> (i.second);
if (ac) {
ac->Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
ac->Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
}
}

Expand Down
2 changes: 1 addition & 1 deletion libs/ardour/session_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4555,7 +4555,7 @@ Session::config_changed (std::string p, bool ours)
} else if (p == "solo-control-is-listen-control") {
solo_control_mode_changed ();
} else if (p == "solo-mute-gain") {
_solo_cut_control->Changed (true, Controllable::NoGroup);
_solo_cut_control->Changed (true, Controllable::NoGroup, boost::none);
} else if (p == "timecode-offset" || p == "timecode-offset-negative") {
last_timecode_valid = false;
} else if (p == "ltc-sink-port") {
Expand Down
4 changes: 2 additions & 2 deletions libs/ardour/slavable_automation_control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ SlavableAutomationControl::master_changed (bool /*from_self*/, GroupControlDispo

update_boolean_masters_records (m);
if (send_signal) {
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
}
}

Expand Down Expand Up @@ -596,7 +596,7 @@ SlavableAutomationControl::boolean_automation_run (samplepos_t start, pframes_t
change = boolean_automation_run_locked (start, len);
}
if (change) {
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
Changed (false, Controllable::NoGroup, boost::none); /* EMIT SIGNAL */
}
return change;
}
Expand Down
Loading