Skip to content

Commit f497ff2

Browse files
committed
added Midi Fighter 3D snippets
1 parent c90fd94 commit f497ff2

File tree

3 files changed

+143
-3
lines changed

3 files changed

+143
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Finally! Hehe, say hello to the [Mk3 Pro][24] (8/2020)
5656

5757
Midi Fighter 64 - class "MidiFighter64" LEDs and buttons
5858

59+
Midi Fighter 3D - class "MidiFighter63D IN WORK
60+
5961

6062
> PRO MK3 USERS:
6163
> You need to disable the Launchpad's "Transmit Clock" in the MIDI settings!
@@ -86,6 +88,10 @@ Successfully tested with Ubuntu 18.04-LTS+. Requires compiling your own PyGame t
8688
---
8789
## NEWS
8890

91+
### CHANGES 2021/05/XX:
92+
- fixed Launchpad Mk1 code in buttons_raw.py demo; thx to jmtrivial
93+
- added first Midi Mighter 3D code
94+
8995
### CHANGES 2021/04/XX:
9096
- added link to driver for Mk1 Launchpad and Mini
9197
- fixed Mk1 Automap buttons always yellow; thx to mutax and Ferada

examples/buttons_raw.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
#
33
# Quick button test.
44
# Works with these Launchpads: Mk1, Mk2, Mini Mk3, S/Mini, Pro, Pro Mk3
5-
# And these: Midi Figther 64
5+
# And these: Midi Fighter 64, Mifi Fighter 3D
66
#
77
#
8-
# FMMT666(ASkr) 7/2013..8/2020
8+
# FMMT666(ASkr) 7/2013..5/2021
99
# www.askrprojects.net
1010
#
1111

@@ -80,6 +80,12 @@ def main():
8080
print("Midi Fighter 64")
8181
mode = "F64"
8282

83+
elif launchpad.MidiFighter3D().Check( 0 ):
84+
lp = launchpad.MidiFighter3D()
85+
if lp.Open( 0 ):
86+
print("Midi Fighter 3D")
87+
mode = "F3D"
88+
8389
else:
8490
lp = launchpad.Launchpad()
8591
if lp.Open():

launchpad_py/launchpad.py

Lines changed: 129 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# https://github.com/FMMT666/launchpad.py
66
#
7-
# FMMT666(ASkr) 01/2013..09/2019..08/2020..01/2021
7+
# FMMT666(ASkr) 01/2013..09/2019..08/2020..05/2021
88
# www.askrprojects.net
99
#
1010
#
@@ -3096,6 +3096,134 @@ def Reset( self ):
30963096

30973097

30983098

