Encoder Event
- About Encoder Event
- Reference Manual Entry
The Encoder Event is a UI Event, which means it triggers on user interaction. Specifically when the user turns the encoder, each click on a 'clicky' encoder equals to one trigger of the Encoder Event.
Encoder Events are useful in many ways, since Encoders are designed to be infinite in nature, therefore they can work in a realative way, with adding to or subtracting from a value. Or they can take the same role as Potentiometers as well.
Encoders have a Velocity setting to them accessible in their Encoder Mode Block. This setting allows for introducing a scaling element when the Encoders are quickly turned (a lot of Encoder Events happening in succession). This makes the Encoders skip values when turned rapidly, so that the user can introduce big jumps in values when needed.
Encoder Button
button_number
- shortname: bnu
- How:
self:button_number()
orself:button_number(number)
- number: signed integer
- What: This function when given no parameter, returns the # number of the control element. These numbers are from the top left, read left to right, top to bottom
0
to15
OR in the case of the PBF4 from0
to11
. When this function is given a parameter, it will set the # number of the control element to thenumber
given. - Example:
button_value
- shortname: bva
- How:
self:button_value()
orself:button_value(value)
- value: integer, ranging 0...127
- What: This function returns the value associated to the button. By default, this value is
127
when the button is pressed down and0
when released. When this function is given a parameter, it will set the value associated with the button state according to the parameter given. When using other types of button modes, described later in this chapter, the button values are evenly spread across the steps: eg. spilt 3 was would be values0
63
127
split 4-way would be0
47
95
and127
. - Example: Inputting the code
self:button_value(127)
will make all button press and button release event return the value127
.
button_min
- shortname: bmi
- How:
self:button_min()
orself:button_min(value)
- value: integer, ranging 0...127
- What: This function returns the minimum value of the "released" button state. This is
0
by default. When given a parameter, this function changes the minimum value of the button state according to thevalue
given as parameter. - Example: The code
self:button_min(20)
will set the value of the button to20
when released.
button_max
- shortname: bma
- How:
self:button_max()
orself:button_max(value)
- value: integer, ranging 0...127
- What: This function returns the maximum value of the "pressed down" button state. This is
127
by default. When given a parameter, this function changes the maximum value of the button state according to thevalue
given as parameter. - Example: The code
self:button_max(110)
will set the value of the button to110
when pressed down. This can be useful to set easy to use values for a switch, likeself:button_max(1)
will make it so that there are only two values this button can send out0
and1
.
button_mode
- shortname: bmo
- How:
self:button_mode()
orself:button_mode(mode)
- mode: integer, ranging 0...127
- What: This function returns the value of the button mode. This is
0
by default. Button mode means how many 'steps' the button has between its maximum and minimum value. For example when the function is used to set this value like this:self:button_mode(mode)
the resolution parameter will govern the number of steps. - Example: The code
self:button_mode(2)
will make the button a 3-step switch. The three states will be0
,63
and127
.
button_elapsed_time
- shortname: bel
- How:
self:button_elapsed_time()
- What: This function returns the time elapsed since the last trigger in frames.
- Example:
button_state
- shortname: bst
- How:
self:button_state()
- What: This function will return the "state" of the control element. In case of a button this is either "pressed down"
127
OR "released"0
. These values independent from value variable of the control element. This means that the button_state() function will always return the values associated with the "pressed" or "released" states, independently from any kind of alterations to the button value functions, such as changing the max or min values. - Example:
Encoder Rotation
encoder_number
- shortname: enu
- How:
self:encoder_number()
orself:encoder_number(number)
- number: signed integer
- What: This function, when given no parameter, returns the # number of the control element. These numbers are from the top left, read left to right, top to bottom
0
to15
. When this function is given a parameter, it will set the # number of the control element to thenumber
given. - Example:
encoder_value
- shortname: eva
- How:
self:encoder_value()
orself:encoder_value(value)
- value: integer, ranging 0...127
- What: This function returns the value of the encoder state. By default, this value is
0
when the encoder is turned and tops out at127
. When this function is given a parameter, it will set the value associated with the encoder state according to the parameter given and will output thatvalue
on each trigger. - Example:
encoder_min
- shortname: emi
- How:
self:encoder_min()
orself:encoder_min(value)
- value: integer, ranging 0...127
- What: This function returns the minimum value configured to the encoder minimum state. This is
0
by default. When given a parameter, this function changes the minimum value of the encoder state according to thevalue
given as parameter. - Example: The code
self:encoder_min(20)
will set the starting value of the encoder to20
when rotated.
encoder_max
- shortname: ema
- How:
self:encoder_max()
orself:encoder_max(value)
- value: integer, ranging 0...127
- What: This function returns the maximum value configured to the encoder maximum state. This is
127
by default. When given a parameter, this function changes the maximum value of the encoder state according to thevalue
given as parameter. - Example: The code
self:encoder_max(110)
will set the end value of the encoder to110
when turned.
encoder_mode
- shortname: emo
- How:
self:encoder_mode()
orself:encoder_mode(mode)
- resolution: integer, ranging 0...1
- What: This function returns the value of the encoder mode. This is
0
or "absolute mode" by default. When function is given1
as a value, it will change the encoder to "relative mode binary offset". In this mode turning the encoder 'backwards' or counterclockwise will always result in the value63
and turning it 'forwards' or clockwise will always result in the value65
. When the function is given2
as a value, it will change the encoder to "relative mode 2's comp". In this mode turning the encoder 'backwards' or counterclockwise will always result in the value127
and turning it 'forwards' or clockwise will always result in the value1
. - Example: The code
self:encoder_mode(1)
will change the encoder into relative mode.
encoder_velocity
- shortname: ev0
- How:
self:encoder_velocity()
orself:encoder_velocity(velocity)
- velocity: integer, ranging 0...100
- What: This function returns the value of the encoder velocity parameter. This is
100
by default. When the function is given a value for thevelocity
parameter, it will set the encoder velocity to that value. Velocity increases the steps the encoder value increases on each tick, depending on the speed of rotation. Setting thevelocity
parameter to0
turns off encoder velocity completely. - Example: The code
self:encoder_velocity(0)
will turn off the velocity increase function of the encoder. In this case turning the encoder by one tick, will increase the value of the encoder by 1.
encoder_elapsed_time
- shortname: eel
- How:
self:encoder_elapsed_time()
- What: This function returns the time elapsed since the last trigger in frames.
- Example:
encoder_state
- shortname: est
- How:
self:encoder_state()
- What: This function will return the "state" of the control element.
- Example: