1
2 import Live
3 from SubjectSlot import SubjectEvent
4 from InputControlElement import InputControlElement, MIDI_CC_TYPE, InputSignal
5
7 raise NotImplementedError
8
9
10 _map_modes = map_modes = Live.MidiMap.MapMode
11 ENCODER_VALUE_NORMALIZER = {_map_modes.relative_smooth_two_compliment: lambda v: v if v <= 64 else v - 128,
12 _map_modes.relative_smooth_signed_bit: lambda v: v if v <= 64 else 64 - v}
13
15 """
16 Class representing a continuous control on the controller.
17
18 The normalized value notifies a delta in the range:
19 (-encoder_sensitivity, +encoder_sensitvity)
20 """
21 __subject_events__ = (SubjectEvent(name='normalized_value', signal=InputSignal),)
22 encoder_sensitivity = 1.0
23
24 - def __init__(self, msg_type, channel, identifier, map_mode, encoder_sensitivity = None, *a, **k):
30
34
36 raise value >= 0 and value < 128 or AssertionError
37 return self.__value_normalizer(value)
38
44