Plugin Parameters

  • Specific Parameters belong to specific parts of the plugin (plugin, module etc).
  • Parameter are grouped
  • Parameters can belong to a Parameter Set


? Is there a way to have the processor receive/send all its parameter changes through a channel and have the UI have it's parameter values managed by the host (context)?

public interface IParameterSet
{
    string Name { get; }
    IEnumerable<IParameter> Parameters { get; }
}

public interface IParameter
{
    IParameterInfo ParameterInfo { get; }
    IValueInfo ValueInfo { get; }

    byte[] OpaqueValue { get; set; }

    float ToNormalized();  // [0.0, 1.0]
    bool TryFromNormalized(float value);

    string ToDisplayString();
    bool TryParse(string value);
}

public interface IStringParameter : IParameter, INotifyPropertyChanged
{
    string Value { get; set: }
}

public interface IDoubleParameter : IParameter, INotifyPropertyChanged
{
    double Value { get; set; }
}

public interface IParameterInfo
{
    string Name { get; }
    string FullName { get; }
    // label, units etc.
    // category, parameter set?
    // hidden / visible
    // persistent / volatile (non/stateful)
}

public interface IValueInfo
{
    ValueType Type { get; } // data type
    // value info - default, min, max, range, steps, enum, hints (filename/3state/momentary) etc
    // change characteristics / curve / value smoothing / timespan
}

public interface IStringValueInfo : IValueInfo
{
    StringValueHints Hints { get; }
    int MinLength { get; }
    int MaxLength { get; }
    Encoding Encoding { get; }

    IEnumerable<ValueValidationResult> Validate(string value);

    public enum StringValueHints
    {
        None, // plain string
        FileName,
        Url,
        Json,
        Xml,
        Other, // ??
    }
}

public interface IEnumerationValueInfo : IValueInfo
{
    bool AreFlags { get; }
    IEnumerable<EnumerationValuePair> EnumerationValues { get; }

    IEnumerable<ValueValidationResult> Validate(int value);
    IEnumerable<ValueValidationResult> Validate(string symbol);

    public class EnumerationValuePair
    {
        string Symbol { get; }
        int Value { get; }
    }
}

public interface IBooleanValueInfo
{
    BooleanValueHints Hints { get; }

    IEnumerable<ValueValidationResult> Validate(bool value);

    public enum BooleanValueHints
    {
        Latch,
        Momentary,
        ThreeState,
    }
}

public class ValueValidationResult
{
    bool IsValid { get; set; }
    IParameter Parameter { get; set; }
    object OriginalValue { get; set; }
    string ValidationMessage { get; set; }
}

Last edited Jan 30, 2014 at 9:39 AM by obiwanjacobi, version 4