-
-
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
Samplers: dont create extra empty players during startup #12657
Samplers: dont create extra empty players during startup #12657
Conversation
if (samplerNodes.isEmpty()) { | ||
return true; | ||
} | ||
for (int i = 0; i < samplerNodes.size(); i++) { |
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 refactored this to avoid n = n.nextSibling();
before each continue
.
Unfortunately there is no iterator for QDomNodeList
.
src/mixer/samplerbank.cpp
Outdated
// We also create new players even if they are not present in the | ||
// GUI to not drop tracks loaded to invisible samplers when saving | ||
// the samplers file. | ||
if (m_pPlayerManager->numSamplers() < (unsigned)samplerNum) { |
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 way around should be more safe since samplerNum might be read from a corrupt file.
if (m_pPlayerManager->numSamplers() < (unsigned)samplerNum) { | |
if (static_cast<int>(m_pPlayerManager->numSamplers()) < samplerNum) { |
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.
Here is by the way also suspicious casting:
mixxx/src/mixer/playermanager.cpp
Line 278 in a7af572
return pCOPNumSamplers ? static_cast<int>(pCOPNumSamplers->get()) : 0; |
Maybe we should just use int everywhere?
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.
You mean instead of unsigned int
?
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.
Yes.
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, I'll take a look and open another PR.
Works for me on Windows11! |
a578814
to
5d299ef
Compare
87c8342
to
186f166
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.
Works already good. Hers some comments
186f166
to
5a5d206
Compare
Now the menu is also updated if samplers or decks are added (skin change for example). |
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, Thank you.
Fixes #9115
If
samplers.xml
has more empty(!) elements than sampler players have been created by request of either skins or controller mappings,SamplerBank
would trigger creation of all these unneeded samplers.This happened after having shutdown with a 64-samplers skin, and starting with a skin with less samplers, even though none of the additional samplers has a track loaded.
Additionally, I improved the track menu and the control picker menu (MIDI Learning Wizard):
in the "Load To" submenu samplers are now grouped into submenus with 16 samplers each.