Skip to content

Commit

Permalink
Improved Jog wheel
Browse files Browse the repository at this point in the history
- Fixed Jog wheel buggy on alternative sources
- Jog wheel now works on Tempo button
- Fixed weird characters on screen when using the jog wheel
- Automatically show & focus windows for the jog source you select
  • Loading branch information
bramdebouvere committed Feb 1, 2022
1 parent 1610908 commit af4bdb0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ FL Studio MIDI scripts for the Behringer X-Touch + extender(s) (Mackie Control U
## Differences with the official scripts
- Support for multiple extenders
- Improved knob resolution and acceleration
- Forces jog dial to use the playlist instead of changing the active mixer channel
- Improved jog wheel with automatic window focus
- Auto channel selection when touching a fader
- Make use of the full scribble strip width
- Meter values are more accurate
- The clip led works when the signal is clipping
- Smoothing is disabled by default
- Sliders now function in free control mode
- Minor bugfixes and improvements
- Changing the tempo using the jog wheel now works
- Various bugfixes and improvements

More improvements later...

Expand Down
42 changes: 25 additions & 17 deletions device_XTouch.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def __init__(self):

self.MackieCU_ExtenderPosT = ('left', 'right')

self.ArrowsStr = chr(0x7F) + chr(0x7E) + chr(0x32)
self.ExtenderPos = mcu_extender_location.Left

def OnInit(self):
Expand Down Expand Up @@ -85,70 +84,79 @@ def TrackSel(self, Index, Step):
device.baseTrackSelect(Index, Step)
if Index == 0:
s = channels.getChannelName(channels.channelNumber())
self.OnSendMsg(self.ArrowsStr + 'Channel: ' + s)
self.OnSendMsg(mcu_constants.ArrowsStr + 'Channel: ' + s)
elif Index == 1:
self.OnSendMsg(self.ArrowsStr + 'Mixer track: ' + mixer.getTrackName(mixer.trackNumber()))
self.OnSendMsg(mcu_constants.ArrowsStr + 'Mixer track: ' + mixer.getTrackName(mixer.trackNumber()))
elif Index == 2:
s = patterns.getPatternName(patterns.patternNumber())
self.OnSendMsg(self.ArrowsStr + 'Pattern: ' + s)
self.OnSendMsg(mcu_constants.ArrowsStr + 'Pattern: ' + s)

def Jog(self, event):
# ------ START rd3d2 forcing jog dial to use the playlist
ui.setFocused(midi.widPlaylist)
# ------ END rd3d2 forcing jog dial to use the playlist
if self.JogSource == 0:
ui.showWindow(midi.widPlaylist)
ui.setFocused(midi.widPlaylist)
transport.globalTransport(midi.FPT_Jog + int(self.Shift ^ self.Scrub), event.outEv, event.pmeFlags) # relocate
elif self.JogSource == mcu_buttons.Move:
transport.globalTransport(midi.FPT_MoveJog, event.outEv, event.pmeFlags)
elif self.JogSource == mcu_buttons.Marker:
ui.showWindow(midi.widPlaylist)
ui.setFocused(midi.widPlaylist)
if self.Shift:
s = 'Marker selection'
else:
s = 'Marker jump'
if event.outEv != 0:
if transport.globalTransport(midi.FPT_MarkerJumpJog + int(self.Shift), event.outEv, event.pmeFlags) == midi.GT_Global:
s = ui.getHintMsg()
self.OnSendMsg(self.ArrowsStr + s)
self.OnSendMsg(mcu_constants.ArrowsStr + s)

elif self.JogSource == mcu_buttons.Undo:
if event.outEv == 0:
s = 'Undo history'
elif transport.globalTransport(midi.FPT_UndoJog, event.outEv, event.pmeFlags) == midi.GT_Global:
s = ui.GetHintMsg()
self.OnSendMsg(self.ArrowsStr + s + ' (level ' + general.getUndoLevelHint() + ')')
s = ui.getHintMsg()
self.OnSendMsg(mcu_constants.ArrowsStr + s + ' (level ' + general.getUndoLevelHint() + ')')

elif self.JogSource == mcu_buttons.Zoom:
if event.outEv != 0:
transport.globalTransport(midi.FPT_HZoomJog + int(self.Shift), event.outEv, event.pmeFlags)

elif self.JogSource == mcu_buttons.Window:

if event.outEv != 0:
transport.globalTransport(midi.FPT_WindowJog, event.outEv, event.pmeFlags)
s = ui.getFocusedFormCaption()
if s != "":
self.OnSendMsg(self.ArrowsStr + 'Current window: ' + s)
self.OnSendMsg(mcu_constants.ArrowsStr + 'Current window: ' + s)

elif (self.JogSource == mcu_buttons.Pattern) | (self.JogSource == mcu_buttons.Mixer) | (mcu_buttons.Channels):
elif (self.JogSource == mcu_buttons.Pattern) | (self.JogSource == mcu_buttons.Mixer) | (self.JogSource == mcu_buttons.Channels):
self.TrackSel(self.JogSource - mcu_buttons.Pattern, event.outEv)
if (self.JogSource == mcu_buttons.Pattern):
ui.showWindow(midi.widPlaylist)
ui.setFocused(midi.widPlaylist)
elif (self.JogSource == mcu_buttons.Mixer):
ui.showWindow(midi.widMixer)
ui.setFocused(midi.widMixer)
elif (self.JogSource == mcu_buttons.Channels):
ui.showWindow(midi.widChannelRack)
ui.setFocused(midi.widChannelRack)

elif self.JogSource == mcu_buttons.Tempo:
if event.outEv != 0:
channels.processRECEvent(midi.REC_Tempo, channels.incEventValue(midi.REC_Tempo, event.outEv, midi.EKRes), midi.PME_RECFlagsT[int(event.pmeFlags & midi.PME_LiveInput != 0)] - midi.REC_FromMIDI)
self.OnSendMsg(self.ArrowsStr + 'Tempo: ' + mixer.getEventIDValueString(midi.REC_Tempo, mixer.getCurrentTempo()))
self.OnSendMsg(mcu_constants.ArrowsStr + 'Tempo: ' + mixer.getEventIDValueString(midi.REC_Tempo, mixer.getCurrentTempo()))

elif self.JogSource in [mcu_buttons.Free1, mcu_buttons.Free2, mcu_buttons.Free3, mcu_buttons.Free4]:
# CC
event.data1 = 390 + self.JogSource - mcu_buttons.Free1

if event.outEv != 0:
event.isIncrement = 1
s = chr(0x7E + int(event.outEv < 0))
self.OnSendMsg(self.ArrowsStr + 'Free jog ' + str(event.data1) + ': ' + s)
s = chr(0x2B + int(event.outEv < 0)*2) # + or - sign depending on how you rotate
self.OnSendMsg(mcu_constants.ArrowsStr + 'Free jog ' + str(event.data1) + ': ' + s)
device.processMIDICC(event)
return
else:
self.OnSendMsg(self.ArrowsStr + 'Free jog ' + str(event.data1))
self.OnSendMsg(mcu_constants.ArrowsStr + 'Free jog ' + str(event.data1))


def OnMidiMsg(self, event):
Expand Down
1 change: 1 addition & 0 deletions mcu_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@

PageDescriptions = ('Panning (press to reset)', 'Stereo separation (press to reset)', 'Sends for selected track (press to enable)', 'Effects for selected track (press to enable)', 'EQ for selected track (press to reset)', 'Lotsa free controls')
OffOnStr = ('off', 'on')
ArrowsStr = chr(0x3E) + chr(0x20) #ASCII for "> "

0 comments on commit af4bdb0

Please sign in to comment.