vdaron / MusicXml.Net

Quick C# parser for MusicXML
Other
58 stars 27 forks source link

Width of measure should be double #5

Closed LimmaPaulus closed 8 years ago

LimmaPaulus commented 8 years ago

Hi!

I'm using your nice library to parse MusicXml file created by MuseScore. MuseScore seems to write measure widths with doubles, which causes exception when trying to parse with MusicXml.net.

vdaron commented 8 years ago

Hi,

Back from vacations.

Could you create a bug report with an Xml file to be able to reproduce the problem ?

Thanks

Vincent.

sambaker commented 8 years ago

I had the same errors - to fix it, I changed line 63 of MusicXmlParser.cs from:

measure.Width = Convert.ToInt32(measureWidthAttribute.InnerText);

to

measure.Width = (int)Convert.ToDouble(measureWidthAttribute.InnerText);

which fixes the parsing but obviously will lose precision. However in my case I didn't need measure.Width, I just needed to fix the exceptions. Attached is an XML file that causes an exception without my change.

Feel_Like_Funkin_It_Up.txt