Skip to content

Commit

Permalink
Merged together two if statements in the tune notes section
Browse files Browse the repository at this point in the history
  • Loading branch information
looptailG committed Oct 12, 2024
1 parent 09fbdf5 commit 90be7c4
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions source/31EdoTuner.qml
Original file line number Diff line number Diff line change
Expand Up @@ -341,42 +341,39 @@ MuseScore
}

// Tune notes.
if (cursor.element)
if (cursor.element && (cursor.element.type == Element.CHORD))
{
if (cursor.element.type == Element.CHORD)
// Iterate through every grace chord.
var graceChords = cursor.element.graceNotes;
for (var i = 0; i < graceChords.length; i++)
{
// Iterate through every grace chord.
var graceChords = cursor.element.graceNotes;
for (var i = 0; i < graceChords.length; i++)
{
var notes = graceChords[i].notes;
for (var j = 0; j < notes.length; j++)
{
try
{
notes[j].tuning = calculateTuningOffset(notes[j]);
}
catch (error)
{
logMessage(error, true);
}
}
}

// Iterate through every chord note.
var notes = cursor.element.notes;
for (var i = 0; i < notes.length; i++)
var notes = graceChords[i].notes;
for (var j = 0; j < notes.length; j++)
{
try
{
notes[i].tuning = calculateTuningOffset(notes[i]);
notes[j].tuning = calculateTuningOffset(notes[j]);
}
catch (error)
{
logMessage(error, true);
}
}
}

// Iterate through every chord note.
var notes = cursor.element.notes;
for (var i = 0; i < notes.length; i++)
{
try
{
notes[i].tuning = calculateTuningOffset(notes[i]);
}
catch (error)
{
logMessage(error, true);
}
}
}

cursor.next();
Expand Down

0 comments on commit 90be7c4

Please sign in to comment.