private Duration ParseDuration(int duration)
{
switch (duration)
{
case -4: return Duration.QuadrupleWhole;
case -2: return Duration.DoubleWhole;
case 1: return Duration.Whole;
case 2: return Duration.Half;
case 4: return Duration.Quarter;
case 8: return Duration.Eighth;
case 16: return Duration.Sixteenth;
case 32: return Duration.ThirtySecond;
case 64: return Duration.SixtyFourth;
case 128: return Duration.OneHundredTwentyEighth;
default: return Duration.Quarter;
}
}