Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GH#718: Don't cut time from main chord when grace note is set not to play #719

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions libmscore/rendermidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2065,9 +2065,24 @@ static QList<NoteEventList> renderChord(Chord* chord, int gateTime, int ontime,

void Score::createGraceNotesPlayEvents(const Fraction& tick, Chord* chord, int& ontime, int& trailtime)
{
QVector<Chord*> gnb = chord->graceNotesBefore();
QVector<Chord*> 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<Chord*> 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
Expand Down
34 changes: 17 additions & 17 deletions mtest/libmscore/midi/testBeforeAfterGraceTrillPlay=false-ref.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down