/// <summary>
 /// Performs additional actions before the new time will be set to an object.
 /// </summary>
 /// <remarks>
 /// Inside this method the new time can be changed or quantizing of an object can be cancelled.
 /// </remarks>
 /// <param name="obj">Object to quantize.</param>
 /// <param name="quantizedTime">Holds information about new time for an object.</param>
 /// <param name="grid">Grid to quantize object by.</param>
 /// <param name="tempoMap">Tempo map used to quantize object.</param>
 /// <param name="settings">Settings according to which object should be quantized.</param>
 /// <returns>An object indicating whether the new time should be set to the object
 /// or not. Also returned object contains that new time.</returns>
 protected override TimeProcessingInstruction OnObjectQuantizing(
     TimedEvent obj,
     QuantizedTime quantizedTime,
     IGrid grid,
     TempoMap tempoMap,
     TimedEventsQuantizingSettings settings)
 {
     return(new TimeProcessingInstruction(quantizedTime.NewTime));
 }
Пример #2
0
        /// <summary>
        /// Performs additional actions before the new time will be set to an object.
        /// </summary>
        /// <remarks>
        /// Inside this method the new time can be changed or quantizing of an object can be cancelled.
        /// </remarks>
        /// <param name="obj">Object to quantize.</param>
        /// <param name="quantizedTime">Holds information about new time for an object.</param>
        /// <param name="grid">Grid to quantize object by.</param>
        /// <param name="tempoMap">Tempo map used to quantize object.</param>
        /// <param name="settings">Settings according to which object should be quantized.</param>
        /// <returns>An object indicating whether the new time should be set to the object
        /// or not. Also returned object contains that new time.</returns>
        protected override TimeProcessingInstruction OnObjectQuantizing(
            TObject obj,
            QuantizedTime quantizedTime,
            IGrid grid,
            TempoMap tempoMap,
            TSettings settings)
        {
            var newTime = quantizedTime.NewTime;

            switch (settings.QuantizingTarget)
            {
            case LengthedObjectTarget.Start:
                return(CorrectObjectOnStartQuantizing(obj, newTime, tempoMap, settings));

            case LengthedObjectTarget.End:
                return(CorrectObjectOnEndQuantizing(obj, newTime, tempoMap, settings));
            }

            return(new TimeProcessingInstruction(newTime));
        }
Пример #3
0
 /// <summary>
 /// Performs additional actions before the new time will be set to an object.
 /// </summary>
 /// <remarks>
 /// Inside this method the new time can be changed or quantizing of an object can be cancelled.
 /// </remarks>
 /// <param name="obj">Object to quantize.</param>
 /// <param name="quantizedTime">Holds information about new time for an object.</param>
 /// <param name="grid">Grid to quantize object by.</param>
 /// <param name="tempoMap">Tempo map used to quantize object.</param>
 /// <param name="settings">Settings according to which object should be quantized.</param>
 /// <returns>An object indicating whether the new time should be set to the object
 /// or not. Also returned object contains that new time.</returns>
 protected abstract TimeProcessingInstruction OnObjectQuantizing(
     TObject obj,
     QuantizedTime quantizedTime,
     IGrid grid,
     TempoMap tempoMap,
     TSettings settings);