accidentalType boolean

• Feb 5, 2022 - 03:49

I tried to check if a note had an accidental by checking the type with: if (curScore.selection.elements[0].accidentalType=="NONE") and it does not seem to work but accidentalType==0 works. Why is that? If that's the case, shouldn't there be a list of corresponding numbers in the API: https://musescore.github.io/MuseScore_PluginAPI_Docs/plugins/html/names…


Comments

It is tricky. The enumeration name is not "AccidentalType" but "Accidental".
var sel=curScore.selection.elements;
var el=sel[0];

  console.log(el.accidentalType + " - " + Accidental.NONE + " - " + Accidental.SHARP");
  console.log((el.accidentalType == Accidental.NONE)?"NONE":"OTHER");

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