Calling scriplet script from rackspace script

How can I call a scriptlet script from a rackspace script when in the rackspace script a condition is getting true?

That is impossible

And how do I realize it?

You know how a scriptlet is working?

In the scriptlet you react on events like incoming midi events or parameter changes.
So you could set a widget value in the rackspace script.
The widget is linked to a scriptlet parameter and then the parameter callback in the scriptlet is executed.

As @pianopaul says: you can use a parameter from a scriptlet to trigger your scriptlet to do something. You can do that using a widget, but also direct by assigning a handle to the scriptlet and using SetParameter(plugin, param, value) where plugin is the handle of the scriptlet.

But this is asynchronous! The scriptlet will be executed, but almost certain not before the next line of the script that triggers it.

I have the following scriplet script and I want, that it starts, when a parameter of the widget solo01 or solo02 … or solo10 changes:

var
    movStart("Start moving") : Parameter "STOP", "GO" = "STOP"
    speed ("Speed of movement") : Parameter 1..30 = 20
    
    position1 ("DummyVolume01") : Parameter 0..127 = 127
    position2 ("DummyVolume02") : Parameter 0..127 = 127
    position3 ("DummyVolume03") : Parameter 0..127 = 127
    position4 ("DummyVolume04") : Parameter 0..127 = 127
    position5 ("DummyVolume05") : Parameter 0..127 = 127
    position6 ("DummyVolume06") : Parameter 0..127 = 127
    position7 ("DummyVolume07") : Parameter 0..127 = 127
    position8 ("DummyVolume08") : Parameter 0..127 = 127
    position9 ("DummyVolume09") : Parameter 0..127 = 127
    position10 ("DummyVolume10") : Parameter 0..127 = 127
    incstep : integer

   
Initialization
    SetTimersRunning(false)
End


On TimerTick(ms : double)
    position1 = position1 + incstep
    if position1 >= 127 or position1 <=0
        then SetTimersRunning(false)
    end
    if position2 >= 127 or position2 <=0
        then SetTimersRunning(false)
    end
    if position3 >= 127 or position3 <=0
        then SetTimersRunning(false)
    end
    if position4 >= 127 or position4 <=0
        then SetTimersRunning(false)
    end
    if position5 >= 127 or position5 <=0
        then SetTimersRunning(false)
    end
    if position6 >= 127 or position6 <=0
        then SetTimersRunning(false)
    end
    if position7 >= 127 or position7 <=0
        then SetTimersRunning(false)
    end
    if position8 >= 127 or position8 <=0
        then SetTimersRunning(false)
    end
    if position9 >= 127 or position9 <=0
        then SetTimersRunning(false)
    end
    if position10 >= 127 or position10 <=0
        then SetTimersRunning(false)
    end
End

// Called when a parameter value has changed
On ParameterValueChanged matching movStart
    If movStart == "GO" Then
        incstep=1*speed
        SetTimersRunning(true)
    Elsif movStart == "STOP" Then
        incstep =  (-1)*speed
        SetTimersRunning(true)
    End
End

Theoretically do widgets not have parameters, but only values (and some gui related attributes, like a label). In a way the widget itself is the parameter. End of lecture :grinning:.

You can assign the movStart parameter of the scriptlet to the solo01 - solo10 widgets. You go to the edit view, select a soloXX widget, right-bottom select the scriptlet (just like any plugin) and choose the movStart parameter.

Or assign a handle to the scriptlet and do it from script. You should treat a scriptlet as if it were a plugin. In fact it is.

I originally built a Rackspace script that creates a kind of solo function where 0, 1 to 10 audio channels are soloed and automatically the non-soloed channels are driven with the volume to 0 and when all channels are no longer soloed all channels are again driven to the maximum volume. The script below does this as well. Now I wanted to add another function so that the channels are not abruptly driven to 0 or to full volume, but are gently faded in an adjustable time.
Here the source script:

//$<AutoDeclare>
// DO NOT EDIT THIS SECTION MANUALLY
Var
   TP : Widget
   UP : Widget
   DOWN : Widget
//$</AutoDeclare>

// Called when a single widget value has changed
On WidgetValueChanged(newValue : double) from DOWN
 if newValue == 1.0 then
  TP.SetWidgetValue(TP.GetWidgetValue()-1.0/24.0)
 end 
End

On WidgetValueChanged(newValue : double) from UP
 if newValue == 1.0 then
  TP.SetWidgetValue(TP.GetWidgetValue()+1.0/24.0)
 end 
End

Var
   Solo01 : Widget
   Solo02 : Widget
   Solo03 : Widget
   Solo04 : Widget
   Solo05 : Widget
   Solo06 : Widget
   Solo07 : Widget
   Solo08 : Widget
   Solo09 : Widget
   Solo10 : Widget

   DummyVolume01 : Widget
   DummyVolume02 : Widget
   DummyVolume03 : Widget
   DummyVolume04 : Widget
   DummyVolume05 : Widget
   DummyVolume06 : Widget
   DummyVolume07 : Widget
   DummyVolume08 : Widget
   DummyVolume09 : Widget
   DummyVolume10 : Widget

   SoloStatus : double
   
   incstep : integer
   
   Level_2 : Widget

