diff --git a/src/ExportGenerators.mss b/src/ExportGenerators.mss index b68e033..f742333 100644 --- a/src/ExportGenerators.mss +++ b/src/ExportGenerators.mss @@ -396,6 +396,7 @@ function GenerateLayers (staffnum, measurenum) { obj = null; line = null; + chordsym = null; parent = null; beam = null; tuplet = null; @@ -512,6 +513,10 @@ function GenerateLayers (staffnum, measurenum) { libmei.AddChild(l, brest); } } + case('GuitarFrame') + { + chordsym = GenerateChordSymbol(bobj); + } case('Slur') { line = GenerateLine(bobj); @@ -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 @@ -557,7 +571,7 @@ function GenerateLayers (staffnum, measurenum) { for each SymbolItem sobj in bar { - ProcessSymbol(sobj, objectPositions); + ProcessSymbol(sobj); } return layers; @@ -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; @@ -1334,6 +1348,18 @@ function GenerateTrill (bobj) { return trill; } //$end +function GenerateChordSymbol (bobj) { + //$module(ExportGenerators.mss) + /* + Generates a 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) /* diff --git a/src/ExportProcessors.mss b/src/ExportProcessors.mss index b12fd4e..eda7f68 100644 --- a/src/ExportProcessors.mss +++ b/src/ExportProcessors.mss @@ -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); diff --git a/src/GLOBALS.mss b/src/GLOBALS.mss index 0b42e7b..0937a9d 100644 --- a/src/GLOBALS.mss +++ b/src/GLOBALS.mss @@ -1,4 +1,4 @@ -Version "2.0.1" +Version "2.0.2" PluginName "Sibelius to MEI Exporter" Author "Andrew Hankinson" diff --git a/src/Run.mss b/src/Run.mss index ca9b0e1..89ad3d0 100644 --- a/src/Run.mss +++ b/src/Run.mss @@ -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) {