protected AbstractKey(ClefSignMusicXML clefSign, int line, int keyFifths) { drawingVisualHost = new DrawingVisualHost(); keyAccidentals = GetKeyAccidentals(keyFifths); keyStaffSpaceIndex = GetKeyStaffSpaceIndex(clefSign, line, keyFifths > 0 ? false:true); this.keyFifths = keyFifths; }
public ClefContainerItem(string staff, int fractionPosition, ClefMusicXML clef) : base(AttributeType.clef, int.Parse(staff), fractionPosition) { _sign = clef.Sign; _line = clef.Line != null?int.Parse(clef.Line) : 0; _octaveChange = clef.ClefOctaveChange != null?int.Parse(clef.ClefOctaveChange) : 0; _isAdditional = clef.AdditionalSpecified ? clef.Additional == YesNoMusicXML.yes : false; if (fractionPosition != 0) { _isAdditional = true; } Update(); //---------temp--test----------------- ItemCanvas.MouseDown += _itemCanvas_MouseDown; var context = new ContextMenu(); var menuItem = new MenuItem { Header = "Change Clef" }; menuItem.Click += MenuItem_Click; context.Items.Add(menuItem); ItemCanvas.ContextMenu = context; //------------------------------------- }
public static int GetClefDefaulLine(ClefSignMusicXML sign) { var line = 0; if (line == 0) { if (sign == ClefSignMusicXML.G) { line = 2; } if (sign == ClefSignMusicXML.C) { line = 3; } if (sign == ClefSignMusicXML.F) { line = 4; } if (sign == ClefSignMusicXML.TAB) { line = 3; } } if (sign == ClefSignMusicXML.percussion) { line = 3; } if (sign == ClefSignMusicXML.TAB) { line = 3; } return(line); }
public MeasureClef(ClefSignMusicXML clefSign, int lineOfStaff, int octaveChange, AbstractStaff staff) { _visualsHost = new DrawingVisualHost(); _lineOfStaff = lineOfStaff; _clefSign = clefSign; MusicSymbols.TryGetClefSymbol(clefSign, octaveChange, out _symbol); this.staff = staff; }
public MeasureClef(ClefMusicXML clef, AbstractStaff staff) { var octaveChange = 0; if (!String.IsNullOrEmpty(clef.ClefOctaveChange)) { octaveChange = int.Parse(clef.ClefOctaveChange); } if (MusicSymbols.TryGetClefSymbol(clef.Sign, octaveChange, out string symbol)) { _clefSign = clef.Sign; _symbol = symbol; } else { throw new ArgumentException("An error occured while parsing clef symol"); } if (int.TryParse(clef.Line, out int line)) { _lineOfStaff = line; } this.staff = staff; }
protected override void ChangeKeyAccidentals(AccidentalValueMusicXML[] newAccidentals, ClefSignMusicXML newClefSign, int newClefLine, bool newIsFlatKey) { //todo implementation... }
public MeasureKey(ClefSignMusicXML clefSign, int clefLine, int keyFifths) : base(clefSign, clefLine, keyFifths) { currentClefSign = clefSign; currentClefLine = clefLine; }
public void ChangeSign(ClefSignMusicXML sign) { _sign = sign; _line = 0; Update(); }
public int[] GetKeyStaffSpaceIndex(ClefSignMusicXML clefSign, int line, bool isFlat) { var result = new int[] { 0, 0, 0, 0, 0, 0, 0 }; switch (clefSign) { case ClefSignMusicXML.G: switch (line) { case 2: result = isFlat ? new int[] { 5, 2, 6, 3, 7, 4, 8 } : new int[] { 1, 4, 0, 3, 6, 2, 5 }; break; case 1: result = isFlat ? new int[] { 7, 4, 8, 5, 9, 6, 10 } : new int[] { 3, 6, 3, 5, 8, 4, 7 }; break; default: Console.WriteLine($"Invalid line index: {line} for clef {clefSign}"); break; } break; case ClefSignMusicXML.F: switch (line) { case 3: result = isFlat ? new int[] { 2, 6, 3, 7, 4, 8, 5 } : new int[] { 5, 1, 4, 0, 3, 6, 2 }; break; case 4: result = isFlat ? new int[] { 7, 4, 8, 5, 9, 6, 10 } : new int[] { 3, 6, 3, 5, 8, 4, 7 }; break; case 5: result = isFlat ? new int[] { 5, 2, 6, 3, 7, 4, 8 } : new int[] { 1, 4, 0, 3, 6, 2, 5 }; break; default: Console.WriteLine($"Invalid line index: {line} for clef {clefSign}"); break; } break; case ClefSignMusicXML.C: switch (line) { case 1: result = isFlat ? new int[] { 3, 7, 4, 8, 5, 9, 6 } : new int[] { 6, 2, 5, 1, 4, 0, 3 }; break; case 2: result = isFlat ? new int[] { 1, 5, 2, 6, 3, 7, 4 } : new int[] { 4, 7, 3, 6, 2, 5, 1 }; break; case 3: result = isFlat ? new int[] { 6, 3, 7, 4, 8, 5, 9 } : new int[] { 2, 5, 1, 4, 7, 3, 6 }; break; case 4: result = isFlat ? new int[] { 4, 1, 5, 2, 6, 3, 7 } : new int[] { 7, 3, 6, 2, 5, 1, 4 }; break; case 5: result = isFlat ? new int[] { 2, 6, 3, 7, 4, 8, 5 } : new int[] { 5, 1, 4, 0, 3, 6, 2 }; break; default: Console.WriteLine($"Invalid line index: {line} for clef {clefSign}"); break; } break; default: Console.WriteLine($"Invalid clef sign: {clefSign}"); break; } return(result); }
protected abstract void ChangeKeyAccidentals(AccidentalValueMusicXML[] newAccidentals, ClefSignMusicXML newClefSign, int newClefLine, bool newIsFlatKey);
public static bool TryGetClefSymbol(ClefSignMusicXML sign, int octaveChange, out string symbol) { switch (sign) { case ClefSignMusicXML.G: switch (octaveChange) { case -2: symbol = MusicSymbols.GClef15Down; break; case -1: symbol = MusicSymbols.GClef8Down; break; case 1: symbol = MusicSymbols.GClef8Up; break; case 2: symbol = MusicSymbols.GClef15Up; break; default: symbol = MusicSymbols.GClef; break; } break; case ClefSignMusicXML.F: switch (octaveChange) { case -2: symbol = MusicSymbols.FClef15Down; break; case -1: symbol = MusicSymbols.FClef8Down; break; case 1: symbol = MusicSymbols.FClef8Up; break; case 2: symbol = MusicSymbols.FClef15Up; break; default: symbol = MusicSymbols.FClef; break; } break; case ClefSignMusicXML.C: switch (octaveChange) { case -1: symbol = MusicSymbols.CClef8Down; break; default: symbol = MusicSymbols.CClef; break; } break; case ClefSignMusicXML.percussion: symbol = MusicSymbols.Percussion; break; case ClefSignMusicXML.TAB: symbol = MusicSymbols.TAB; break; case ClefSignMusicXML.jianpu: symbol = string.Empty; break; case ClefSignMusicXML.none: symbol = string.Empty; break; default: symbol = null; return(false); } return(true); }