-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
show effect parameter units in parameter name label #11041
Conversation
1d806e8
to
0d9a4fc
Compare
(rebasing & rebasing while testing QStringLiteral vs. QLatin1String in |
|
e30b12a
to
99df207
Compare
Unofficial LV2 units are now logged if |
I tried this, but couldn't find any parameter with unit other than Hz. I'm not sure if other units doesn't work, or if the effects have no unit specified. |
Yeah, built-in effects have Hz, dB and ms IIRC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works already nice. I have left some comments.
There is a minor issue with the layouts.
The unit is jumping when crossing a trailing 0 that is omitted.
All knobs are jumping in case a long label is replaced by a shorter value text.
Not sure if this is worth to fix.
The filter knobs can make use of a more complex logic for showing the significant numbers and a conditional kilo k. But that is also quite advanced, just an idea.
// EffectManifestParameter::unitsHintToString | ||
unitsHint = EffectManifestParameter::lv2UnitToUnitsHint( | ||
lilv_node_as_string(customUnit)); | ||
if (lv2ParamDebug && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one should be always enabled. If it happens on a user machine it will go to the mixxx.log and we can request this during bug hunting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, yes, but in my case with the LSP suite it prints hundreds of lines with G
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can leave it enabled until the release so we can easily look for missing units?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we know of the G case and have decided to use no unit for it. How about skip the message in this case. This also gives a chance to drop a comment about to our decision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, for G
it's a simple check. if the blacklist grows we need to rework this though.
not sure how to fix that. Using a fixed number of decimals wouldn't fix the position since the integer part of the value cn change, too, for example a Center1/2 of the param. EQ
nope, see above. |
With the current unit blacklist I get notified only about plugin "MaBitcrush" has custom unit "bits" for parameter "resolution" |
A question about performance vs. easy maintenance: |
@daschuer As soon the fixup look good to you I'll squash them. |
A QHash would be faster. This topic has made me rethink the whole custom units topic: What do you think? |
I'm not sure I understand. Where exactly you want to use the LV2 render method? |
In case we decide to extend this for custom units, most of the current code and replacements can remain working. I will comment the places inline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the comments.
Just as suggestion. This PR is also good without.
} | ||
} | ||
|
||
static QString unitsHintToString(const UnitsHint unitsHint) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This table can be changed to return the format string (or LB2 renderer).
Like "%f ms"
if (m_unitString.isEmpty()) { | ||
setText(QString::number(dispVal)); | ||
} else { | ||
setText(QString::number(dispVal) + QChar(' ') + m_unitString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setText(QString::number(dispVal) + QChar(' ') + m_unitString); | |
setText(QString::asprintf(m_unitString, dispVal)); |
ok, I understand your proposal and why you think it could be an improvement. 1 get rid of the Using the lilv methods to get the LV2 format strings also from UnitsHint of built-in effects would work, too, of course, but IMO that's much more code (and runtime effort?) than simply returning a pre-set string. Regarding maintenance: the units list won't change very often. Tbh I don't expect anyone to ask for adding a custom unit since no one really cared much about the LV2 UI (looking at the forums requests and filed bugs). And if someone does, it's rather easy (if we annotate the methods well). 2 store the param unit (format) string as soon as an effect is registered, not in the widget when it's loaded to the parameter slot (load effect, or move or show parameter) Re asprintf() |
Hey, it was just an idea for improvement. If you do not get hooked on it, we can keep the original mode of this. I don't even think that there is a performance bottle neck to solve. Using "%.nf" will unfortunately introduce an compatibility issue with the LV2 units, because they do not have this. So It is probably better to adjust the value before formatting. I do not see an issue with "mins" and "min", because we can use for all non custom units our internal format string. |
hehe, I did get hooked on it, but you were referring only to custom units, while I assumed you want to use the LV2 units lib for built-in effects. Anyway...
Yes, that's what I meant: adjust |
ab1c1cb
to
7b6dcfa
Compare
requires checking for 'lv2' package if LILV cmake option is enabled
7b6dcfa
to
271dea9
Compare
5280012
to
dbcffab
Compare
dbcffab
to
702871a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and works good. Thank you.
🎉 thanks for your review and ideas! |
Follow-up for #11032
EffectManifestParameter::UnitsHint
Note: custom unit constructors are ignored.
EffectManifestParameter::UnitsHint
to display stringsNice to have:
Hz
> 10.000 tokHz
?