예제 #1
0
        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);
        }
예제 #2
0
        public ITuning Add(string name, FullNote[] rootNotes)
        {
            if (ReadOnly)
            {
                throw new ObjectIsReadOnlyException(this);
            }

            Tuning tuning = new Tuning(this, name, rootNotes);

            Add(tuning);
            return(tuning);
        }
예제 #3
0
파일: Tuning.cs 프로젝트: vavachi/Chordious
        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));
        }
예제 #4
0
        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());
            }
        }
예제 #5
0
        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;
                }
            }
        }
예제 #6
0
 public ChordFinder(Instrument instrument, Tuning tuning)
 {
     this.Instrument = instrument;
     this.Tuning     = tuning;
 }