-
-
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
PlayerManager: Identify players by ChannelHandle #2969
Conversation
src/mixer/basetrackplayer.cpp
Outdated
bool defaultMaster, | ||
bool defaultHeadphones, | ||
bool primaryDeck) | ||
: BaseTrackPlayer(pParent, group), | ||
: BaseTrackPlayer(pParent, handle_group.name()), |
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.
Could you make BaseTrackPlayer also store the ChannelHandleAndGroup?
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 could, but this would require many more changes, and I don't want to go too deeply into this for now.
QString group = groupForDeck(m_decks.count()); | ||
VERIFY_OR_DEBUG_ASSERT(!m_players.contains(group)) { | ||
ChannelHandleAndGroup handle_group = | ||
m_pEngine->registerChannelGroup(groupForDeck(m_decks.count())); |
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 feels hacky. It seems EngineMaster::registerChannelGroup is public only for the tests. I think using friend class
would be better for that. For here, let's pass the ChannelHandleFactory to PlayerManager.
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.
Actually, it is used in a few more places. As I said below, it is not really "register"ing anything, so maybe it would be enough to rename it?
Thanks for working on this. I think we should build upon this going forward to remove the hacky uses of QStrings to identify things throughout Mixxx. |
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!
inline bool operator>(const ChannelHandle& h1, const ChannelHandle& h2) { | ||
return h1.handle() > h2.handle(); | ||
} | ||
|
||
inline bool operator<(const ChannelHandle& h1, const ChannelHandle& h2) { | ||
return h1.handle() < h2.handle(); | ||
} | ||
|
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.
Are these really needed?
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, for using them as Key in a Map
src/engine/enginemaster.h
Outdated
@@ -66,7 +66,7 @@ class EngineMaster : public QObject, public AudioSource { | |||
// be called by SoundManager. | |||
const CSAMPLE* buffer(AudioOutput output) const; | |||
|
|||
ChannelHandleAndGroup registerChannelGroup(const QString& group) { | |||
ChannelHandleAndGroup registerChannelGroup(const QString& group) const { |
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.
Should this really be const
if it modifies a member object?
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.
It doesn't modify anything?
I also thought about renaming this method, it basically just does a conversion, it is more of a getter rather than something that "registers" anything-
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, it does kinda modify as it might create a handle, though it is questionable how much that matters since the function is still idempotent as seen from outside the ChannelHandleFactory. Removed const
for now.
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.
Thank you for this useful PR.
9a29696
to
1bbbd48
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.
I'm getting a DEBUG_ASSERT when starting Mixxx:
DEBUG ASSERT: "!m_players.contains(handleGroup.handle())" in function void PlayerManager::addSamplerInner() at /home/jan/Projects/mixxx/src/mixer/playermanager.cpp:440
Aborted (core dumped)
Oh, dumb mistake ^^ thanks for catching it :) |
Fixed it, but I think we should have a test for that as well... |
You didn't push though :D |
1bbbd48
to
a1722e8
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, thank you! Waiting for CI.
No description provided.