Function isAnySoloActive() 
    SoloStatus = 0.0

    if GetWidgetValue(Solo01) > 0.5 then SoloStatus = 1.0 end
    if GetWidgetValue(Solo02) > 0.5 then SoloStatus = 1.0 end
    if GetWidgetValue(Solo03) > 0.5 then SoloStatus = 1.0 end
    if GetWidgetValue(Solo04) > 0.5 then SoloStatus = 1.0 end
    if GetWidgetValue(Solo05) > 0.5 then SoloStatus = 1.0 end
    if GetWidgetValue(Solo06) > 0.5 then SoloStatus = 1.0 end
    if GetWidgetValue(Solo07) > 0.5 then SoloStatus = 1.0 end
    if GetWidgetValue(Solo08) > 0.5 then SoloStatus = 1.0 end
    if GetWidgetValue(Solo09) > 0.5 then SoloStatus = 1.0 end
    if GetWidgetValue(Solo10) > 0.5 then SoloStatus = 1.0 end
End

Function fadeVolume(targetVolumeWidget: Widget, targetValue: double)
    Var
        currentVolume, step, i : double

    currentVolume = GetWidgetValue(targetVolumeWidget)
    step = (targetValue - currentVolume) / 100

    For i = 0; i < 100; i = i + 1 Do
        currentVolume = currentVolume + step
        SetWidgetValue(targetVolumeWidget, currentVolume)
    End
End

On WidgetValueChanged(newValue : double) from Solo01, Solo02, Solo03, Solo04, Solo05, Solo06, Solo07, Solo08, Solo09, Solo10
    isAnySoloActive() // Update the SoloStatus variable

    If SoloStatus > 0.5 Then
        if GetWidgetValue(Solo01) > 0.5 then fadeVolume(DummyVolume01, 1.0) else fadeVolume(DummyVolume01, 0.0) end
        if GetWidgetValue(Solo02) > 0.5 then fadeVolume(DummyVolume02, 1.0) else fadeVolume(DummyVolume02, 0.0) end
        if GetWidgetValue(Solo03) > 0.5 then fadeVolume(DummyVolume03, 1.0) else fadeVolume(DummyVolume03, 0.0) end
        if GetWidgetValue(Solo04) > 0.5 then fadeVolume(DummyVolume04, 1.0) else fadeVolume(DummyVolume04, 0.0) end
        if GetWidgetValue(Solo05) > 0.5 then fadeVolume(DummyVolume05, 1.0) else fadeVolume(DummyVolume05, 0.0) end
        if GetWidgetValue(Solo06) > 0.5 then fadeVolume(DummyVolume06, 1.0) else fadeVolume(DummyVolume06, 0.0) end
        if GetWidgetValue(Solo07) > 0.5 then fadeVolume(DummyVolume07, 1.0) else fadeVolume(DummyVolume07, 0.0) end
        if GetWidgetValue(Solo08) > 0.5 then fadeVolume(DummyVolume08, 1.0) else fadeVolume(DummyVolume08, 0.0) end
        if GetWidgetValue(Solo09) > 0.5 then fadeVolume(DummyVolume09, 1.0) else fadeVolume(DummyVolume09, 0.0) end
        if GetWidgetValue(Solo10) > 0.5 then fadeVolume(DummyVolume10, 1.0) else fadeVolume(DummyVolume10, 0.0) end
    Else
        fadeVolume(DummyVolume01, 1.0)
        fadeVolume(DummyVolume02, 1.0)
        fadeVolume(DummyVolume03, 1.0)
        fadeVolume(DummyVolume04, 1.0)
        fadeVolume(DummyVolume05, 1.0)
        fadeVolume(DummyVolume06, 1.0)
        fadeVolume(DummyVolume07, 1.0)
        fadeVolume(DummyVolume08, 1.0)
        fadeVolume(DummyVolume09, 1.0)
        fadeVolume(DummyVolume10, 1.0)
    End
End

The first Part is another function for transposing, what not belongs to the described functionality.

And, as I understand, you want to use the auto fader that @schamass wrote?

I can create a sample, but right now I’m going to bed and tomorrow I’m spending time with my wife and kids, so it might take a while

1 Like

You got it. But there is no hurry. I gave to work now also and have some other tasks, so I can work aon that further in some days. But It would be very kind to help me. Thank you.

I’m also at work right now, so i can’t do any coding either - but having a brief look at your script, the first thing i noticed: Using widget arrays would make your code much more compact (and also easier to maintain, in case you would have to increase or reduce the number of widgets).

Would you mind to also share the corresponding gig file?
This would make it easier to check if something else had to be done to make everything work. :slight_smile:

Yes, here is the corresponding gig-File.
Test Solo Fade.gig (1.6 MB)

I think I have an example that works. I hope it suits your purpose.

SoloButtons.gig (278.2 KB)

Well, thank you. The fadeing is like I wanted it. But despite the buttons are solo buttons I wanted, that more than one solo button can be active at the same time, like in my script/gig-file.

I think I can try to do that tomorrow

this would be very kind. Thank you very much.

Maybe this is more what you intent?

SoloButtonsV2.gig (290.8 KB)

1 Like
Yes, thats exactly what I tried. Thank you very very much.

You’re welcome :+1: