-
-
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
Effect chain selectors: add empty item to allow clearing the chain #4892
Conversation
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.
alternative solution proposal: introduce a concept of read-only presets and make the "empty chain preset" read-only.
src/effects/effectchain.cpp
Outdated
// empty '---' item in skins or DlgPrefEq (deck QuickEffects). | ||
m_presetName = kNoEffectString; | ||
emit chainPresetChanged(kNoEffectString); | ||
setControlLoadedPresetIndex(-1); |
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.
that'll break in the future because the preset index is unsigned. (It works right now because the underflow and overflow cancel each other out, but thats still not a solution).
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 the best option would be to change setControlLoadedPresetIndex
to take a std::optional
. Not super efficient, but IMO the safest approach.
void EffectChain::setControlLoadedPresetIndex(std::optional<uint> index) {
// add 1 to make the ControlObject 1-indexed like other ControlObjects
// if the effect chain is cleared (no valid index), the CO is 0;
m_pControlLoadedChainPreset->setAndConfirm(index ? *index + 1 : 0);
}
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.
Thanks for the hint, I overlooked uint.
std::optional looks like a good fit, I'll try that.
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.
Added by 4e64f7a
Thanks for your review!
Well, IMO these empty items are only useful for the effect chain selectors and in the EQ preferences (to cover Shade which has no quick effect selectors). I tried the effect chain approach first because it seemed to be the simplest solution. Though it's not. Besides the read-only attribute, it also needs to be hidden from the effects preferences and the WEffectChainMenuButton (it's kinda useless/confusing in both), and probably also prevent it from being copied to the user directory, which complicates things more than necessary IMO, considering the simple purpose (quickly clear an effect chain). |
Well we need to distinguish between whats easy to implement (hack in) and whats easy to maintain. I think that introducing a notion of read-only presets would be easier to reason about later. IMO what I proposed is decent tradeoff between both. We should also document that niche (0 = No preset) in the manual. |
Also, should we make the |
Probably, even though I don't see the benefit of read-only chains. Did you think of protecting built-in chains from deletion?
Sure. Though in this exact case I'm fear the more elaborate 'read-only' approach is actually harder to maintain. Thus, I think for the purpose of clearing a chain the internal '---' approach works well and is easy to maintain as long as it's documented properly in the relevant places. Botton line: I'm not very interested to invest a lot of time in the effects management/backend, I still want to finish work more important to me, and since implementing the read-only attribute incl. all GUI and backend adjustments is a lot of work, someone else would have to take care of it. (if there actually is someone caring about this ; ) |
First of, don't get me wrong, IMO the current approach lgtm IMO if you address the review comment above. Second, I just wanted to express my concerns about shoehorning features into a system retroactively, making the system unmaintainable. As said previously, this PR seems mostly fine to me. I just wanted to voice my thoughts on a possibly more coherent solution (though it doesn't make much more sense either the more I think about it). |
Thanks, I appreciate and acknowledge your concerns, maybe it's just that I had to express (for myself?) that this is not just another hack (like those I propose every now & then ; ) but that I seriously considered the alternative. I'll check how std::optional works here, rebase to fix the conflicts and add some comments. |
Should "---" be considered when toggling through the presets? I think yes.
an of by one problem anyway. How about solving both by treating 0 as "---"? |
Yes, also I think Also, reloading quick effect chains after start does not yet work (even though it was working at some intermediate state). So I'll revert to 'draft' until that works. |
🙄 it is already. here and here Though there will be issues due to the fact that chains are stored differently in |
d04b428
to
ca11efa
Compare
Alright, this is now working beatifully:tm:
Testing:
|
Oh, commit Nevertheless, all other aspects may be tested. |
... and revert to Draft to fix the CI errors (missing includes I guess) |
ca11efa
to
2a64eb5
Compare
Note that I added Fx chain preset selectors and chain name labels to LateNight for testing. TODO |
2a64eb5
to
9e629c1
Compare
Done, ready for review. |
Well, we could make Note: I would not change the behaviour of |
ping* |
fyi I did spend an hour to review this but got frustrated when I tried to find a way to eliminate |
I appreciate your effort. Guess how long it took me to figure out all effect chain signals, preset loading etc. There needs to be more documentation in many places to avoid days of reverse-engineering. However, I can take another look how to avoid |
What exactly? I still rememeber the context and reason for every change : ) so I can sure help. I'll add/tweak some more inline comments. |
I added |
Thanks, that's slightly better but still not ideal. The primary concern is that the baseclass needs to know about a child class. Not only does this essentially create a circular reference, it also introduces tricky dependencies. The ideal solution would be to re-implement the quickeffectchain-specific behavior by overwriting
I forgot unfortunately. I'll take another stab at reviewing this PR when I find the time. |
going through all the code, it really makes me rethink whether we shouldn't introduce a pseudo-chain for the |
With 79aee27 it's only EffectsManager that deals with "is it a QuickEffect chain or not". I don't quite understand where there is a circular depency now. I considered the Ideal Solution:tm:, too, but that's just too much code duplication + relevant info scattered = more maintenance burden. Thus I didn't choose it.
Please point me to the places you're worried about. As I explained above #4892 (comment), I will not go the pseudo-chain route because I think that will require more new code and exceptions to have a consistent GUI/UX and chain state handling (e.g WEffectChainPresetButton, readEffectsXml / saveEffectsXml). |
This was bugging me, so I tried to ignore my previous assumptions and made another naive attempt. |
---
in effect chain preset selectors and in EQ preferences (Quick Effects) clears the respective effect chain---
which will also be stored in effects.xml to keep the empty chain on next startPrimary purpose is to clear the Quick Effect chain (which I don't use) to get a clean GUI and have one aspect less I need to check when deck output is... unexpected / silent.
https://bugs.launchpad.net/mixxx/+bug/1980755
Instead of a built-in empty chain preset, this approach uses the already present
---
items in DlgPrefEQ and adjusts the effect chain manager to handle it appropriately, i.e. all widgets (skin & preferences) as well as effect slots andloaded_chain_preset
are updated. Also, the empty chain dummy item does not show up in Preferences > Effects, and thus doesn't need to be taken care of anywhere else.@Be-ing Do you mind taking a look?
TODO