MimiProcessingParameter

public protocol MimiProcessingParameter<Value> : AnyObject

Protocol for a processing parameter.

MimiProcessingParameter represents a parameter in Mimi Processing, providing publishers for value and state changes, and methods for applying and loading values.

  • Name of the parameter.

    Declaration

    Swift

    var name: String { get }
  • A publisher for tracking value changes related to the MimiProcessingParameter.

    Declaration

    Swift

    var valuePublisher: AnyPublisher<Value, Never> { get }
  • Current value of the parameter.

    Declaration

    Swift

    var value: Value { get }
  • A publisher for tracking state changes related to the MimiProcessingParameter.

    This publisher emits values of type MimiProcessingParameterUpdateState to notify subscribers about changes.

    Note

    The publisher never produces errors (Never), making it suitable for representing a continuous stream of application state updates without failure.

    Example usage:

       // Subscribe to changes of the value application state
       let subscription = processingInstance.updateState
            .sink { state in
               print("Processing parameter update state: \(state)")
       }
    
    Declaration

    Swift

    var updateState: AnyPublisher<MimiProcessingParameterUpdateState<Value>, Never> { get }
  • The data source for the parameter, if available.

    Declaration

    Swift

    var dataSource: AnyMimiProcessingParameterDataSource<Value>? { get }
  • Synchronize the applicator with the current parameter value.

    This function attempts to force update the associated MimiProcessingParameterApplicator instance with the current value of the MimiProcessingParameter.

    Declaration

    Swift

    func synchronizeApplicator() async throws
  • Apply a new value to the parameter.

    This will attempt to apply the provided value on the associated applicator if it is out of date. For the application to succeed, success must be reported by the applicator. If the applicator fails to report success, the application fails, and an error is thrown.

    Declaration

    Swift

    func apply(_ value: Value) async throws
    Parameters
    value

    Value to apply.

  • Load the parameter value from its data source and attempt to apply it.

    This function will attempt to load a new parameter value from a data source if available and then apply it on all registered applicators Effectively this will load() and then apply() the value.

    Note

    If a dataSource is unavailable, then this function will throw a dataSourceUndefined error.
    Declaration

    Swift

    func load() async throws