ignore_controller()
Drops the given MIDI control change event and thus prevents the supplied event to be further processed by the sampler. You can use this function i.e. to filter out MIDI control change events, before they are causing any sound to be changed.
The argument this function takes is optional. If you omit passing an
argument to this function, then the controller event ID will be used that
caused this current controller
event handler to be executed
(which is $EVENT_ID
).
Dropping control change events with this function only succeeds if the
event just "recently" occurred. That effectively means you should drop
the control change event in the controller
event handler
before any wait()
calls, and before entering any loops that may
execute your script for a very long time. Because in both cases the
sampler may suspend your script for a certain amount of time and once
your script got resumed, the respective control change event may already
have entered the sampler's regular event processing chain and thus can no
longer be dropped.
With NKSP you can also use ignore_event()
to drop control
change events. So ignore_controller()
merely exists due to
compatibility reasons with KSP. However when you already know that the
event to be dropped is a control change event, then it is recommended to
actually call ignore_controller()
instead of
ignore_event()
.
Function Prototype
ignore_controller([event-id])
Arguments
Argument Name | Data Type | Description |
---|---|---|
event-id |
Event ID Number | Event ID of the MIDI control change event to be dropped. [optional, default: ID of the event handler's event] |
Return Value
None.
Examples
The following example implements a simple MIDI controller filter. It causes all MIDI volume control change events (MIDI CC#7) to be dropped.
- on init
- { MIDI controller number for MIDI "volume change" events }
- declare const $volumeCC := 7
- end on
- on controller
- if ($CC_NUM = $volumeCC)
- { $EVENT_ID is a built-in variable which always reflects the ID of the event which caused the execution of this specific event handler instance, i.e. here it reflects the respective MIDI control change event }
- ignore_controller($EVENT_ID)
- end if
- end on
Since you are almost always passing $EVENT_ID
to ignore_controller()
,
you can also omit that optional argument with NKSP. So the following
would behave identical with the example above.
- on init
- { MIDI controller number for MIDI "volume change" events }
- declare const $volumeCC := 7
- end on
- on controller
- if ($CC_NUM = $volumeCC)
- ignore_controller()
- end if
- end on