Exemple #1
0
        internal void ReplaceValues(ValueLine <TValue> valueLine)
        {
            _values.Clear();
            _values.AddRange(valueLine._values);

            OnValuesChanged();
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TempoMap"/> with the specified time division
        /// of a MIDI file.
        /// </summary>
        /// <param name="timeDivision">MIDI file time division which specifies the meaning of the time
        /// used by events of the file.</param>
        /// <exception cref="ArgumentNullException"><paramref name="timeDivision"/> is null.</exception>
        internal TempoMap(TimeDivision timeDivision)
        {
            ThrowIfArgument.IsNull(nameof(timeDivision), timeDivision);

            TimeDivision  = timeDivision;
            Tempo         = new ValueLine <Tempo>(Interaction.Tempo.Default);
            TimeSignature = new ValueLine <TimeSignature>(Interaction.TimeSignature.Default);
        }
Exemple #3
0
        internal ValueLine <TValue> Reverse(long centerTime)
        {
            var maxTime = 2 * centerTime;
            var changes = this.TakeWhile(c => c.Time <= maxTime);

            var values = new[] { _defaultValue }.Concat(changes.Select(c => c.Value)).Reverse();
            var times  = new[] { 0L }.Concat(changes.Select(c => maxTime - c.Time).Reverse());

            var result = new ValueLine <TValue>(_defaultValue);

            result._values.AddRange(values.Zip(times, (v, t) => new ValueChange <TValue>(t, v)));

            return(result);
        }