public NoteBuilder SetLengthValue(NoteTypeValueMusicXML noteValue) { note.Type = new NoteTypeMusicXML { Value = noteValue }; return(this); }
public static string GetFlag(NoteTypeValueMusicXML noteType, bool isDownwards) { string flag = ""; if (!isDownwards) { if (FlagsSymbols_Upwards.ContainsKey(noteType)) { flag = FlagsSymbols_Upwards[noteType]; } else { throw new NotImplementedException(); } } else { if (FlagsSymbols_Downwards.ContainsKey(noteType)) { flag = FlagsSymbols_Downwards[noteType]; } else { throw new NotImplementedException(); } } return(flag); }
private void GetSymbol() { itemDuration = int.Parse(noteItem.Items.OfType <decimal>().FirstOrDefault().ToString()); Tuple <NoteTypeValueMusicXML, bool> value = CalculationHelpers.GetBaseDurationValue(itemDuration, partId, measureId); // item1 =NoteType... item2 true if has dot/dots restType = value.Item1; if (value.Item2) { dotCount++; } symbol = MusicSymbols.GetRestSymbolNoteType(restType); }
private void GetSymbol() { Tuple <NoteTypeValueMusicXML, bool> value = CalculationHelpers.GetBaseDurationValue(duration, partId, measureId); if (noteVisualType == NoteChoiceTypeMusicXML.grace) { noteType = noteItem.FirstOrDefault().Type.Value; } else { noteType = value.Item1; } hasDots = value.Item2; symbol = MusicSymbols.GetNoteHeadSymbolNoteType(noteType); }
/// <summary> /// Converts duration of Note/Rest according to divisions of measure. /// </summary> /// <param name="duration"></param> /// <param name="partId"></param> /// <param name="measureId"></param> /// <returns>Tuple of NoteTypeValue; true if has dot, otherwise false</returns> public static Tuple <NoteTypeValueMusicXML, bool> GetBaseDurationValue(int duration, string partId, string measureId) { NoteTypeValueMusicXML result = NoteTypeValueMusicXML.whole; int divisions = ViewModel.ViewModelLocator.Instance.Main.PartsProperties[partId].GetDivisionsMeasureId(measureId); double durationFactor = duration / (double)divisions; int quarterDivider = (int)((int)NoteDurationValuesInverted.quarter * durationFactor); var convertedDuration = quarterDivider; bool hasDot = !convertedDuration.IsPowerOfTwo(); if (!hasDot) { NoteDurationValuesInverted baseNoteDuration; Enum.TryParse(convertedDuration.ToString(), out baseNoteDuration); result = baseNoteDuration.GetNoteTypeFromNoteDuration(); } else { int flooredDuration = FloorPowerOfTwo(convertedDuration); NoteDurationValuesInverted baseNoteDuration; Enum.TryParse(flooredDuration.ToString(), out baseNoteDuration); result = baseNoteDuration.GetNoteTypeFromNoteDuration(); } return(new Tuple <NoteTypeValueMusicXML, bool>(result, hasDot)); }
public static string GetRestSymbolNoteType(NoteTypeValueMusicXML noteTypeValue) { return(RestNoteTypeSymbols[noteTypeValue]); }
public static string GetNoteHeadSymbolNoteType(NoteTypeValueMusicXML noteTypeValue) { return(StandardNoteHeadSymbols[noteTypeValue]); }