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

Properly Handle mismatch between Presets and EffectUnits with different amount of Effect slots #11424

Merged
merged 3 commits into from
Apr 3, 2023

Conversation

Swiftb0y
Copy link
Member

@Swiftb0y Swiftb0y commented Mar 30, 2023

Fixes #11376

However, it does not address the question whether the EQ should be implemented in terms of an EffectChain

Comment on lines 212 to 213
const std::size_t validPresetSlotCount = std::min(effectPresets.count(), m_effectSlots.count());
for (std::size_t presetSlotIndex = 0;
Copy link
Member

Choose a reason for hiding this comment

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

QT uses int for sized from Qt6 it is qsizetype which is ssize_t

Suggested change
const std::size_t validPresetSlotCount = std::min(effectPresets.count(), m_effectSlots.count());
for (std::size_t presetSlotIndex = 0;
const int validPresetSlotCount = std::min(effectPresets.count(), m_effectSlots.count());
for (int presetSlotIndex = 0;

This avoids a warning in MSVC

Copy link
Member Author

Choose a reason for hiding this comment

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

done

const QList effectPresets = pChainPreset->effectPresets();

// TODO: use C++23 std::ranges::views::zip instead
const std::size_t validPresetSlotCount = std::min(effectPresets.count(), m_effectSlots.count());
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment about why the case effectPresets.count() != m_effectSlots.count() can happen?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@Swiftb0y
Copy link
Member Author

fyi, ping me before merging so I can autosquash the fixup commit

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

Thank you. LGTM.
Yust ping me if you are satisfied with the git history.

Only load effect preset from chain presets to slots that actually
have been created. The rest gets ignored.
@Swiftb0y
Copy link
Member Author

@daschuer ready

@Swiftb0y
Copy link
Member Author

Swiftb0y commented Apr 2, 2023

@daschuer friendly ping

@daschuer
Copy link
Member

daschuer commented Apr 3, 2023

Oh, sorry this slipped through.

@daschuer daschuer merged commit c7a4bd5 into mixxxdj:2.4 Apr 3, 2023
@Swiftb0y
Copy link
Member Author

Swiftb0y commented Apr 3, 2023

No worries 👍

@Swiftb0y Swiftb0y deleted the fix/gh11376 branch April 3, 2023 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants