Effect
Get access to an Effect
's script functions with Synth.getEffect()
.
const var Delay1 = Synth.getEffect("Delay1");
Class methods
addGlobalModulator
Adds a and connects a receiver modulator for the given global modulator. Edit on GitHub
Effect.addGlobalModulator(var chainIndex, var globalMod, String modName)
addModulator
Adds a modulator to the given chain and returns a reference. Edit on GitHub
Effect.addModulator(var chainIndex, var typeName, var modName)
addStaticGlobalModulator
Adds and connects a receiving static time variant modulator for the given global modulator. Edit on GitHub
Effect.addStaticGlobalModulator(var chainIndex, var timeVariantMod, String modName)
exists
Checks if the Object exists and prints a error message on the console if not. Edit on GitHub
Effect.exists()
exportScriptControls
Export the control values (without the script). Edit on GitHub
Effect.exportScriptControls()
exportState
Exports the state as base64 string. Edit on GitHub
Effect.exportState()
getAttribute
Returns the attribute with the given index. Edit on GitHub
Effect.getAttribute(int index)
getAttributeId
Returns the ID of the attribute with the given index. Edit on GitHub
Effect.getAttributeId(int index)
getAttributeIndex
Returns the index of the attribute with the given ID. Edit on GitHub
Effect.getAttributeIndex(String id)
getCurrentLevel
Returns the current peak level for the given channel. Edit on GitHub
Effect.getCurrentLevel(bool leftChannel)
getDraggableFilterData
Returns the draggable filter data object (if applicable).
Effect.getDraggableFilterData()
This returns a JSON with the current draggable filter data information. You can modify this JSON object and send it back to setDraggableFilterData()
to update the properties for the given effect.
getId
Returns the ID of the effect. Edit on GitHub
Effect.getId()
getModulatorChain
Returns the Modulator chain with the given index. Edit on GitHub
Effect.getModulatorChain(var chainIndex)
getNumAttributes
Returns the number of attributes. Edit on GitHub
Effect.getNumAttributes()
isBypassed
Checks if the effect is bypassed. Edit on GitHub
Effect.isBypassed()
isSuspended
Checks if the effect is currently suspended (= no audio running through it and suspension enabled). Edit on GitHub
Effect.isSuspended()
restoreScriptControls
Restores the control values for scripts (without recompiling). Edit on GitHub
Effect.restoreScriptControls(String base64Controls)
restoreState
Restores the state from a base64 string. Edit on GitHub
Effect.restoreState(String base64State)
setAttribute
Changes one of the Parameter. Look in the manual for the index numbers of each effect. Edit on GitHub
Effect.setAttribute(int parameterIndex, float newValue)
setBypassed
Bypasses the effect. Edit on GitHub
Effect.setBypassed(bool shouldBeBypassed)
setDraggableFilterData
Sets the draggable filter data object (if applicable).
Effect.setDraggableFilterData(var filterData)
Until HISE 5.0, the only way to use the DraggableFilterPanel
was by connecting it to a Parametric EQ
module.
This has changed now and the panel now supports connections to these types:
However, these new connection types cannot deduce the parameter indexes for each filter band parameter automatically, so if you start dragging around the filter drag handles, HISE has no way of knowing whether to change the parameter index 5 or 17 or 2 accordingly - with the parametric EQ it can simply be calculated with the formula:
parameterIndex = 0 + bandIndex * BandOffset + bandParameterIndex
P = O + I * N + B
(we'll refer to the variable names P, O, I, N and B
down below). So for all the other module types, you will need to provide additional information about the properties of the filter module that will be picked up by the draggable filter panel to adjust it's behaviour.
Note that these properties are not persistently stored in the module tree, so you have to call this function in the onInit callback for each module.
These properties are available:
Property | Type | Default | Description |
NumFilterBands | int | 1 | The fixed amount of filter bands of this module. Note that this is a hard limitation and the only module that allows a dynamic amount of filter bands remains the Parametric EQ. |
FilterDataSlot | int | 0 | the slot of the filter coefficients. This defaults to zero and you can assign all your filter nodes to the same coefficient object, but if you have a more complex node where the filter is only a part of the signal chain, you can define which filter coefficient slot it should use for the draggable display. |
FirstBandOffset | int | 0 | the parameterOffset for the first band (O
in the formula above). This can be used if your filter module has parameters that come before the range of filter parameters and will be used as constant offset in the formula that calculates the filter band parameter (see below). |
TypeList | Array | see below | This is a list of strings that define the type names as they will show up in the context menu when you right click on a filter drag handle. |
ParameterOrder | Array | see below | This is a list of (predefined) string that will define in what order the filter parameters are defined. The length of this list will be N
in the formula above and it will calculate the bandParameterIndex B
from the index of the parameter name within that list. |
FFTDisplayBufferIndex | int | -1 | This is the index of the display buffer that will be used to show the spectrum analyser. If you set this to anything other than -1, it must point to a external display buffer that is connected to a analyse.fft node. |
DragActions | Array | see below | This is a list of predefined strings that define the mouse behaviour and what parameter you want to control. Eg, by default the y-axis is assigned to the gain parameter, but in a synth filter context you might want to reroute this to the resonance of the filter and this is the place to do so. |
If you define this JSON object and pass it to this method, HISE has all information it needs to calculate the band parameter index from the attribute index of the module parameter:
O = FirstBandOffset
N = TypeList.length
B = TypeList.indexOf(BAND_PARAMETER)
parameterIndex = FirstBandOffset + bandIndex * TypeList.length + TypeList.indexOf(BAND_PARAMETER)
Here is a list of all default values as JSON (that is also returned by Effect.getDraggableFilterData() )
{
NumFilterBands: 1,
FilterDataSlot: 0,
FirstBandOffset: 0,
TypeList: [
"Low Pass",
"High Pass",
"Low Shelf",
"High Shelf",
"Peak"
],
ParameterOrder: [
"Gain",
"Freq",
"Q",
"Enabled",
"Type"
],
FFTDisplayBufferIndex: -1,
DragActions: {
DragX: "Freq",
DragY: "Gain",
ShiftDrag: "Q",
DoubleClick: "Enabled",
RightClick: ""
}
};