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

More cue hint for caching reader #4771

Merged
merged 5 commits into from
May 27, 2022
Merged

More cue hint for caching reader #4771

merged 5 commits into from
May 27, 2022

Conversation

daschuer
Copy link
Member

This adds the intro outro and sound start cues the the hints for the caching reader.
They are like the hotcues also reachable by a single button that should not cause a cache miss.

This also replaces the unused priority by a type value. That can be used for debugging and a central priority management.
It will also help to implement an decoder offset test using the sound start position.

src/engine/controls/cuecontrol.cpp Outdated Show resolved Hide resolved
@@ -70,6 +70,21 @@ inline int hotcueNumberToHotcueIndex(int hotcueNumber) {
}
}

void appendCueHint(HintVector* pHintList, const mixxx::audio::FramePos& frame, Hint::Type type) {
Copy link
Member

Choose a reason for hiding this comment

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

we should rethink our "mutable references should be pointers" rule. Taking a value that could be nullptr and assuming its not is simply bad. Especially when the consequence of that assumption is a crash.

Suggested change
void appendCueHint(HintVector* pHintList, const mixxx::audio::FramePos& frame, Hint::Type type) {
void appendCueHint(HintVector& pHintList, const mixxx::audio::FramePos& frame, Hint::Type type) {

Copy link
Contributor

Choose a reason for hiding this comment

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

This ancient rule causes lots of boilerplate extra code that might contain bugs. I have argued for years until giving up and moving on.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. It seems this "style-preference" (though IMO its much more than just a matter of style) is in the minority in the C++ community. Even ignoring the Google/Qt vs CppCoreGuidelines "controversy", the simple argument of type-safety (and the thus gained safety) suffices for a decision. The less "illegal" states your type has, the less you need to check before using it. With my Rust experience, whenever I see a pointer in C++, I'm thinking that's an intentional Option<Box<T>> so there is either something special going on with the actual presence of the contained value or its lifetime. Especially because its already trivial to express mutable "borrowing" in C++ by just using a mutable reference.

Copy link
Member

@Swiftb0y Swiftb0y May 26, 2022

Choose a reason for hiding this comment

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

The Original google styleguide says:

References can be confusing, as they have value syntax but pointer semantics.

I have never even noticed this being an issue personally. I've struggled to find any arguments on this online, so I invite everyone to come up with their own example because I can neither think of nor find one.

Copy link
Member Author

Choose a reason for hiding this comment

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

The null check is now in place.

Copy link
Member

Choose a reason for hiding this comment

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

But its not needed if one just used a mutable reference. And its not free either...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, If you assume that a reference cannot be null which is not the case. But anyway, that the Mixxx style, no need to discuss it here.

Copy link
Member

Choose a reason for hiding this comment

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

Would you mind if we continued this discussion on Zulip? It seems like the majority of mixxx devs is dissatisfied by this style and we'd like to transition away from it.

src/engine/controls/cuecontrol.cpp Outdated Show resolved Hide resolved
@daschuer
Copy link
Member Author

Done.

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

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

LGTM, waiting for CI.

src/engine/controls/cuecontrol.cpp Outdated Show resolved Hide resolved
@daschuer
Copy link
Member Author

All green now.

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

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

LGTM

@Swiftb0y Swiftb0y merged commit 9bb4c51 into mixxxdj:main May 27, 2022
@daschuer daschuer added this to the 2.4.0 milestone Jun 21, 2022
daschuer added a commit to daschuer/mixxx that referenced this pull request Jul 22, 2022
@daschuer daschuer mentioned this pull request Jul 22, 2022
@daschuer daschuer deleted the cuehint branch May 4, 2023 11:09
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.

3 participants