diff --git a/libmscore/rendermidi.cpp b/libmscore/rendermidi.cpp index afeafd7d17812..c88ebbd604145 100644 --- a/libmscore/rendermidi.cpp +++ b/libmscore/rendermidi.cpp @@ -2065,9 +2065,24 @@ static QList renderChord(Chord* chord, int gateTime, int ontime, void Score::createGraceNotesPlayEvents(const Fraction& tick, Chord* chord, int& ontime, int& trailtime) { - QVector gnb = chord->graceNotesBefore(); + QVector gnb = {}; + int nb = 0; + // exclude grace chords where all notes are set not to play + for (Chord* c : chord->graceNotesBefore()) { + bool play = false; + for (Note* note : c->notes()) { + if (note->play()) { + play = true;; + break; + } + } + if (play) { + gnb.push_back(c); + nb++; + } + } + QVector gna = chord->graceNotesAfter(); - int nb = gnb.size(); int na = gna.size(); if (0 == nb + na) { return; // return immediately if no grace notes to deal with diff --git a/mtest/libmscore/midi/testBeforeAfterGraceTrillPlay=false-ref.txt b/mtest/libmscore/midi/testBeforeAfterGraceTrillPlay=false-ref.txt index c3207bd31b641..939230cf3c084 100644 --- a/mtest/libmscore/midi/testBeforeAfterGraceTrillPlay=false-ref.txt +++ b/mtest/libmscore/midi/testBeforeAfterGraceTrillPlay=false-ref.txt @@ -1,11 +1,11 @@ Tick = 0 Type = 144 Pitch = 81 Velocity = 80 Channel = 0 Tick = 0 Type = 3 Pitch = 0 Velocity = 127 Channel = 0 Tick = 60 Type = 144 Pitch = 81 Velocity = 0 Channel = 0 -Tick = 184 Type = 144 Pitch = 76 Velocity = 80 Channel = 0 -Tick = 244 Type = 144 Pitch = 76 Velocity = 0 Channel = 0 -Tick = 245 Type = 144 Pitch = 74 Velocity = 80 Channel = 0 -Tick = 305 Type = 144 Pitch = 74 Velocity = 0 Channel = 0 -Tick = 311 Type = 144 Pitch = 72 Velocity = 80 Channel = 0 +Tick = 61 Type = 144 Pitch = 76 Velocity = 80 Channel = 0 +Tick = 121 Type = 144 Pitch = 76 Velocity = 0 Channel = 0 +Tick = 122 Type = 144 Pitch = 74 Velocity = 80 Channel = 0 +Tick = 182 Type = 144 Pitch = 74 Velocity = 0 Channel = 0 +Tick = 186 Type = 144 Pitch = 72 Velocity = 80 Channel = 0 Tick = 480 Type = 4 Pitch = 0 Velocity = 80 Channel = 0 Tick = 958 Type = 144 Pitch = 72 Velocity = 0 Channel = 0 Tick = 960 Type = 4 Pitch = 0 Velocity = 127 Channel = 0 @@ -17,13 +17,13 @@ Tick = 1914 Type = 144 Pitch = 72 Velocity = 0 Channel = Tick = 1920 Type = 144 Pitch = 81 Velocity = 80 Channel = 0 Tick = 1920 Type = 3 Pitch = 0 Velocity = 127 Channel = 0 Tick = 1980 Type = 144 Pitch = 81 Velocity = 0 Channel = 0 -Tick = 2042 Type = 144 Pitch = 77 Velocity = 80 Channel = 0 -Tick = 2102 Type = 144 Pitch = 77 Velocity = 0 Channel = 0 -Tick = 2104 Type = 144 Pitch = 76 Velocity = 80 Channel = 0 -Tick = 2164 Type = 144 Pitch = 76 Velocity = 0 Channel = 0 -Tick = 2165 Type = 144 Pitch = 74 Velocity = 80 Channel = 0 -Tick = 2225 Type = 144 Pitch = 74 Velocity = 0 Channel = 0 -Tick = 2231 Type = 144 Pitch = 72 Velocity = 80 Channel = 0 +Tick = 1981 Type = 144 Pitch = 77 Velocity = 80 Channel = 0 +Tick = 2041 Type = 144 Pitch = 77 Velocity = 0 Channel = 0 +Tick = 2042 Type = 144 Pitch = 76 Velocity = 80 Channel = 0 +Tick = 2102 Type = 144 Pitch = 76 Velocity = 0 Channel = 0 +Tick = 2104 Type = 144 Pitch = 74 Velocity = 80 Channel = 0 +Tick = 2164 Type = 144 Pitch = 74 Velocity = 0 Channel = 0 +Tick = 2169 Type = 144 Pitch = 72 Velocity = 80 Channel = 0 Tick = 2400 Type = 4 Pitch = 0 Velocity = 80 Channel = 0 Tick = 2878 Type = 144 Pitch = 72 Velocity = 0 Channel = 0 Tick = 2880 Type = 4 Pitch = 0 Velocity = 127 Channel = 0 @@ -159,11 +159,11 @@ Tick = 7672 Type = 144 Pitch = 72 Velocity = 0 Channel = Tick = 7680 Type = 144 Pitch = 81 Velocity = 80 Channel = 0 Tick = 7680 Type = 3 Pitch = 0 Velocity = 127 Channel = 0 Tick = 7740 Type = 144 Pitch = 81 Velocity = 0 Channel = 0 -Tick = 7864 Type = 144 Pitch = 76 Velocity = 80 Channel = 0 -Tick = 7924 Type = 144 Pitch = 76 Velocity = 0 Channel = 0 -Tick = 7925 Type = 144 Pitch = 74 Velocity = 80 Channel = 0 -Tick = 7985 Type = 144 Pitch = 74 Velocity = 0 Channel = 0 -Tick = 7991 Type = 144 Pitch = 72 Velocity = 80 Channel = 0 +Tick = 7741 Type = 144 Pitch = 76 Velocity = 80 Channel = 0 +Tick = 7801 Type = 144 Pitch = 76 Velocity = 0 Channel = 0 +Tick = 7802 Type = 144 Pitch = 74 Velocity = 80 Channel = 0 +Tick = 7862 Type = 144 Pitch = 74 Velocity = 0 Channel = 0 +Tick = 7866 Type = 144 Pitch = 72 Velocity = 80 Channel = 0 Tick = 8160 Type = 4 Pitch = 0 Velocity = 80 Channel = 0 Tick = 8638 Type = 144 Pitch = 72 Velocity = 0 Channel = 0 Tick = 8640 Type = 4 Pitch = 0 Velocity = 127 Channel = 0