Skip to content

Commit

Permalink
Merge pull request #19 from looptailG/v1.3.1
Browse files Browse the repository at this point in the history
v1.3.1
  • Loading branch information
looptailG authored Nov 7, 2024
2 parents 3b1a4d6 + c335eab commit 3eea694
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 94 deletions.
122 changes: 41 additions & 81 deletions source/FifthGeneratedTuner.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ MuseScore
description: "Retune the selection, or the whole score if nothing is selected, using the specified fifth size.";
categoryCode: "playback";
thumbnailName: "FifthGeneratedTunerThumbnail.png";
version: "1.3.0";
version: "1.3.1";

pluginType: "dialog";
width: 470;
height: 760;
property var padding: 10;
width: guiColumn.implicitWidth + 2*padding;
height: guiColumn.implicitHeight + 2*padding;

property variant settings: {};

Expand Down Expand Up @@ -83,7 +84,7 @@ MuseScore
{
id: fifthSizeDialogText;
text: "";
width: 460;
width: guiColumn.implicitWidth;
wrapMode: Text.Wrap;
}
}
Expand All @@ -98,14 +99,12 @@ MuseScore
{
outputMessageArea.text = error;
logger.error(error.toString());
logger.writeLogMessages();
}
}

onRejected:
{
logger.log("Tuning canceled.");
logger.writeLogMessages();
}
}

Expand Down Expand Up @@ -148,7 +147,6 @@ MuseScore
{
outputMessageArea.text = error.toString();
logger.error(error.toString());
logger.writeLogMessages();
}
}
}
Expand Down Expand Up @@ -225,7 +223,6 @@ MuseScore
{
outputMessageArea.text = error.toString();
logger.error(error.toString());
logger.writeLogMessages();
}
}
}
Expand Down Expand Up @@ -255,6 +252,7 @@ MuseScore
if (logLevel >= currentLogLevel)
{
logMessages += DateUtils.getRFC3339DateTime() + logLevels[logLevel] + message + "\n";
write(logMessages);
}
}

Expand All @@ -277,14 +275,6 @@ MuseScore
{
log(message, 4);
}

function writeLogMessages()
{
if (logMessages != "")
{
write(logMessages);
}
}
}

FileIO
Expand All @@ -296,7 +286,6 @@ MuseScore
{
outputMessageArea.text = msg;
logger.error(msg);
logger.writeLogMessages();
}
}

Expand All @@ -309,19 +298,18 @@ MuseScore
{
outputMessageArea.text = msg;
logger.error(msg);
logger.writeLogMessages();
}
}

Rectangle
Column
{
anchors.fill: parent;
id: guiColumn;
anchors.centerIn: parent;
spacing: padding;

Row
{
x: 10;
y: 10;
spacing: 10;
spacing: padding;

Text
{
Expand Down Expand Up @@ -389,19 +377,13 @@ MuseScore
outputMessageArea.text = error;
logger.error(error);
}
finally
{
logger.writeLogMessages();
}
}
}
}

Row
{
x: 10;
y: 50;
spacing: 10;
spacing: padding;

Text
{
Expand Down Expand Up @@ -429,10 +411,6 @@ MuseScore
outputMessageArea.text = error.toString();
logger.error(error);
}
finally
{
logger.writeLogMessages();
}
}
}

Expand All @@ -456,23 +434,18 @@ MuseScore
outputMessageArea.text = error.toString();
logger.error(error);
}
finally
{
logger.writeLogMessages();
}
}
}
}

