Switching widget functionality

I am using a midi controller keyboard with nine sliders which i typically use for Hammond sliders.

However, i also would like to use them as volume sliders, ie to connect them to the volume of an audio mixer, or other functions.

Is there a way to press a button/knob for example, to switch between using the sliders for the Hammond sliders or volume sliders?

One workaround would be to duplicate a rackspace but that would cost a lot of rackspaces. Maybe you have better solutions?

I assume the controller doesn’t support multiple presets like, say, the icon I Controller.

Without that, probably the only way to do this is to use a GigScript to remap the incoming CC numbers to other CC numbers on demand.

1 Like

I made an example for a rackspace script with three white and three black faders.
Depending on the postion of the “Destination switch”, either the white or the black faders will react on
incoming CC# messages on numbers 20, 21, 22 (change the numbers in the script to your needs).
That might be something you could adapt and expand for your rackspace, just add more items to the arrays and the “Select” statement.

destination switch

switch destination.gig (98.3 KB)

This is the code i used:

var
MIDI_in : MidiInBlock
swt_changeDest : widget //switch destination of CC#
fdr_w1, fdr_w2, fdr_w3 : widget // wihte faders
fdr_s1, fdr_s2, fdr_s3 : widget // black faders

ccNrs : integer array = [20, 21, 22] // incoming cc# for the three faders

faders_white : widget array = [fdr_w1, fdr_w2, fdr_w3] // array for white faders
faders_black : widget array = [fdr_s1, fdr_s2, fdr_s3] // array for black faders

// User function to move either the black or white faders, depending on the destination-switch position
function MoveFader (index : integer, ccNr : integer, ccVal : integer)
    If GetWidgetValue(swt_changeDest) >0.6 Then
        SetWidgetValue (faders_white[index], MidiToParam(ccVal))
    Else
        SetWidgetValue (faders_black[index], MidiToParam(ccVal))
    End
    SendNow (MIDI_in, MakeControlChangeMessage(ccNr, ccVal))
End

//Called when a CC message is received at some MidiIn block
On ControlChangeEvent(ccMsg : ControlChangeMessage) from MIDI_in
var
ccNr : integer = GetCCNumber(ccMsg)
ccVal : integer = GetCCValue(ccMsg)

    Select
        ccNr == ccNrs[0] do MoveFader (0, ccNr, ccVal) //CC# array item 1
        ccNr == ccNrs[1] do MoveFader (1, ccNr, ccVal) //CC# array item 2
        ccNr == ccNrs[2] do MoveFader (2, ccNr, ccVal) //CC# array item 3
        // as many as you need

        //Optionally include this for when none of the above matched
        True do SendNow (MIDI_in, MakeControlChangeMessage(ccNr, ccVal))
    End
End
5 Likes

Yes i also could use that, but I prefer to not change this as I use the same buttons to iterate through the songs.

Thanks for the script… I knew it would be possible.
I will use this script as base for mine.

1 Like

I am thinking and it would be nice to also set the slider widgets on and off. Ie when the Hammond sliders are active to hide the other set of slider widgets and vice versa.

This way i can place them on the same locations to save space on a rackspace.

However in https://www.gigperformer.com/downloads/GPScript/SystemFunctionList.html I cannot find a function to hide or show a widget.

Edit: I found it SetWidgetHideOnPresentation

I improved the rackspace/script to be working with a full 9-set of drawbars and faders while hiding the “uncontrolled” group of widgets… :sunglasses: :nerd_face:

Description:
A Rackspce Script is used to have a single set of hardware controllers (say, faders) move two diffrent groups of widgets, dependent on the position of a “destination switch” widget.
The script will send the incoming CC# messages to either the group of drawbars or the group of faders, while at the same time, the widgets that are not to be controlled will be hidden, so you will only see (and control) one single type of widgets at a time (drawbars or faders).

destination switch drawbars-faders

switch destination drawbars-faders.gig (292.6 KB)

The script code for the improved version:

var
MIDI_in : MidiInBlock
swt_changeDest : widget //switch destination of CC#
fdr1, fdr2, fdr3, fdr4, fdr5, fdr6, fdr7, fdr8, fdr9 : widget // faders
drwb1, drwb2,drwb3, drwb4, drwb5, drwb6, drwb7, drwb8, drwb9 : widget // drawbars

ccNrs : integer array = [20, 21, 22, 23, 24, 25, 26, 27, 28] // incoming cc# for the nine faders/drawbars

