setParameter method
Sets parameter value from UI and notifies the VST3 EditController.
The beginEdit and the value both leave for the host before the first await, so a value or endEdit issued in the meantime cannot overtake them.
Implementation
Future<void> setParameter(int id, double value) async {
final clamped = value.clamp(0.0, 1.0);
_parameters[id] = clamped;
final sends = [
..._pendingBegins.remove(id)
? [_send('beginEdit', {'id': id})]
: <Future<void>>[],
_send('setParameter', {'id': id, 'value': clamped}),
];
await Future.wait(sends);
notifyListeners();
}