Row
{
x: 10;
y: 100;
spacing: 50;
anchors.horizontalCenter: parent.horizontalCenter;
spacing: 5 * padding;

Column
{
spacing: 10;
spacing: padding;

Text
{
Expand Down Expand Up @@ -604,7 +577,7 @@ MuseScore

Column
{
spacing: 10;
spacing: padding;

Text
{
Expand Down Expand Up @@ -714,7 +687,7 @@ MuseScore

Column
{
spacing: 10;
spacing: padding;

Text
{
Expand Down Expand Up @@ -847,17 +820,17 @@ MuseScore

Row
{
x: 10;
y: 700;
spacing: 10;
anchors.horizontalCenter: parent.horizontalCenter;
spacing: padding;

TextArea
{
id: outputMessageArea;
text: "";
font.family: monospacedFont;
readOnly: true;
width: 450;
wrapMode: TextEdit.Wrap;
width: 400;
height: 50;
}
}
Expand Down Expand Up @@ -925,40 +898,37 @@ MuseScore
while (cursor.segment && (cursor.tick < endTick))
{
// Tune notes.
if (cursor.element)
if (cursor.element && (cursor.element.type == Element.CHORD))
{
if (cursor.element.type == Element.CHORD)
var graceChords = cursor.element.graceNotes;
for (var i = 0; i < graceChords.length; i++)
{
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)
{
logger.error(error);
}
}
}

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)
{
logger.error(error);
}
}
}

var notes = cursor.element.notes;
for (var i = 0; i < notes.length; i++)
{
try
{
notes[i].tuning = calculateTuningOffset(notes[i]);
}
catch (error)
{
logger.error(error);
}
}
}

cursor.next();
Expand All @@ -976,8 +946,6 @@ MuseScore
}
finally
{
logger.writeLogMessages();

quit();
}
}
Expand Down Expand Up @@ -1055,10 +1023,6 @@ MuseScore
{
logger.fatal(error.toString());
}
finally
{
logger.writeLogMessages();
}
}

onRun:
Expand Down Expand Up @@ -1086,7 +1050,6 @@ MuseScore
settingsIO.write(fileContent);

logger.log("Settings file updated successfully.");
logger.writeLogMessages();
}

/**
Expand Down Expand Up @@ -1187,7 +1150,6 @@ MuseScore
}

logger.log("Custom tunings loaded successfully.");
logger.writeLogMessages();
}

/**
Expand All @@ -1210,7 +1172,6 @@ MuseScore
customTuningsIO.write(StringUtils.removeEmptyRows(fileContent));

logger.log("New custom tuning added successfully.");
logger.writeLogMessages();
}

/**
Expand All @@ -1237,6 +1198,5 @@ MuseScore
customTuningsIO.write(StringUtils.removeEmptyRows(fileContent.join("\n")));

logger.log("Tuning deleted successfully.");
logger.writeLogMessages();
}
}
17 changes: 4 additions & 13 deletions source/libs/AccidentalUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

const VERSION = "1.0.0";
const VERSION = "1.0.1";

// TODO: Check which accidentals are actually handled by the tpc property.
const ACCIDENTAL_DATA = {
"NONE":
{
Expand Down Expand Up @@ -532,12 +531,12 @@ const ACCIDENTAL_DATA = {
},
"SIX_TWELFTH_FLAT":
{
"TPC": false,
"TPC": true,
"DEFAULT_OFFSET": 0,
},
"SIX_TWELFTH_SHARP":
{
"TPC": false,
"TPC": true,
"DEFAULT_OFFSET": 0,
},
"SEVEN_TWELFTH_FLAT":
Expand Down Expand Up @@ -711,14 +710,6 @@ function getAccidentalName(note)
// corresponding to the enum value. Parsing it as int is needed to properly
// compare it with the enum values in a switch statement.
var accidentalType = parseInt("" + note.accidentalType);
// TODO: Check if it's still necessary for MS 4.4 and later.
// In Musescore3 the accidentalType property is a signed integer, while the
// Accidentals enum values are always positive. If it's negative, convert
// it to an unsigned 8 bit integer by shifting it by 256.
if (accidentalType < 0)
{
accidentalType += 256;
}
if ((accidentalType < 0) || (accidentalType >= 256))
{
throw "Out of bound accidental type: " + accidentalType;
Expand Down Expand Up @@ -1135,6 +1126,6 @@ function getAccidentalName(note)
return "SAGITTAL_SHARP";

default:
throw "Unrecognised accidental: " + note.accidentalType;
throw "Unrecognised accidental type: " + note.accidentalType;
}
}

0 comments on commit 3eea694

Please sign in to comment.