public void AddTuning(string name, Note[] notes) { if (notes.Length != NumStrings) { throw new ArgumentOutOfRangeException("notes"); } Tuning t = new Tuning(this, name, notes); _tunings.Add(t); }
public ITuning Add(string name, FullNote[] rootNotes) { if (ReadOnly) { throw new ObjectIsReadOnlyException(this); } Tuning tuning = new Tuning(this, name, rootNotes); Add(tuning); return(tuning); }
public int CompareTo(object obj) { if (null == obj) { throw new ArgumentNullException("obj"); } Tuning tuning = obj as Tuning; if (null == tuning) { throw new ArgumentException(); } return(LongName.CompareTo(tuning.LongName)); }
public void Read(XmlReader xmlReader) { if (null == xmlReader) { throw new ArgumentNullException("xmlReader"); } using (xmlReader) { do { if (xmlReader.IsStartElement() && xmlReader.Name == "tuning") { Tuning tuning = new Tuning(this, xmlReader.ReadSubtree()); Add(tuning); } } while (xmlReader.Read()); } }
internal void Resort(Tuning tuning, Action rollback) { if (Remove(tuning)) { try { Add(tuning); } catch (Exception ex) { if (null != rollback) { rollback(); // Re-add since remove succeeded but re-add failed if (null != (ex as TuningAlreadyExistsException)) { Add(tuning); } } throw; } } }
public ChordFinder(Instrument instrument, Tuning tuning) { this.Instrument = instrument; this.Tuning = tuning; }