Class Randomizer<TObject, TSettings>
Provides methods to randomize objects time.
Inheritance
Randomizer<TObject, TSettings>
Inherited Members
Namespace: Melanchall.DryWetMidi.Tools
Assembly: Melanchall.DryWetMidi.dll
Syntax
[Obsolete("OBS10: Use Quantizer class passing QuantizingSettings with its RandomizingSettings property set. More info: https://melanchall.github.io/drywetmidi/obsolete/obsolete.html#obs10.")]
public abstract class Randomizer<TObject, TSettings>
where TSettings : RandomizingSettings<TObject>, new()
Type Parameters
Name | Description |
---|---|
TObject | The type of objects to quantize. |
TSettings | The type of quantizer's settings. |
Methods
GetObjectTime(TObject, TSettings)
Gets the time of an object that should be randomized.
Declaration
protected abstract long GetObjectTime(TObject obj, TSettings settings)
Parameters
Type | Name | Description |
---|---|---|
TObject | obj | Object to get time of. |
TSettings | settings | Settings according to which the object's time should be gotten. |
Returns
Type | Description |
---|---|
Int64 | The time of obj that should be randomized. |
OnObjectRandomizing(TObject, Int64, TSettings)
Performs additional actions before the new time will be set to an object.
Declaration
protected abstract TimeProcessingInstruction OnObjectRandomizing(TObject obj, long time, TSettings settings)
Parameters
Type | Name | Description |
---|---|---|
TObject | obj | Object to randomize. |
Int64 | time | The new time that is going to be set to the object. Can be changed inside this method. |
TSettings | settings | Settings according to which object should be randomized. |
Returns
Type | Description |
---|---|
TimeProcessingInstruction | An object indicating whether the new time should be set to the object or not. Also returned object contains that new time. |
Remarks
Inside this method the new time can be changed or randomizing of an object can be cancelled.
RandomizeInternal(IEnumerable<TObject>, IBounds, TempoMap, TSettings)
Randomizes objects time using the specified bounds and settings.
Declaration
protected void RandomizeInternal(IEnumerable<TObject> objects, IBounds bounds, TempoMap tempoMap, TSettings settings)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TObject> | objects | Objects to randomize. |
IBounds | bounds | Bounds to randomize time within. |
TempoMap | tempoMap | Tempo map used to calculate time bounds to randomize within. |
TSettings | settings | Settings according to which objects should be randomized. |
SetObjectTime(TObject, Int64, TSettings)
Sets the new time of an object.
Declaration
protected abstract void SetObjectTime(TObject obj, long time, TSettings settings)
Parameters
Type | Name | Description |
---|---|---|
TObject | obj | Object to set time for. |
Int64 | time | New time after randomizing. |
TSettings | settings | Settings according to which the object's time should be set. |