faders_arr : widget array = [fdr1, fdr2, fdr3, fdr4, fdr5, fdr6, fdr7, fdr8, fdr9] // array for white faders
drawbars_arr : widget array = [drwb1, drwb2,drwb3, drwb4, drwb5, drwb6, drwb7, drwb8, drwb9] // array for black faders

// User function to move either the black or white faders, depending on the destination-switch position
function MoveFader (index : integer, ccNr : integer, ccVal : integer)
    If GetWidgetValue(swt_changeDest) >0.6 Then
        SetWidgetValue (faders_arr[index], MidiToParam(ccVal))
    Else
        SetWidgetValue (drawbars_arr[index], MidiToParam(ccVal))
    End
    SendNow (MIDI_in, MakeControlChangeMessage(ccNr, ccVal))
End

// user function to hide/unhide a group of faders
function HideThem (groupToHide : widget array, groupToShow : widget array)
var index : integer
    For index = 0; index< Size(groupToHide); index = index +1 Do
        SetWidgetHideOnPresentation(groupToHide[index], true)
        SetWidgetHideOnPresentation(groupToShow[index], false)
    end
End

//Called when a CC message is received at some MidiIn block
On ControlChangeEvent(ccMsg : ControlChangeMessage) from MIDI_in
var
ccNr : integer = GetCCNumber(ccMsg)
ccVal : integer = GetCCValue(ccMsg)

    Select
        ccNr == ccNrs[0] do MoveFader (0, ccNr, ccVal) //CC# array item 1
        ccNr == ccNrs[1] do MoveFader (1, ccNr, ccVal) //CC# array item 2
        ccNr == ccNrs[2] do MoveFader (2, ccNr, ccVal) //CC# array item 3
        ccNr == ccNrs[3] do MoveFader (3, ccNr, ccVal) //CC# array item 4
        ccNr == ccNrs[4] do MoveFader (4, ccNr, ccVal) //CC# array item 5
        ccNr == ccNrs[5] do MoveFader (5, ccNr, ccVal) //CC# array item 6
        ccNr == ccNrs[6] do MoveFader (6, ccNr, ccVal) //CC# array item 7
        ccNr == ccNrs[7] do MoveFader (7, ccNr, ccVal) //CC# array item 8
        ccNr == ccNrs[8] do MoveFader (8, ccNr, ccVal) //CC# array item 9
        // as many as you need

        //Optionally include this for when none of the above matched
        True do SendNow (MIDI_in, MakeControlChangeMessage(ccNr, ccVal))
    End
End

// use "destination switch" to trigger the hide/unhide user function
On WidgetValueChanged (swtVal : double) from swt_changeDest 
    If swtVal>0.6 then
        HideThem (drawbars_arr, faders_arr) // hide drawbars, show faders
    Else
        HideThem (faders_arr, drawbars_arr) // hide faders, show drawbars
    End
End
7 Likes

This seems much more complicated than a gigscript. For example - consider the following short gigscript

Var
   Max1 : MidiInDevice  // I'm using Max to emulate CC messages between 20 and 28 (9 values)
   remap : boolean = false  // When true, incoming CC messages will be remapped
   
   remapOffset : integer = 20 // In this case, 20->40, 21->41, 22->42, etc
   
//Respond to an incoming message between 20 and 28
On ControlChangeEvent(m : ControlChangeMessage) Matching [20..28] from Max1
   If remap
      then InjectMidiEvent("from Max 1", m.WithCCNumber(m.GetCCNumber() + remapOffset))     // Modify with the offset    
      else InjectMidiEvent("from Max 1", m) // Just send the original message
   End     
End

// Any message coming in on CC 80 will toggle remapping
On ControlChangeEvent(m : ControlChangeMessage) Matching 80 from Max1
   remap = not remap
end   

With this approach, you can now just define your widgets normally so create a widget that respond to 20 (say) and another one that responds to 40 and only one of them will be triggered

This way you could define 9 sliders to associate with CC 20-28 and another 9 sliders to associate with 40-48 and then depending on whether remapping is enabled, you’ll get the appropriate widget changing.

3 Likes

Nice one, but you’d pay for the simplicity with a doubled number of used CC#

2 Likes

Thanks for both options… I will play with this for the following weeks what works best.

Probably a combination of both.

1 Like

I added this gig file to the “official” repository :slight_smile:
Link: [Gig] Drawbars and faders switcher

4 Likes

Thanks for adding it to the repository.

  1. I would argue that that’s no different than having twice the number of physical CC sliders
  2. This approach lets you use widgets normally, without rackspace scripting (in every rackspace), so I think that’s simpler
  3. Instead of changing the CC numbers, one could change the MIDI channel number - it’s unlikely one would run out of CC values
2 Likes