Skip to content

Control widget property connection improvements#3806

Merged
Holzhaus merged 7 commits into
mixxxdj:2.3from
daschuer:ControlWidgetPropertyConnection
Apr 30, 2021
Merged

Control widget property connection improvements#3806
Holzhaus merged 7 commits into
mixxxdj:2.3from
daschuer:ControlWidgetPropertyConnection

Conversation

@daschuer
Copy link
Copy Markdown
Member

This should hopefully fix the root cause for the GUI lag using high res rate slider reported here:
https://mixxx.discourse.group/t/mixtrack-pro-3-tempo-slider-lag-on-w10/21835/18

The original fix in is still relevant for an improved API.
#3804

@NotYourAverageAl
Please test this fix as well.

@alhadebe
Copy link
Copy Markdown
Contributor

@daschuer I can confirm this PR fixes the lag as well. Thanks
Cant help with code review...yet

Comment thread src/widget/controlwidgetconnection.cpp Outdated
Comment on lines 141 to 148
vParameter.convert(m_property.type());
if (m_propertyValue == vParameter) {
// don't repeat writing the same value that may stall the GUI
// Comparing the property value directly does not work, because
// in some cases (e.g. visible) it has to be propagated to the child widgets.
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is a good idea. If I understand correctly, this code basically deduplicates subsequent signals which carry the same value. Some GUI controls might rely on the fact that those "duplicate" signals are not swallowed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the alternatives?

One alternative would be to make the no ops updates optional. I have skimmed through the skins and did not find a point where it would be enabled. If we find a point, we can add it.

What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the value is not accompanied by something else like a timestamp that actually changes receivers should better not make any assumptions about how frequently an unchanged value is sent. A value should be written at least once after it has been modified. Period.

But we need to test thoroughly! The current code might contain bugs and hidden dependencies that require repeated updates for not getting stuck in an inconsistent state.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is just influencing the behavior of the CO in the skin and not the CO in general, it should be fine, but this discrepancy/optimization needs to be documented so others don't trip over this when they notice that some CO works differently in Skins and Controllermappings.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/widget/controlwidgetconnection.cpp Outdated
Comment thread src/widget/controlwidgetconnection.cpp Outdated
Comment thread src/widget/controlwidgetconnection.h Outdated
Comment thread src/widget/controlwidgetconnection.cpp Outdated
Comment on lines 141 to 148
vParameter.convert(m_property.type());
if (m_propertyValue == vParameter) {
// don't repeat writing the same value that may stall the GUI
// Comparing the property value directly does not work, because
// in some cases (e.g. visible) it has to be propagated to the child widgets.
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the value is not accompanied by something else like a timestamp that actually changes receivers should better not make any assumptions about how frequently an unchanged value is sent. A value should be written at least once after it has been modified. Period.

But we need to test thoroughly! The current code might contain bugs and hidden dependencies that require repeated updates for not getting stuck in an inconsistent state.

@daschuer
Copy link
Copy Markdown
Member Author

Done.

@daschuer daschuer force-pushed the ControlWidgetPropertyConnection branch from 9a4dce4 to 2c20cc7 Compare April 27, 2021 06:23
@ronso0 ronso0 added this to the 2.3.0 milestone Apr 27, 2021
Comment thread src/widget/controlwidgetconnection.cpp Outdated
QVariant property = pWidget->property(m_propertyName.constData());
if (property.type() == QVariant::Bool) {
parameter = getControlParameterForValue(v) > 0;
double parameter = getControlParameterForValue(v);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
double parameter = getControlParameterForValue(v);
const double parameter = getControlParameterForValue(v);

Comment thread src/widget/controlwidgetconnection.cpp Outdated
VERIFY_OR_DEBUG_ASSERT(meta) {
return QMetaProperty();
}
int id = meta->indexOfProperty(name.toLatin1().constData());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int id = meta->indexOfProperty(name.toLatin1().constData());
const int id = meta->indexOfProperty(name.toLatin1().constData());

Comment thread src/widget/controlwidgetconnection.cpp Outdated
Comment on lines +152 to +153
DEBUG_ASSERT(success);
Q_UNUSED(success);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if success is false? Should we return early?

@daschuer
Copy link
Copy Markdown
Member Author

done.

Copy link
Copy Markdown
Member

@Holzhaus Holzhaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you.

@Holzhaus Holzhaus merged commit 455b9d4 into mixxxdj:2.3 Apr 30, 2021
@daschuer daschuer deleted the ControlWidgetPropertyConnection branch August 1, 2021 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants