/// <summary> /// Adds properties to Note /// </summary> /// <param name="_note">MEI note element</param> /// <param name="_noteObject">Empty note object</param> /// <returns>Note object with content</returns> public static Model.Note ConvertNote(Model.Note _noteObject, mei.Note _note) { _noteObject.Coloration = GetColoration(_note); _noteObject.Fermata = GetFermata(_note); _noteObject.WrittenPitch = ConvertWrittenpitch(_note); _noteObject.Duration = ConvertDuration(_note); _noteObject.Num = ConverterHelper.ConvertNumNumbase(_note.GetNumAttribute()); _noteObject.Numbase = ConverterHelper.ConvertNumNumbase(_note.GetNumbaseAttribute()); _noteObject.Stem = ConvertStem(_note); if (_note.HasAccidGes()) { _noteObject.AccidGes = ConverterHelper.ConvertAccid(_note.GetAccidGesAttribute()); } return(_noteObject); }
/// <summary> /// Adds properties to a Proportion object. /// </summary> /// <param name="_propobj">Empty proportion object</param> /// <param name="_meiprop">MEI proport element</param> /// <returns>Proportion object with data</returns> public static Model.Proportion ConvertProportion(Model.Proportion _propobj, mei.Proport _meiprop) { _propobj.Sign = GetSign(_meiprop); _propobj.Affected = ConvertAffected(_meiprop); if (_meiprop.HasNum() && _meiprop.HasNumbase()) { _propobj.Num = ConverterHelper.ConvertNumNumbase(_meiprop.GetNumAttribute()); _propobj.Numbase = ConverterHelper.ConvertNumNumbase(_meiprop.GetNumbaseAttribute()); } else { throw new NullReferenceException($"<proport> doesn't have @num or @numbase!"); } return(_propobj); }
/// <summary> /// Converts value of @mse:affected into Enum Duration /// </summary> /// <param name="_prop">MEI proport element</param> /// <returns>Model.Duration</returns> private static Duration ConvertAffected(mei.Proport _prop) { return(ConverterHelper.ConvertDuration(_prop.GetAffectedAttribute())); }
/// <summary> /// Gets base-40 diatonic pitch for keyAccid /// </summary> /// <param name="_keyaccid">MEI keyAccid</param> /// <returns>Base-40 int</returns> private static int GetKeyAccidPitch(KeyAccid _keyaccid) { return(ConverterHelper.ConvertToBase40(_keyaccid.GetPnameValue(), _keyaccid.GetOctValue())); }
/// <summary> /// Gets base-40 pitch location for accid element /// </summary> /// <param name="_accid">MEI accid</param> /// <returns>Base-40 int</returns> private static int GetAccidPitchLoc(Accid _accid) { return(ConverterHelper.ConvertToBase40(_accid.GetPlocValue(), _accid.GetOlocValue())); }
public static Model.Custos ConvertCustos(Model.Custos _custos, mei.Custos _meiCustos) { _custos.PitchLocation = ConverterHelper.ConvertToBase40(_meiCustos.GetPnameValue(), _meiCustos.GetOctValue()); return(_custos); }
/// <summary> /// Converts value of @dur into Enum Duration /// </summary> /// <param name="_element">MEI note/rest element</param> /// <returns>Model.Duration</returns> protected static Model.Duration ConvertDuration(mei.IAttDurationMusical _element) { return(ConverterHelper.ConvertDuration(_element.GetDurAttribute())); }
/// <summary> /// Converts the pitch information of a note element into base-40 without accidentals /// </summary> /// <param name="_note">MEI note element</param> /// <returns>Base-40 value as integer</returns> private static int ConvertWrittenpitch(mei.Note _note) { //Conversion without accidentals return(ConverterHelper.ConvertToBase40(_note.GetPnameValue(), _note.GetOctValue())); }