PluginAPI: cursor.addNote(<note>, true) fails to add a note

• May 6, 2020 - 18:42
Reported version
3.x-dev
Type
Plugins
Frequency
Once
Severity
S3 - Major
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project

Found in the 3.5 Alpha release.
OS: macOS 10.14, Arch.: x86_64, MuseScore version (64-bit): 3.5.0.26969, revision: 1ee2fe3

Steps
1. create a new empty score
2. Run the attached plugin "addNoteTest", which contains the following code:
    var cursor = curScore.newCursor();
    cursor.track = 0;
    cursor.rewind(Cursor.SCORE_START);
    cursor.setDuration(1, 4);
    cursor.addNote(60, false);
    cursor.addNote(64, true);
    cursor.addNote(67, true);
    cursor.addNote(72, true);

Actual Result: only a single note appears in the score, and the console has several error messages...

Screen Shot 2020-05-06 at 10.36.49.png

Screen Shot 2020-05-06 at 10.37.10.png

Expected Result: a 4-note chord (C major) appears in the score, no messages in console...

Screen Shot 2020-05-06 at 10.34.38.png

This is a new problem in the 3.5 Alpha release. It works OK in 3.4.2. I marked the bug as "Major" because I assume it will completely break any plugin that uses cursor.addNote(xxx, true).


Comments

Status PR created fixed

Fixed in branch 3.x, commit 7613efe73e

_fix #305017: Cursor.addNote fails to add notes to existing chords in INPUT_STATE_INDEPENDENT mode

The issue appeared after bd979cf23bd6478330990ed103df3fa85bd89c21 which
attempted to decouple the logic behind Cursor.addNote() from InputState
in Score::is to make it possible to choose whether Cursor should
be synchronized with score input state. However Score::addNote implicitly
contained more dependencies on Score::_is which were not covered by
the previous change. This commit is intended to remove this dependency
and fix behavior of "independent" mode of Cursor in QML plugins.

Fixed in branch 3.x, commit 87c059e72c

_Merge pull request #6058 from dmitrio95/305017-plugin-cursor-addnote-regression

fix #305017: Cursor.addNote fails to add notes to existing chords in INPUT_STATE_INDEPENDENT mode_

Fixed in branch master, commit 5d7f50060e

_Merge pull request #6058 from dmitrio95/305017-plugin-cursor-addnote-regression

fix #305017: Cursor.addNote fails to add notes to existing chords in INPUT_STATE_INDEPENDENT mode_

Fix version
3.5.0