MCPcopy Create free account
hub / github.com/christophhart/HISE / controlCallback

Method controlCallback

hi_scripting/scripting/ScriptProcessor.cpp:184–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184void ProcessorWithScriptingContent::controlCallback(ScriptingApi::Content::ScriptComponent *component, var controllerValue)
185{
186 if (thisAsJavascriptProcessor == nullptr)
187 thisAsJavascriptProcessor = dynamic_cast<JavascriptProcessor*>(this);
188
189 Processor* thisAsProcessor = dynamic_cast<Processor*>(this);
190
191
192#if USE_FRONTEND
193
194 if (component->isAutomatable() &&
195 component->getScriptObjectProperty(ScriptingApi::Content::ScriptComponent::Properties::isPluginParameter) &&
196 getMainController_()->getPluginParameterUpdateState())
197 {
198 float newValue = (float)controllerValue;
199 FloatSanitizers::sanitizeFloatNumber(newValue);
200
201 dynamic_cast<PluginParameterAudioProcessor*>(getMainController_())->setScriptedPluginParameter(component->getName(), newValue);
202 }
203
204#endif
205
206 if (component->isConnectedToMacroControll())
207 {
208
209 float v = jlimit<float>(0.0, 127.0, (float)component->getValue());
210
211 component->setMacroRecursionProtection(true);
212
213 getMainController_()->getMainSynthChain()->setMacroControl(component->getMacroControlIndex(), v, sendNotification);
214
215 component->setMacroRecursionProtection(false);
216 }
217 else if (component->isConnectedToProcessor())
218 {
219 float v = (float)controllerValue;
220 FloatSanitizers::sanitizeFloatNumber(v);
221
222 auto index = component->getConnectedParameterIndex();
223
224 if (index == -2) // intensity
225 {
226 if (auto mod = dynamic_cast<Modulation*>(component->getConnectedProcessor()))
227 {
228 mod->setIntensity(v);
229 BACKEND_ONLY(component->getConnectedProcessor()->sendOtherChangeMessage(dispatch::library::ProcessorChangeEvent::Intensity));
230 }
231 }
232 else if (index == -3) // bypassed
233 {
234 component->getConnectedProcessor()->setBypassed(v > 0.5f, sendNotification);
235 BACKEND_ONLY(component->getConnectedProcessor()->sendOtherChangeMessage(dispatch::library::ProcessorChangeEvent::Bypassed));
236 }
237 else if (index == -4) // enabled
238 {
239 component->getConnectedProcessor()->setBypassed(v < 0.5f, sendNotification);
240 BACKEND_ONLY(component->getConnectedProcessor()->sendOtherChangeMessage(dispatch::library::ProcessorChangeEvent::Bypassed));
241

Callers 7

labelTextChangedMethod · 0.45
timerCallbackMethod · 0.45
handleAsyncUpdateMethod · 0.45
changedMethod · 0.45
listBoxItemClickedMethod · 0.45

Calls 15

getInstanceFunction · 0.85
getMacroControlIndexMethod · 0.80
repaintWrappedMethod · 0.80
getCustomAutomationMethod · 0.80

Tested by

no test coverage detected