HISE Docs

Global Cable


Global cables can be used in order to send values across HISE projects and even from / to OSC sources. If want to attach scripting callbacks to value changes of a global cable or send values from a script, this object will come in handy.

In order to use it, just create a reference to the global routing manager using Engine.getGlobalRoutingManager() , then call GlobalRoutingManager.getCable(id) with a unique ID for the given cable. Then you can send values through it, attach synchronous and asynchronous callbacks, add some range conversion tools etc.

Using a cable as OSC address

If you want to use a cable as OSC address that can send and receive values from external applications, you just need to prepend / before the id, so any cable that has an ID like this:

/some_osc_id

will automatically be used as OSC address as soon as you start using the global routing system as OSC server.

Class methods

connectToGlobalModulator

Connects the cable to a global LFO modulation output as source.

GlobalCable.connectToGlobalModulator( String lfoId, bool addToMod)



connectToMacroControl

Connects the cable to a macro control.

GlobalCable.connectToMacroControl(int macroIndex, bool macroIsTarget, bool filterRepetitions)


This function connects the macro control system and the global routing system by letting you send / receive value changes from macro controls. In order to use it, just call this method to assign any cable to a macro index.

Parameter Values Description
macroIndex int from 0 to 7 the macro control that you want to connect to the global cable
macroIsTarget bool whether the macro control should control the global cable or vice versa (obviously this can't be bidirectional to prevent feedback loops)
filterRepetitions bool whether the cable should filter out repetitions of the same value. This might vastly decrease the CPU usage if you're modulating the cable value and don't want to send a new macro value each block.


connectToModuleParameter

Connects the cable to a module parameter using a JSON object for defining the range.

GlobalCable.connectToModuleParameter( String processorId, var parameterIndexOrId, var targetObject)



getValue

Returns the value (converted to the input range).

GlobalCable.getValue()


This function will return the current value of the cable after converting it using the range you defined with one of the range methods. If you need the normalised value, check out the getValueNormalised() function.

getValueNormalised

Returns the normalised value between 0...1

GlobalCable.getValueNormalised()



registerCallback

Registers a function that will be executed whenever a value is sent through the cable.

GlobalCable.registerCallback(var callbackFunction, var synchronous)


This function will register a callable object (either a inline function, a function or a broadcaster) to the cable. It expects a single argument that will contain the value of the cable. You can either register it as synchronous callback or as asynchronous callback. The latter will filter out repetitions and will be called on the UI thread.

Be aware that if you've set a range then the value that will be passed into the callback will be converted from the normalised 0...1 range to whatever range you need.

setRange

Set the input range using a min and max value (no steps / no skew factor).

GlobalCable.setRange(double min, double max)



setRangeWithSkew

Set the input range using a min and max value and a mid point for skewing the range.

GlobalCable.setRangeWithSkew(double min, double max, double midPoint)



setRangeWithStep

Set the input range using a min and max value as well as a step size.

GlobalCable.setRangeWithStep(double min, double max, double stepSize)



setValue

Sends the value to all targets (after converting it from the input range.

GlobalCable.setValue(double inputWithinRange)


This will convert the value using the supplied range and send it through the cable.

Be aware that calling this method will not trigger any scripting callbacks attached to itself.

setValueNormalised

Sends the normalised value to all targets.

GlobalCable.setValueNormalised(double normalisedInput)