order of Sagittal accidentals in accidental.cpp and types.h

• Feb 12, 2021 - 23:19

I'm trying to adapt a microtonal tuning plugin to work with Sagittal accidentals, but it seems that the plugin doesn't recognize some Sagittal accidentals, while there are also some that it does recognize and while it works fine with all other accidentals. One thing I noticed when trying to figure out why it doesn't work is that the order of the Sagittal accidentals in accidental.cpp (where they are listed by their SymIds) is different from that in types.h (where they are listed by their capitalized element names). (Those capitalized element names like "SAGITTAL_SHARP" are used in the plugin, by the way.) I was wondering whether this might be the reason why they are not recognized.

The image below shows the Sagittal accidentals in SMUFL order. (They occur in that order in the accidentals palette.) Peculiarly, the orders in both accidental.cpp and types.h deviate from this order (and in different ways).

Sagittal accidental names table.png


Comments

Yes, the order in types.h is wrong, accidental.cpp and types.h need to be in sync (the order in SMuFL or sym.{h.cpp} is not relevant here though), needs to get fixed to:

diff --git a/libmscore/types.h b/libmscore/types.h
index 62276cdd6..adb8f32e1 100644
--- a/libmscore/types.h
+++ b/libmscore/types.h
@@ -307,10 +307,10 @@ enum class AccidentalType : unsigned char {
       SAGITTAL_SHARP25SD,
       SAGITTAL_FLAT7CU,
       SAGITTAL_SHARP7CD,
-      SAGITTAL_SHARP5CD,
-      SAGITTAL_SHARP5V7KD,
       SAGITTAL_FLAT5CU,
+      SAGITTAL_SHARP5CD,
       SAGITTAL_FLAT5V7KU,
+      SAGITTAL_SHARP5V7KD,
       SAGITTAL_FLAT,
       SAGITTAL_SHARP,

See https://github.com/musescore/MuseScore/pull/7520
You can grab and try the artifacts build from that PR

In reply to by Jojo-Schmitz

I'm not sure how to share it, but its a plugin made by someone else. I'm just making some slight changes to ti and I'm not sure whether the original creator would object to me sharing it.
What it does, is scan a score for microtonal accidentals (that are defined in the plugin) and the retune those notes accordingly. It works perfectly with any accidental (that is, I can give any accidental a retuning value withing the plugin), except the sagittal accidentals with two vertical lines. All the sagittal accidentals with one vertical line work fine, but those with two don't.

In reply to by Jojo-Schmitz

It looks to me like that fix still gets the order wrong.

The order in accidentals.cpp is:

accSagittalFlat25SUp
accSagittalSharp25SDown
accSagittalFlat7CUp
accSagittalSharp7CDown
accSagittalFlat5CUp
accSagittalSharp5CDown
accSagittalFlat5v7kUp
accSagittalSharp5v7kDown
accSagittalFlat
accSagittalSharp

The same order in types.h should then be:

SAGITTAL_FLAT25SU,
SAGITTAL_SHARP25SD,
SAGITTAL_FLAT7CU,
SAGITTAL_SHARP7CD,
SAGITTAL_FLAT5CU,
SAGITTAL_SHARP5CD,
SAGITTAL_FLAT5V7KU,
SAGITTAL_SHARP5V7KD,
SAGITTAL_FLAT,
SAGITTAL_SHARP,

And that's not the same as what I see there.

edit:
No. My mistake. It is correct.
But then, why doesn't it work?...

In reply to by Rayosu

So before the change you claimed SAGITTAL_FLAT5CU, SAGITTAL_SHARP5CD, SAGITTAL_FLAT5 (??), and SAGITTAL_SHARP to not work, and SAGITTAL_5CD (?) and SAGITTAL_5CU (?) to work, some of these don't even exist?!?
Is it still the same that do/don't?

SAGITTAL_FLAT25SU,
SAGITTAL_SHARP25SD,
SAGITTAL_FLAT7CU,
SAGITTAL_SHARP7CD,
SAGITTAL_FLAT5CU,
SAGITTAL_SHARP5CD,
SAGITTAL_FLAT5V7KU,
SAGITTAL_SHARP5V7KD,
SAGITTAL_FLAT,
SAGITTAL_SHARP,

Please share the plugin

In reply to by Rayosu

Maybe it is an issue with the width of that enum class AccidentalType : unsigned char ? It should go from 0 - 255, but maybe in the plugins it gets turned into just char, which in this case is a signed char and so goes from -128 - 127, which makes it end at SAGITTAL_SHARP25SD, so everything after that gets cut off?

Do you still have an unanswered question? Please log in first to post your question.