Struggles with Scaling a Toggle Switch Widget

I must be an idiot. I am using GP4 on a Windows PC. I’ve read the relevant sections of the manual on widget control, and have done some Googling as well.

I conceptually understand how scaling for widgets works. I’m having trouble with the implementation. I have a Numa Compact 2x that I am using primarily as a controller for B3X. I am trying to scale the Percussion Fast/Slow switch on the Numa so B3X can use it. According to the GP4 MIDI monitor, pressing the button on the Numa sends CC23, either a value of 0 or 1. B3X wants to see 0 or 127 for that switch.

Prior to any editing, the toggle widget I’ve assigned indicates a scaled value of 0 or 0.8 when I press that button on the Numa. I’ve changed the max value for the widget to “127m” thinking that when CC23 = 1 comes in, the widget will send 127 to B3X. When I type “127m” in, the widget toggles. When I then press the switch on the Numa, the scaled value reverts back to either 0 or 0.8, effectively ignoring my max value modification of “127m”.

Do I need to enter the world of scripting to make this work?

Thanks for any help

Could you rather use host automation in B3X?

As far as I can tell, I can only change the CC # in B3x, not the actual values it responds to for that CC. I could be wrong, of course.

I have associated the Gig Performer toggle switch widget with the plugin parameter and associated the physical switch on the Numa to the Gig Performer widget. At least I believe I did.

This script will change the value of CC 23 coming from the defined Alias (In my case "Pedal) to 127 if the incoming value is 1. It should be set up as a Gig Script.

Var
m : MidiMessage
Pedal : MidiInDeviceAlias


On ControlChangeEvent(m : ControlChangeMessage) from Pedal
    If  m.GetCCValue() == 1 And m.GetCCNumber() == 23  Then 
        InjectMidiEventViaRigManager(Pedal,m.WithCCValue(127)) 
    Else 
        InjectMidiEventViaRigManager(Pedal, m.WithCCValue(m.GetCCValue()))
    End


End   

Other values or other CC numbers from that device should not be affect.

Steve

Thank you very much for this! I will try it out tonight.

What about this?

Var
m : MidiMessage
Pedal : MidiInDeviceAlias

On ControlChangeEvent(m : ControlChangeMessage) matching 23 from Pedal
        InjectMidiEventViaRigManager(Pedal,m.WithCCValue(GetCCValue(m)*127)) 
End   

Better still.

Using CC# to controll directly the B3X plugin is not the best idea.

This could suggest that you finally went for host automation. Does the GP switch widget you use control the plugin (B3X?) parameter properly? If not what happens?

Then, does you physical MIDI switch control the GP widget properly? If not what happens?

I don’t understand this — if the original CCValue is greater than 1 then you’re creating an invalid CC message as the new value will be greater than 127

It does’nt send value higher than 1

Maybe you should test for >=1 and then set it to 127
…just to be safe from surprises. :innocent:

1 Like

How about this?

Var
m : MidiMessage
Controller : MidiInDeviceAlias
value : Integer

On ControlChangeEvent(m : ControlChangeMessage) matching 23 from Controller
    If  m.GetCCValue() > 0 then value=127 else value = 0 ; End
    InjectMidiEventViaRigManager(Controller,m.WithCCValue(value))

End  

Steve

1 Like

Or even this :stuck_out_tongue_winking_eye::

Var Pedal : MidiInDeviceAlias

On ControlChangeEvent(m : ControlChangeMessage) matching 23 from Pedal
 InjectMidiEventViaRigManager(Pedal,m.WithCCValue(If GetCCValue(m)>0.5 Then 127 Else 0 End)) 
End
2 Likes

David-san,

I am using host automation. The GP switch widget does not control the plugin parameter properly, because the plugin wants to see a value of 0 or 127. The switch widget is sending 0 or 0.8.

No, the physical MIDI switch doesn’t control it properly either, because the physical switch sends a value of 0 or 1, where the plugin wants to see 0 or 127.

I will work to incorporate the script ideas and report back ASAP.

Thank you all, for your help!

Try This in a Rackspace Script. You will need to set up your Alias “Keyboard1” in Rig Manager and the Widget Handle “PercussionDecay” in you widget.


Var
   KeyBoard1 : MidiInBlock
   PercussionDecay : Widget

On ControlChangeEvent(m : ControlChangeMessage )  Matching 23 from KeyBoard1
Var x : Double
// This scales it to only 0 and 1 for both MIDI and the Parameter
  x= MidiToParamEx(m.GetCCValue(),0,1,1.0,0.0)
   SetWidgetValue(PercussionDecay, if x > 0.5 Then 0.0 Else  1.0 End)

Steve

@dhj , is there a way to set a Widget value within a Scriptlet? I couldn’t figure it out so I put it into a Rackspace Script.

Edit: and make sure you don’t have your plugin using the same CC # for something else. On my B-3X implementation CC23 was also set up as one of the drawbars so I had to change it. Maybe on VST3 this is not necessary however but I was using a VST2.

Use OSC messages.

Hi @pianopaul. Thanks! Can you point me to any examples?

Steve

Used this scriptlet code

var p1 : Parameter = 0.0
    mOSC : OSCMessage
    
// Called when a parameter value has changed
On ParameterValueChanged matching p1
 Print(p1)
 OSC_SetAddress(mOSC, "/KNOB/SetValue")
 OSC_ClearArgs(mOSC)
 OSC_AppendDoubleArg(mOSC, p1)
 OSC_SendSpecific(mOSC, "127.0.0.1", 8007)
End

In this case I set the OSC listening Port for GP to 8007

ScriptletOSC.gig (24.2 KB)

Neat trick, I will give it a try. I suppose you cannot read the widget value can you?

Maybe OSC_GetArgAsDouble(m: OSCMessage , index: Integer ) Returns Double?

Steve