@@ -161,6 +161,7 @@ def __init__(self, mcu_model_id, mcu_connection, \
161161 mcu_midi_input , mcu_midi_output , \
162162 hardware_controller_class , controller_midi_input , \
163163 controller_midi_output , callback_log ):
164+ self ._play_status = False
164165 self ._callback_log = callback_log
165166
166167 eval_controller_init = \
@@ -268,31 +269,40 @@ def withdraw_all_controls(self):
268269
269270 def keypress (self , internal_id , status ):
270271 if internal_id in self ._led__hardware_to_mcu :
271- command = 'self._mackie_host_control.keypress_%s(%d)' % \
272- (self ._led__hardware_to_mcu [internal_id ], status )
273-
274- eval (command )
272+ mcu_command = self ._led__hardware_to_mcu [internal_id ]
273+ self .keypress_unregistered (mcu_command , status )
275274 return True
276275 else :
277276 return False
278277
279278
279+ def keypress_unregistered (self , mcu_command , status ):
280+ command = 'self._mackie_host_control.keypress_%s(%d)' % \
281+ (mcu_command , status )
282+ eval (command )
283+
284+
280285 def _set_led (self , mcu_command , status ):
281286 if self ._led__mcu_to_hardware [mcu_command ]['value' ] != status :
282287 self ._led__mcu_to_hardware [mcu_command ]['value' ] = status
283288
284- if self ._led__mcu_to_hardware [mcu_command ]['midi_switch' ] \
285- is not None :
289+ if type ( self ._led__mcu_to_hardware [mcu_command ]['midi_switch' ]) != \
290+ types . NoneType :
286291 self ._update_led (mcu_command )
287292
288293
289294 def _update_led (self , mcu_command ):
290- if self ._led__mcu_to_hardware [mcu_command ]['midi_switch' ] is not None :
295+ if type (self ._led__mcu_to_hardware [mcu_command ]['midi_switch' ]) != \
296+ types .NoneType :
291297 status = self ._led__mcu_to_hardware [mcu_command ]['value' ]
292298 self ._hardware_controller .set_led ( \
293299 self ._led__mcu_to_hardware [mcu_command ]['midi_led' ], status )
294300
295301
302+ def is_playing (self ):
303+ return self ._play_status
304+
305+
296306 # --- hardware controller commands ---
297307
298308 def has_display_7seg (self ):
@@ -496,6 +506,11 @@ def set_led_stop(self, status):
496506
497507
498508 def set_led_play (self , status ):
509+ if status :
510+ self ._play_status = True
511+ else :
512+ self ._play_status = False
513+
499514 self ._set_led ('play' , status )
500515
501516
0 commit comments