private void SetVisualType() { noteVisualType = noteItem[0].ItemsElementName.Contains(NoteChoiceTypeMusicXML.grace) ? NoteChoiceTypeMusicXML.grace : noteItem[0].ItemsElementName.Contains(NoteChoiceTypeMusicXML.cue) ? NoteChoiceTypeMusicXML.cue : NoteChoiceTypeMusicXML.chord; noteAdditionalType = noteItem[0].ItemsElementName.Contains(NoteChoiceTypeMusicXML.pitch) ? NoteChoiceTypeMusicXML.pitch : NoteChoiceTypeMusicXML.unpitched; }
private void AppendItem(NoteChoiceTypeMusicXML noteType, object value) { if (note.ItemsElementName == null) { note.ItemsElementName = new NoteChoiceTypeMusicXML[] { noteType }; note.Items = new object[] { value }; } else if (note.ItemsElementName.Any(item => item == noteType)) { Console.WriteLine($"NoteBuilder::Note Items Array already contains this type of item ({noteType.ToString()}), item of found noteType will be overwritten"); note.Items[Array.IndexOf(note.ItemsElementName, noteType)] = value; } else { object[] temp = note.Items; Array.Resize(ref temp, temp.Length + 1); temp[temp.Length - 1] = value; note.Items = temp; var tempElementName = note.ItemsElementName; Array.Resize(ref tempElementName, tempElementName.Length + 1); tempElementName[tempElementName.Length - 1] = noteType; note.ItemsElementName = tempElementName; } if (note.Items.Length != note.ItemsElementName.Length) { throw new Exception("Something went wrong! .Items and .ItemsElementName arrays lengths should be equal!"); } }
public NoteChoiceTypeMusicXML GetAdditionalType(NoteChoiceTypeMusicXML type) { if (ItemsElementName.Contains(NoteChoiceTypeMusicXML.rest)) { type.SetFlags(NoteChoiceTypeMusicXML.rest, true); } if (ItemsElementName.Contains(NoteChoiceTypeMusicXML.pitch)) { type.SetFlags(NoteChoiceTypeMusicXML.pitch, true); } else { type.SetFlags(NoteChoiceTypeMusicXML.unpitched, true); } return(type); }
public NoteChoiceTypeMusicXML GetNoteType() { NoteChoiceTypeMusicXML result = NoteChoiceTypeMusicXML.none; if (ItemsElementName.Contains(NoteChoiceTypeMusicXML.chord)) { result = result.SetFlags(NoteChoiceTypeMusicXML.chord, true); } if (ItemsElementName.Contains(NoteChoiceTypeMusicXML.cue)) { result = NoteChoiceTypeMusicXML.cue; } if (ItemsElementName.Contains(NoteChoiceTypeMusicXML.grace)) { result = NoteChoiceTypeMusicXML.grace; } //Add additional attribute info return(GetAdditionalType(result)); }
public int GetIndexOfType(NoteChoiceTypeMusicXML attributeType) { return(Array.IndexOf(ItemsElementName, attributeType)); }