|
4 | 4 | #
|
5 | 5 | # https://github.com/FMMT666/launchpad.py
|
6 | 6 | #
|
7 |
| -# FMMT666(ASkr) 01/2013..09/2019..08/2020..01/2021 |
| 7 | +# FMMT666(ASkr) 01/2013..09/2019..08/2020..05/2021 |
8 | 8 | # www.askrprojects.net
|
9 | 9 | #
|
10 | 10 | #
|
@@ -3096,6 +3096,134 @@ def Reset( self ):
|
3096 | 3096 |
|
3097 | 3097 |
|
3098 | 3098 |
|
| 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 | + |
3099 | 3227 | ########################################################################################
|
3100 | 3228 | ### CLASS LaunchpadPROMk3
|
3101 | 3229 | ###
|
|
0 commit comments