-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for S-Series MK2 speed-sensitive knobs #20
Changes from 1 commit
f585f63
3eb103c
7a91a03
9094dd1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -418,7 +418,7 @@ def OnDirtyMixerTrack(self, index): | |
def OnUpdateMeters(self): # Intended to be declared by child | ||
raise NotImplementedError() | ||
|
||
def adjustMixer(self, knob: int, dataType: str, action: str, selectedTrack: int): | ||
def adjustMixer(self, knob: int, dataType: str, action: str, selectedTrack: int, sensitivity: float = None): | ||
""" Dynamically maps the physical knob to the right mixer track depending on the track group the selected track belongs to, and adjusts the parameter. | ||
### Parameters | ||
|
||
|
@@ -436,23 +436,33 @@ def adjustMixer(self, knob: int, dataType: str, action: str, selectedTrack: int) | |
# Multiplies the trackGroup to 8 to get the index of the first track of that group | ||
trackFirst = trackGroup * 8 | ||
|
||
# If you receive a sensitivity value, set it to a controllable value, else default to 1 | ||
if (sensitivity): | ||
sensitivity = sensitivity / 15 | ||
|
||
# When decreasing the mixer knob, the amount that it changes is dramatically different than increasing. | ||
if (action == "DECREASE"): | ||
sensitivity = sensitivity / 10 | ||
else: | ||
sensitivity = 1 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to do any of this to normalize the value. Try first with the suggestion I wrote in my review and tweak the logarithmic function before falling back the implementation to a conditional block again. |
||
if (trackGroup == 15) and (knob == 6 or knob == 7): # Control 15th group exception | ||
return | ||
|
||
else: | ||
if dataType == "VOLUME": | ||
if action == "INCREASE": | ||
mixer.setTrackVolume(trackFirst + knob, mixer.getTrackVolume(trackFirst + knob) + config.KNOB_INCREMENTS_VOL) | ||
mixer.setTrackVolume(trackFirst + knob, mixer.getTrackVolume(trackFirst + knob) + (config.KNOB_INCREMENTS_VOL * sensitivity)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Offset should be |
||
|
||
elif action == "DECREASE": | ||
mixer.setTrackVolume(trackFirst + knob, mixer.getTrackVolume(trackFirst + knob) - config.KNOB_INCREMENTS_VOL) | ||
mixer.setTrackVolume(trackFirst + knob, mixer.getTrackVolume(trackFirst + knob) - (config.KNOB_INCREMENTS_VOL * sensitivity)) | ||
|
||
elif dataType == "PAN": | ||
if action == "INCREASE": | ||
mixer.setTrackPan(trackFirst + knob, mixer.getTrackPan(trackFirst + knob) + config.KNOB_INCREMENTS_PAN) | ||
mixer.setTrackPan(trackFirst + knob, mixer.getTrackPan(trackFirst + knob) + (config.KNOB_INCREMENTS_PAN * sensitivity)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Offset should be |
||
|
||
elif action == "DECREASE": | ||
mixer.setTrackPan(trackFirst + knob, mixer.getTrackPan(trackFirst + knob) - config.KNOB_INCREMENTS_PAN) | ||
mixer.setTrackPan(trackFirst + knob, mixer.getTrackPan(trackFirst + knob) - (config.KNOB_INCREMENTS_PAN * sensitivity)) | ||
|
||
def getUndoStatus(self): | ||
""" Helper function to set the light on the UNDO button. """ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sensitivity: float = None
should bespeed: int
instead. Also, please comment the parameter in the docstring of the function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed 9094dd1, which should resolve this. Let me know if I can elaborate more on the description I put.