Skip to content

Fix braille articulation doubling#33862

Open
fcnjd wants to merge 14 commits into
musescore:mainfrom
fcnjd:fix/braille-articulation-doubling
Open

Fix braille articulation doubling#33862
fcnjd wants to merge 14 commits into
musescore:mainfrom
fcnjd:fix/braille-articulation-doubling

Conversation

@fcnjd

@fcnjd fcnjd commented Jun 18, 2026

Copy link
Copy Markdown

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.

  • I signed the CLA as username:
  • The title of the PR describes the problem it addresses.
  • Each commit's message describes its purpose and effects, and references the issue it resolves. If changes are extensive, there is a sequence of easily reviewable commits.
  • The code in the PR follows the coding rules.
  • I understand all aspects of the code I'm contributing and I'm able to explain it if requested.
  • The code compiles and runs on my machine, preferably after each commit individually. I have manually tested and verified that my changes fulfil their intended purpose.
  • No prior attempts to resolve this problem exist, or if they do, I listed them in my PR description and described how I avoided repeating past mistakes.
  • There are no unnecessary changes.
  • I created a unit test or vtest to verify the changes I made (if applicable).

@fcnjd fcnjd mentioned this pull request Jun 18, 2026
4 tasks
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bab944ae-f538-4e93-9fe2-0f2fbe036f34

📥 Commits

Reviewing files that changed from the base of the PR and between 847f7fd and 2863428.

📒 Files selected for processing (2)
  • src/braille/internal/braille.cpp
  • src/braille/internal/braille.h

📝 Walkthrough

Walkthrough

This 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 .mscx/.brf fixtures are included.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also adds interval-doubling behavior, which is not requested by #27829 and appears to go beyond the linked issue scope. Remove the interval-doubling changes from this PR or document them as in-scope, and keep the change focused on articulation doubling plus its related settings and tests.
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: fixing braille articulation doubling.
Description check ✅ Passed The description includes the issue reference, a summary of the fix, and the required checklist items are completed.
Linked Issues check ✅ Passed The changes implement braille articulation doubling, add the toggle, and include a regression test, matching #27829.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped musescore/muse_framework.git.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/braille/tests/braille_tests.cpp (1)

236-239: ⚡ Quick win

Add 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 lift

Avoid rescanning the whole score on each live Braille refresh.

computeArticulationDoubling() is a full-score pass, and the lazy call in brailleChord() runs once per Braille instance. In live rendering paths that construct Braille repeatedly, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 683e084 and 1a6a1ca.

📒 Files selected for processing (13)
  • src/braille/ibrailleconfiguration.h
  • src/braille/internal/braille.cpp
  • src/braille/internal/braille.h
  • src/braille/internal/brailleconfiguration.cpp
  • src/braille/internal/brailleconfiguration.h
  • src/braille/internal/notationbraille.cpp
  • src/braille/tests/braille_tests.cpp
  • src/braille/tests/data/testArticulationDoubling_1.12_MBC2015.mscx
  • src/braille/tests/data/testArticulationDoubling_1.12_MBC2015_ref.brf
  • src/preferences/qml/MuseScore/Preferences/BraillePreferencesPage.qml
  • src/preferences/qml/MuseScore/Preferences/braillepreferencesmodel.cpp
  • src/preferences/qml/MuseScore/Preferences/braillepreferencesmodel.h
  • src/preferences/qml/MuseScore/Preferences/internal/BrailleAdvancedSection.qml

Comment thread src/braille/internal/braille.cpp Outdated
@mathesoncalum mathesoncalum requested a review from shoogle June 22, 2026 08:15
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.

No Doubling in Braille panel

5 participants