예제 #1
0
        public void CopyFrom(ITuningSet tuningSet)
        {
            if (null == tuningSet)
            {
                throw new ArgumentNullException("tuningSet");
            }

            if (Instrument.NumStrings != tuningSet.Instrument.NumStrings)
            {
                throw new ArgumentOutOfRangeException("tuningSet");
            }

            foreach (ITuning sourceTuning in tuningSet)
            {
                ITuning tuning = null;

                if (!TryGet(sourceTuning.LongName, out tuning))
                {
                    FullNote[] rootNotes = new FullNote[sourceTuning.RootNotes.Length];
                    sourceTuning.RootNotes.CopyTo(rootNotes, 0);

                    Add(sourceTuning.Name, rootNotes);
                }
            }
        }
예제 #2
0
파일: Tuning.cs 프로젝트: vavachi/Chordious
        internal Tuning(TuningSet parent, XmlReader xmlReader) : this(parent)
        {
            if (null == xmlReader)
            {
                throw new ArgumentNullException("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;
        }
예제 #3
0
        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));
        }