Processing parameter operations
Common MimiProcessingParameter operations¶
MimiProcessingParameter Value operations¶
The following operations are provided on the MimiProcessingParameter and execute the value application sequence, and return a ProcessingParameterResult indicating whether the operation was successful.
| Function | Behavior | Notes |
|---|---|---|
apply(value) |
The apply function attempts to update the MimiProcessingParameter with the given value by updating all registered, out-of-date Applicator instances. |
|
synchronizeApplicator() |
The synchronizeApplicator function attempts to update the Applicator instance with the current MimiProcessingParameter value. |
|
load() |
The load function will attempt to refresh the value from the data source, and then automatically execute the value application sequence with that value. |
Only available for applicable if the MimiProcessingParameter has a MimiProcessingParameterDataSource |
Reading the MimiProcessingParameter state¶
| Property/Function | Behavior | Notes |
|---|---|---|
value |
The value property holds the latest successfully applied Parameter value. It is updated at the end of the value application sequence |
|
observe() |
An Observer which provides callbacks for observing and value and state changes related to the MimiProcessingParameter. It has the following events: Applying - the request value is currently being applied to the Applicators. Failed - the most recent value application failed. Applied - the most recent value application was successful. Loading - the value is being retrieved from the data source. |
Important: You should not use observe to apply values to your processing system; that is the responsibility of an Applicator. |
Example
Get the current parameter value:
val activeSession : ProcessingSession = requireNotNull(MimiCore.processingController.activeSession.state.value)
val isEnabled : Boolean = activeSession.soundPersonalization?.media?.isEnabled?.value
Example
Observe changes in the MimiProcessingParameter state:
```kotlin
// Acquire the active ProcessSession (assumes already activated!)
val activeSession : ProcessingSession = requireNotNull(MimiCore.processingController.activeSession.state.value)
// Observer for a MimiProcessingParameter
activeSession.soundPersonalization?.media?.isEnabled?.observe {
when(val updateState = it.updateState) {
ProcessingParameterUpdateState.Applied -> TODO() // add your code here to handle when value application succeeds
is ProcessingParameterUpdateState.Applying -> TODO() // add your code here to handle when a value application is in progress
is ProcessingParameterUpdateState.Failed -> TODO() // add your code here to handle when a value application fails
ProcessingParameterUpdateState.Loading -> TODO() // add your code here to handle when a value application is loading from the data source
}
}
```