Problem adapting Note Names plugin for Musescore4

• Feb 5, 2023 - 11:22

Hi,

I hope this is the correct place for this query.

I have altered the code for note_names.qml to show pitch numbers rather than pitch names. The relevant piece of code is below. This works perfectly when I enable the plug in and the new labels are shown EXCEPT for G flat. For reasons unknown G flat is still labeled as G flat in the score, everything else is correct. This is independent of octave, note type etc. F sharp is labeled correctly as "6". I would appreciate any insight into what is going on. Relevant screenshot is attached.

Thanks

case -1: name = mscoreMajorVersion >= 4 ? qsTr("F♭♭") : qsTranslate("InspectorAmbitus", "3"); break;
case 0: name = mscoreMajorVersion >= 4 ? qsTr("C♭♭") : qsTranslate("InspectorAmbitus", "10"); break;
case 1: name = mscoreMajorVersion >= 4 ? qsTr("G♭♭") : qsTranslate("InspectorAmbitus", "5"); break;
case 2: name = mscoreMajorVersion >= 4 ? qsTr("D♭♭") : qsTranslate("InspectorAmbitus", "0"); break;
case 3: name = mscoreMajorVersion >= 4 ? qsTr("A♭♭") : qsTranslate("InspectorAmbitus", "7"); break;
case 4: name = mscoreMajorVersion >= 4 ? qsTr("E♭♭") : qsTranslate("InspectorAmbitus", "2"); break;
case 5: name = mscoreMajorVersion >= 4 ? qsTr("B♭♭") : qsTranslate("InspectorAmbitus", "9"); break;

        case  6: name = mscoreMajorVersion >= 4 ? qsTr("F♭") : qsTranslate("InspectorAmbitus", "4"); break;
        case  7: name = mscoreMajorVersion >= 4 ? qsTr("C♭") : qsTranslate("InspectorAmbitus", "e"); break;
        case  8: name = mscoreMajorVersion >= 4 ? qsTr("G♭") : qsTranslate("InspectorAmbitus", "6"); break;

        case  9: name = qsTranslate(mscoreMajorVersion >= 4 ? "engraving/instruments:db-piccolo traitName" : "InspectorAmbitus", "1"); break;

        case 10: name = qsTranslate(mscoreMajorVersion >= 4 ? "EditPitchBase" : "InspectorAmbitus", "8"); break;
        case 11: name = qsTranslate(mscoreMajorVersion >= 4 ? "EditPitchBase" : "InspectorAmbitus", "3"); break;
        case 12: name = qsTranslate(mscoreMajorVersion >= 4 ? "EditPitchBase" : "InspectorAmbitus", "t"); break;

        case 13: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "5"); break;
        case 14: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "0"); break;
        case 15: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "7"); break;
        case 16: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "2"); break;
        case 17: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "9"); break;
        case 18: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "4"); break;
        case 19: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "e"); break;

        case 20: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "6"); break;
        case 21: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "1"); break;
        case 22: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "8"); break;
        case 23: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "3"); break;
        case 24: name = qsTranslate(mscoreMajorVersion >= 4 ? "global" : "InspectorAmbitus", "t"); break;
        case 25: name = mscoreMajorVersion >= 4 ? qsTr("E♯") : qsTranslate("InspectorAmbitus", "5"); break;
        case 26: name = mscoreMajorVersion >= 4 ? qsTr("B♯") : qsTranslate("InspectorAmbitus", "0"); break;

        case 27: name = mscoreMajorVersion >= 4 ? qsTr("F♯♯") : qsTranslate("InspectorAmbitus", "7"); break;
        case 28: name = mscoreMajorVersion >= 4 ? qsTr("C♯♯") : qsTranslate("InspectorAmbitus", "2"); break;
        case 29: name = mscoreMajorVersion >= 4 ? qsTr("G♯♯") : qsTranslate("InspectorAmbitus", "9"); break;
        case 30: name = mscoreMajorVersion >= 4 ? qsTr("D♯♯") : qsTranslate("InspectorAmbitus", "4"); break;
        case 31: name = mscoreMajorVersion >= 4 ? qsTr("A♯♯") : qsTranslate("InspectorAmbitus", "e"); break;
        case 32: name = mscoreMajorVersion >= 4 ? qsTr("E♯♯") : qsTranslate("InspectorAmbitus", "6"); break;
        case 33: name = mscoreMajorVersion >= 4 ? qsTr("B♯♯") : qsTranslate("InspectorAmbitus", "1"); break;
        default: name = qsTr("?")   + text.text; break;
     } // end switch tpc
Attachment Size
Screenshot 2023-02-05 at 11.20.42.png 75.55 KB

Comments

You don't need any of the qstr() or qsTranslate() stuff, just

        case -1: name ="3"; break;
        case 0: name = "10"; break;
        case 1: name = "5"; break;
        case 2: name = "0"; break;
        case 3: name = "7"; break;
        case 4: name = "2"; break;
        case 5: name = "9"; break;
        case  6: name = "4"; break;
        case  7: name = "e"; break; //?
        case  8: name = "6"; break;
        case  9: name = "1"; break;
....
     } // end switch tpc

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