internal Tuning(TuningSet parent, XmlReader xmlReader) : this(parent) { if (null == xmlReader) { throw new ArgumentNullException(nameof(xmlReader)); } using (xmlReader) { if (xmlReader.IsStartElement() && xmlReader.Name == "tuning") { Name = xmlReader.GetAttribute("name"); string notes = xmlReader.GetAttribute("notes"); string[] s = notes.Split(';'); FullNote[] rootNotes = new FullNote[s.Length]; if (rootNotes.Length != Parent.Instrument.NumStrings) { throw new ArgumentOutOfRangeException(); } for (int i = 0; i < rootNotes.Length; i++) { rootNotes[i] = FullNote.Parse(s[i]); } RootNotes = rootNotes; } } UpdateParent = true; }
public int CompareTo(object obj) { if (null == obj) { throw new ArgumentNullException(nameof(obj)); } FullNote fullNote = obj as FullNote; if (null == fullNote) { throw new ArgumentException(); } if (Octave == fullNote.Octave) { return(InternalNote.CompareTo(fullNote.InternalNote)); } return(Octave.CompareTo(fullNote.Octave)); }
public void CopyFrom(ITuningSet tuningSet) { if (null == tuningSet) { throw new ArgumentNullException(nameof(tuningSet)); } if (Instrument.NumStrings != tuningSet.Instrument.NumStrings) { throw new ArgumentOutOfRangeException(nameof(tuningSet)); } foreach (ITuning sourceTuning in tuningSet) { if (!TryGet(sourceTuning.LongName, out ITuning tuning)) { FullNote[] rootNotes = new FullNote[sourceTuning.RootNotes.Length]; sourceTuning.RootNotes.CopyTo(rootNotes, 0); Add(sourceTuning.Name, rootNotes); } } }