Osc input: float value is in between preargs and rest of message

Hi there,

I created a fader with following preargs:

[
"FaderMaster",
3
]

typeargs: sif

--> everything working correct, input float is moving the fader.

Here comes the problem:
Another message contains additional information after the float value:

(DEBUG, OSC) In: {
address: '/13.13.1.6.1',
args: [ 'FaderMaster', 3, 48.193359375, 'Best Sequence 1 first cue' ]

Do you have an idea how to get this working as well?

Sliders can't handle variable values followed by extraneous arguments, you'll have to process the arguments using a script or a custom module.

With a script widget (docs)

Set the script widget's preArgs to ["FaderMaster", 3] and onValue as follows:

// value: [48.193359375, 'Best Sequence 1 first cue']
if (Array.isArray(value) && value.length === 2) {
  set('fader_id', value[0])
}

With a custom module (docs)

module.exports = {
  oscInFilter: function(data) {
    var {host, port, address, args} = data

    if (address === '/fader_address') {
      if (args.length === 4) {
        // remove last argument and pass it to the client / widgets
        receive(address, args.slice(0, 3))
        return // bypass original message
      }
    }

    return data
  }
}

These are simple examples that you'll need to adapt of course (you might for instance want to use the last argument instead of simply ignoring it).

1 Like

Thank you for the extremely quick response :slight_smile:
The 1st example is working for me, 2nd remains to be tested.
Did I get you right, the "original" fader widget cannot contain the script mentioned above in the scripting tab, it has to be a separate one?

Did I get you right, the "original" fader widget cannot contain the script mentioned above in the scripting tab, it has to be a separate one?

Yes