Fix braille articulation doubling#33862
Conversation
* Enable the module in the UTESTS configuration * Fix a type (although the test passes with and without this typo)
…fixes Fix running Converter tests on CI
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds articulation-doubling support for Music Braille Code 2015. It introduces a new braille configuration setting with notification, wires the setting through the braille preferences model and QML UI, and re-renders braille when the setting changes. The braille renderer adds precomputation and rendering logic for doubled, omitted, and closing suffix signs. A regression test and matching 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsLinked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/braille/tests/braille_tests.cpp (1)
236-239: ⚡ Quick winAdd one fixture for “ignore rests” and Above/Below variant continuity.
This test secures contiguous-run behavior, but it does not explicitly lock the rule where rests are ignored (and common Above/Below variant switches). A focused additional fixture would make regressions in those cases much harder.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/braille/tests/braille_tests.cpp` around lines 236 - 239, Add a new test method within the Braille_Tests fixture to explicitly test the behavior where rests are ignored during contiguous runs and to verify Above/Below variant continuity is maintained. Create an additional test function (similar in structure to the existing articulations test) that calls brailleSaveTest with test data files that specifically exercise the rest-ignoring logic and variant switching scenarios to prevent regressions in those specific behaviors.src/braille/internal/braille.cpp (1)
985-1030: 🏗️ Heavy liftAvoid rescanning the whole score on each live Braille refresh.
computeArticulationDoubling()is a full-score pass, and the lazy call inbrailleChord()runs once perBrailleinstance. In live rendering paths that constructBraillerepeatedly, this can become a noticeable hot path on large scores. Consider caching decisions by score revision or precomputing once per score-change event.Also applies to: 1900-1902
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/braille/internal/braille.cpp` around lines 985 - 1030, The computeArticulationDoubling() function performs a full-score pass that gets recomputed on every Braille instance creation in live rendering scenarios, creating unnecessary overhead. Cache the articulation doubling results at the score level rather than recomputing them for each Braille instance, and invalidate the cache only when the score changes. This can be done by tracking the score's revision number or hooking into score-change events, ensuring the expensive full-score iteration only runs once per score modification instead of repeatedly during live refresh operations.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/braille/internal/braille.cpp`:
- Around line 988-1023: The openRuns map is currently keyed by raw SymId, but
multiple articulation variants (above/below) can render to the same braille
sign. When stem direction changes, it flips between variants with different
SymIds, breaking runs incorrectly. Replace all uses of artic->symId() as map
keys with a normalized braille sign identifier: apply a normalization function
to convert the raw SymId to its rendered braille sign representation before
using it in openRuns (at the point where you insert into present, when you check
present.find(), and when you add to openRuns at the end of the loop). This
ensures runs are grouped by actual rendered braille sign, not raw SymId
variants.
---
Nitpick comments:
In `@src/braille/internal/braille.cpp`:
- Around line 985-1030: The computeArticulationDoubling() function performs a
full-score pass that gets recomputed on every Braille instance creation in live
rendering scenarios, creating unnecessary overhead. Cache the articulation
doubling results at the score level rather than recomputing them for each
Braille instance, and invalidate the cache only when the score changes. This can
be done by tracking the score's revision number or hooking into score-change
events, ensuring the expensive full-score iteration only runs once per score
modification instead of repeatedly during live refresh operations.
In `@src/braille/tests/braille_tests.cpp`:
- Around line 236-239: Add a new test method within the Braille_Tests fixture to
explicitly test the behavior where rests are ignored during contiguous runs and
to verify Above/Below variant continuity is maintained. Create an additional
test function (similar in structure to the existing articulations test) that
calls brailleSaveTest with test data files that specifically exercise the
rest-ignoring logic and variant switching scenarios to prevent regressions in
those specific behaviors.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 51705ff1-81c1-4e3f-a259-b922de266a04
📒 Files selected for processing (13)
src/braille/ibrailleconfiguration.hsrc/braille/internal/braille.cppsrc/braille/internal/braille.hsrc/braille/internal/brailleconfiguration.cppsrc/braille/internal/brailleconfiguration.hsrc/braille/internal/notationbraille.cppsrc/braille/tests/braille_tests.cppsrc/braille/tests/data/testArticulationDoubling_1.12_MBC2015.mscxsrc/braille/tests/data/testArticulationDoubling_1.12_MBC2015_ref.brfsrc/preferences/qml/MuseScore/Preferences/BraillePreferencesPage.qmlsrc/preferences/qml/MuseScore/Preferences/braillepreferencesmodel.cppsrc/preferences/qml/MuseScore/Preferences/braillepreferencesmodel.hsrc/preferences/qml/MuseScore/Preferences/internal/BrailleAdvancedSection.qml
Resolves: #27829
As the issue describes, the MBC rule defines that if more than three notes in a row share the same articulation, before the group the sign is to be placed twice, and at the end of the group one more time. I added a setting which toggles this and is on by default.