| 3096 | } |
| 3097 | |
| 3098 | void ScriptedControlAudioParameter::setValue(float newValue) |
| 3099 | { |
| 3100 | if (scriptProcessor.get() != nullptr) |
| 3101 | { |
| 3102 | bool *enableUpdate = &dynamic_cast<MainController*>(parentProcessor)->getPluginParameterUpdateState(); |
| 3103 | |
| 3104 | if (enableUpdate) |
| 3105 | { |
| 3106 | ScopedValueSetter<bool> setter(*enableUpdate, false, true); |
| 3107 | |
| 3108 | const float convertedValue = range.convertFrom0to1(newValue); |
| 3109 | const float snappedValue = range.snapToLegalValue(convertedValue); |
| 3110 | |
| 3111 | if (!lastValueInitialised || lastValue != snappedValue) |
| 3112 | { |
| 3113 | lastValue = snappedValue; |
| 3114 | lastValueInitialised = true; |
| 3115 | scriptProcessor->setAttribute(componentIndex, snappedValue, sendNotificationAsync); |
| 3116 | } |
| 3117 | } |
| 3118 | } |
| 3119 | else |
| 3120 | { |
| 3121 | //jassertfalse; |
| 3122 | } |
| 3123 | } |
| 3124 | |
| 3125 | float ScriptedControlAudioParameter::getDefaultValue() const |
| 3126 | { |
no test coverage detected