-
Notifications
You must be signed in to change notification settings - Fork 3k
Tapping implementation #28245
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
Tapping implementation #28245
Conversation
3b3f078 to
9f68000
Compare
bkunda
left a comment
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.
Aside from the open discussion happening internally about the design, there are a couple of trivial issues that'd be good to iron out at this stage:
- Palette icon colours not correct in dark mode
tapping-palettes_colour.mov
- Half slurs not selected when added
tapping_not-selected-palette.mov
2b92bbf to
a84b31f
Compare
ee2df56 to
f0e727c
Compare
miiizen
left a comment
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.
Great job, I've only spotted a few small changes
| tappings.push_back(toTapping(a)); | ||
| } | ||
| } | ||
| DO_ASSERT(tappings.size() <= 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.
It feels odd to me to enforce/check this when getting tappings - it might make more sense to do this check when adding to a chord?
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.
Yeah you're right, but it feels even weirder to count them when inserting, cause it means adding an extra for loop that does nothing (whereas here the loop would be needed anyway to find the Tapping, so the assertion check can be done for free)
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.
Good point!
src/engraving/dom/tapping.h
Outdated
| TappingText(const TappingText& t); | ||
| TappingText* clone() const override { return new TappingText(*this); } | ||
|
|
||
| virtual Color curColor() 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.
override rather than virtual
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.
oopsie, thanks
| case ElementType::GLISSANDO: return new Glissando(parent); | ||
| case ElementType::BRACKET: return new Bracket(parent); | ||
| case ElementType::ARTICULATION: return new Articulation(parent->isChordRest() ? toChordRest(parent) : dummy->chord()); | ||
| case ElementType::TAPPING: return new Tapping(parent->isChordRest() ? toChordRest(parent) : dummy->chord()); |
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.
We're missing the following cases in this switch: HAMMER_ON_PULL_OFF_SEGMENT, HAMMER_ON_PULL_OFF_TEXT, TAPPING_HALF_SLUR, TAPPING_HALF_SLUR_SEGMENT, TAPPING_TEXT
| const double slurCollisionHorizOffset = 0.2 * spatium; | ||
| const double fuzzyHorizCompare = 0.25 * spatium; | ||
| auto compare = [fuzzyHorizCompare](double x1, double x2) { return std::abs(x1 - x2) < fuzzyHorizCompare; }; | ||
| for (SpannerSegment* seg1 : segments) { |
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.
| for (SpannerSegment* seg1 : segments) { | |
| for (SlurSegment* seg1 : segments) { |
Every segment should be a slur segment here - you can remove checks & conversions below
| mask.setWidth(0.5 * mask.width()); | ||
| const double maskPad = 0.25 * item->spatium(); | ||
| mask.adjust(-maskPad, -maskPad, 0.0, maskPad); | ||
| slurSeg->mutldata()->setMask(mask); |
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 like this!
Tapping implementation