Skip to content

Commit

Permalink
Merge pull request #47 from music-encoding/develop
Browse files Browse the repository at this point in the history
Release version 2.0.2
  • Loading branch information
ahankinson authored Aug 27, 2016
2 parents 3169410 + fce0779 commit 3f8584f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
32 changes: 29 additions & 3 deletions src/ExportGenerators.mss
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ function GenerateLayers (staffnum, measurenum) {

obj = null;
line = null;
chordsym = null;
parent = null;
beam = null;
tuplet = null;
Expand Down Expand Up @@ -512,6 +513,10 @@ function GenerateLayers (staffnum, measurenum) {
libmei.AddChild(l, brest);
}
}
case('GuitarFrame')
{
chordsym = GenerateChordSymbol(bobj);
}
case('Slur')
{
line = GenerateLine(bobj);
Expand Down Expand Up @@ -548,6 +553,15 @@ function GenerateLayers (staffnum, measurenum) {
mlines.Push(line._id);
Self._property:MeasureLines = mlines;
}

// add chord symbols to the measure lines
// so that they get added to the measure later in the processing cycle.
if (chordsym != null)
{
mlines = Self._property:MeasureLines;
mlines.Push(chordsym._id);
Self._property:MeasureLines = mlines;
}
}

for each LyricItem lobj in bar
Expand All @@ -557,7 +571,7 @@ function GenerateLayers (staffnum, measurenum) {

for each SymbolItem sobj in bar
{
ProcessSymbol(sobj, objectPositions);
ProcessSymbol(sobj);
}

return layers;
Expand Down Expand Up @@ -869,8 +883,8 @@ function GenerateNote (nobj) {
clefinfo = ConvertClef(clef.StyleId);

n = libmei.Note();
hash = SimpleNoteHash(nobj);
n._property:hash = hash;
//hash = SimpleNoteHash(nobj);
//n._property:hash = hash;

ntinfo = ConvertDiatonicPitch(nobj.DiatonicPitch);
pnum = nobj.Pitch;
Expand Down Expand Up @@ -1334,6 +1348,18 @@ function GenerateTrill (bobj) {
return trill;
} //$end

function GenerateChordSymbol (bobj) {
//$module(ExportGenerators.mss)
/*
Generates a <harm> element containing chord symbol information
*/
harm = libmei.Harm();
libmei.AddAttribute(harm, 'tstamp', ConvertPositionToTimestamp(bobj.Position, bobj.ParentBar));
libmei.SetText(harm, bobj.ChordNameAsPlainText);

return harm;
} //$end

function GenerateFormattedString (bobj) {
//$module(ExportGenerators.mss)
/*
Expand Down
2 changes: 1 addition & 1 deletion src/ExportProcessors.mss
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ function ProcessVolta (mnum) {
return null;
} //$end

function ProcessSymbol (sobj, objectPositions) {
function ProcessSymbol (sobj) {
//$module(ExportProcessors.mss)
Log('symbol index: ' & sobj.Index & ' name: ' & sobj.Name);
Log(sobj.VoiceNumber);
Expand Down
2 changes: 1 addition & 1 deletion src/GLOBALS.mss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version "2.0.1"
Version "2.0.2"
PluginName "Sibelius to MEI Exporter"
Author "Andrew Hankinson"

Expand Down
13 changes: 12 additions & 1 deletion src/Run.mss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,19 @@ function Run() {
return False;
}

// get the active score object
activeScore = Sibelius.ActiveScore;

// it does not seem possible to get the current folder for the file
// so we will default to the user's documents folder.
// NB: it seems that if we don't specify a folder name, the filename
// is not properly set.
activeFileNameFull = activeScore.FileName;
activeFileName = utils.ExtractFileName(activeFileNameFull);
activePath = Sibelius.GetDocumentsFolder();

// Ask to the file to be saved somewhere
filename = Sibelius.SelectFileToSave('Save as...', False, False, 'mei', 'TEXT', 'Music Encoding Initiative');
filename = Sibelius.SelectFileToSave('Save as...', activeFileName, activePath, 'mei', 'TEXT', 'Music Encoding Initiative');

if (filename = null)
{
Expand Down

0 comments on commit 3f8584f

Please sign in to comment.