Exemplo n.º 1
0
        /// <summary>
        /// Converts an absolute semitones list from its string representation.
        /// </summary>
        /// <param name="s">The <see cref="string"/> represention of the semitone distances.</param>
        /// <param name="separators">The <see cref="IEnumerable{Char}"/> (Optional, ' ' separator is used by default)</param>\
        /// <returns>The <see cref="AbsoluteSemitoneList"/>.</returns>
        /// <exception cref="System.FormatException">Throw if the format is incorrect,</exception>
        public static AbsoluteSemitoneList Parse(
            string s,
            IEnumerable <char> separators = null)
        {
            separators = separators ?? new [] { ' ' };
            var semitones = s.Split(separators.ToArray()).Select(ParseSelector);
            var result    = new AbsoluteSemitoneList(semitones);

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the <see cref="AbsoluteSemitoneList"/> (Absolute).
        /// </summary>
        /// <returns>The <see cref="AbsoluteSemitoneList"/></returns>
        public AbsoluteSemitoneList ToAbsolute()
        {
            var semitone  = Semitone.Unison;
            var semitones = new List <Semitone>();

            foreach (var increment in _relativeSemitones)
            {
                semitones.Add(semitone);
                semitone += increment;
            }
            semitones.Add(semitone);

            var result = new AbsoluteSemitoneList(semitones);

            return(result);
        }
Exemplo n.º 3
0
        public AbsoluteSemitoneList Rotate(int count)
        {
            var result = new AbsoluteSemitoneList(CombinatoricsExtensions.Rotate(this, count));

            return(result);
        }