3099+
########################################################################################
3100+
### CLASS MidiFighter3D
3101+
###
3102+
### For Midi Fighter 3D Gedöns
3103+
########################################################################################
3104+
class MidiFighter3D( LaunchpadBase ):
3105+
3106+
#
3107+
# LED AND BUTTON NUMBERS IN RAW MODE
3108+
#
3109+
# +---+---+---+---+
3110+
# | XX| | | XX|
3111+
# +---+ +---+---+---+---+ +---+
3112+
# | XX| | XX| | | XX| |XX |
3113+
# | XX| +---+---+---+---+ |XX |
3114+
# | XX| | XX| | | XX| |XX |
3115+
# +---+ +---+---+---+---+ +---+
3116+
# | XX| | | XX|
3117+
# +---+---+---+---+
3118+
# +---+---+---+---+
3119+
# | XX| | | XX|
3120+
# +---+---+---+---+
3121+
#
3122+
#
3123+
# LED AND BUTTON NUMBERS IN XY MODE (X/Y)
3124+
#
3125+
# +---+---+---+---+
3126+
# | XX| | | XX|
3127+
# +---+ +---+---+---+---+ +---+
3128+
# | XX| | XX| | | XX| |XX |
3129+
# | XX| +---+---+---+---+ |XX |
3130+
# | XX| | XX| | | XX| |XX |
3131+
# +---+ +---+---+---+---+ +---+
3132+
# | XX| | | XX|
3133+
# +---+---+---+---+
3134+
# +---+---+---+---+
3135+
# | XX| | | XX|
3136+
# +---+---+---+---+
3137+
3138+
3139+
#-------------------------------------------------------------------------------------
3140+
#-- Add some LED mode "constants" for better usability.
3141+
#-------------------------------------------------------------------------------------
3142+
def __init__( self ):
3143+
3144+
# TODO TODO TODO
3145+
3146+
self.MODE_BRIGHT = [ i+18 for i in range(16) ]
3147+
self.MODE_TOGGLE = [ i+34 for i in range(8) ]
3148+
self.MODE_PULSE = [ i+42 for i in range(8) ]
3149+
self.MODE_ANIM_SQUARE = 50
3150+
self.MODE_ANIM_CIRCLE = 51
3151+
self.MODE_ANIM_STAR = 52
3152+
self.MODE_ANIM_TRIANGLE = 53
3153+
3154+
super( MidiFighter3D, self ).__init__( )
3155+
3156+
3157+
3158+
#-------------------------------------------------------------------------------------
3159+
#-- Opens one of the attached Launchpad MIDI devices.
3160+
#-- Uses search string "Fighter 3D", by default.
3161+
#-------------------------------------------------------------------------------------
3162+
# Overrides "LaunchpadBase" method
3163+
def Open( self, number = 0, name = "Fighter 3D" ):
3164+
return super( MidiFighter3D, self ).Open( number = number, name = name )
3165+
3166+
3167+
#-------------------------------------------------------------------------------------
3168+
#-- Checks if a device exists, but does not open it.
3169+
#-- Does not check whether a device is in use or other, strange things...
3170+
#-- Uses search string "Fighter 3D64", by default.
3171+
#-------------------------------------------------------------------------------------
3172+
# Overrides "LaunchpadBase" method
3173+
def Check( self, number = 0, name = "Fighter 3D" ):
3174+
return super( MidiFighter3D, self ).Check( number = number, name = name )
3175+
3176+
3177+
#-------------------------------------------------------------------------------------
3178+
#-- Returns the raw value of the last button change (pressed/unpressed) as a list
3179+
#-- [ <button>, <velocity> ], in which <button> is the raw number of the button and
3180+
#-- <velocity> the button state.
3181+
#-- >0 = button pressed; 0 = button released
3182+
#-------------------------------------------------------------------------------------
3183+
def ButtonStateRaw( self ):
3184+
if self.midi.ReadCheck():
3185+
a = self.midi.ReadRaw()
3186+
3187+
# The Midi Fighter 64 does not support velocities. For 500 bucks. Lol :'-)
3188+
# What we see here are either channel 3 or 2 NoteOn/NoteOff commands,
3189+
# the factory settings, depending on the "bank selection".
3190+
# Channel 3 -> hold upper left button for longer than 2s
3191+
# Channel 2 -> hold upper right button for longer than 2s
3192+
#
3193+
# [[[146, 81, 127, 0], 47365]]
3194+
# [[[130, 81, 127, 0], 47443]]
3195+
# [[[146, 82, 127, 0], 47610]]
3196+
#
3197+
# [[[ <NoteOn/Off>, <button>, 127, 0], 47610]]
3198+
#
3199+
# 146/145 -> NoteOn
3200+
# 130/129 -> NoteOff
3201+
# 127 -> fixed velocity (as set by the Midi Fighter utility )
3202+
3203+
# Mhh, I guess it's about time to think about adding MIDI channels, isn't it?
3204+
# But for now, we just check ch 2 and 3:
3205+
if a[0][0][0] == 145 or a[0][0][0] == 146:
3206+
return [ a[0][0][1], a[0][0][2] ]
3207+
else:
3208+
if a[0][0][0] == 130 or a[0][0][0] == 129:
3209+
return [ a[0][0][1], 0 ]
3210+
else:
3211+
return []
3212+
else:
3213+
return []
3214+
3215+
3216+
#-------------------------------------------------------------------------------------
3217+
#-- Reset the Midi Fighter
3218+
#-- Well, at least turn off all its LEDs
3219+
#-------------------------------------------------------------------------------------
3220+
def Reset( self ):
3221+
# TODO
3222+
# self.LedAllOn( 0 )
3223+
pass
3224+
3225+
3226+
30993227
########################################################################################
31003228
### CLASS LaunchpadPROMk3
31013229
###

0 commit comments

Comments
 (0)