13
0

triggerbox: TRIGGER_DIRECT_SET should also set ui_state

bugfix: changing the FA state can overwrite the clip's name and color

Some params (like gain) can and should take effect immediately
by directly setting the properties.  TRIGGER_DIRECT_SET does that.
But we still, ALSO have to set the ui_state, because when the
triggerbox imports ui_state via update_properties() it will
overwrite your changes.

Said another way:  since we use a queued ui_state to set the properties,
you ALWAYS have to set and use the ui_state mechanism, even if you want
to short-circuit the process for specific properties.
This commit is contained in:
Ben Loftis 2022-03-20 09:40:20 -05:00
parent 40744c672a
commit 1a3b82a12e

View File

@ -494,6 +494,10 @@ Trigger::set_ ## name (type val) \
{ \
if (_ ## name == val) { return; } \
_ ## name = val; \
ui_state.name = val; \
unsigned int g = ui_state.generation.load(); \
do { ui_state.name = val; } while (!ui_state.generation.compare_exchange_strong (g, g+1)); \
DEBUG_TRACE (DEBUG::Triggers, string_compose ("trigger %1 property& cas-set: %2 gen %3\n", index(), _ ## name.property_name(), ui_state.generation.load())); \
send_property_change (Properties::name); /* EMIT SIGNAL */ \
_box.session().set_dirty (); \
} \
@ -509,6 +513,10 @@ Trigger::set_ ## name (type const & val) \
{ \
if (_ ## name == val) { return; } \
_ ## name = val; \
ui_state.name = val; \
unsigned int g = ui_state.generation.load(); \
do { ui_state.name = val; } while (!ui_state.generation.compare_exchange_strong (g, g+1)); \
DEBUG_TRACE (DEBUG::Triggers, string_compose ("trigger %1 property& cas-set: %2 gen %3\n", index(), _ ## name.property_name(), ui_state.generation.load())); \
send_property_change (Properties::name); /* EMIT SIGNAL */ \
_box.session().set_dirty (); \
} \
@ -520,6 +528,7 @@ Trigger::name () const \
TRIGGER_DIRECT_SET_CONST_REF (name, std::string)
TRIGGER_DIRECT_SET (color, color_t)
TRIGGER_DIRECT_SET (gain, gain_t)
void
Trigger::set_ui (void* p)
@ -548,25 +557,6 @@ Trigger::set_allow_patch_changes (bool yn)
_box.session().set_dirty();
}
gain_t
Trigger::gain () const
{
return _gain;
}
void
Trigger::set_gain (gain_t g)
{
if (_gain == g) {
return;
}
_gain = g;
send_property_change (Properties::gain);
_box.session().set_dirty();
}
void
Trigger::bang ()
{