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.

External C++ communication

The global cable is the preferred way of communicating values back from your C++ node. Take a look here for a description on how to use it.

Class methods

connectToGlobalModulator

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

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. Edit on GitHub

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



deregisterCallback

Deregisteres a callback from the cable. Edit on GitHub

GlobalCable.deregisterCallback(var callbackFunction)



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 Edit on GitHub

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 (by using either the SyncNotification or AsyncNotification constants). The latter will filter out repetitions and will be called on the UI thread at the next timer interval:

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.

If you're using a synchronous callback then the function you pass in must be an inline function as this might be executed on the audio thread and normal functions are not realtime safe.

setRange

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

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. Edit on GitHub

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. Edit on GitHub

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. Edit on GitHub

GlobalCable.setValueNormalised(double normalisedInput)