Skip to content

Commit

Permalink
improve notifications in status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
hdavid committed Oct 3, 2014
1 parent faa75ab commit 4691ec4
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 13 deletions.
10 changes: 5 additions & 5 deletions DeviceControllerComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,30 +250,30 @@ def _lock_value(self, value, sender):
dev = i
if dev>=0:
if self._device != None:
self._parent._parent.show_message("Launchpad95: device is already at position "+ str(dev+1)+" : " + str(self._device.name))
self._parent._parent.show_message(" '"+str(self._device.name)+"' is stored in lock button "+ str(dev+1) )
else:
if self._device!=None:
self._locked_devices[index] = self._device
if self._device != None:
self._parent._parent.show_message("Launchpad95: saving device "+ str(index+1)+" : " + str(self._device.name))
self._parent._parent.show_message(" '"+ str(self._device.name)+"' stored into lock button " + str(index+1))
else:
#remove saved device
self._locked_devices[index] = None
self._locked_device_index = None
if self._device != None:
self._parent._parent.show_message("Launchpad95: removing locked device "+ str(index+1)+" : " + str(self._device.name))
self._parent._parent.show_message("removing '"+str(self._device.name)+"' from block button "+ str(index+1) )
else:
#use selected device
if self._locked_device_index == index:
if self._locked_devices[index] != None:
if self._locked_devices[index]!= None:
self._parent._parent.show_message("Launchpad95: unlocked from device "+ str(index+1)+" : " + str(self._locked_devices[index].name))
self._parent._parent.show_message("unlocked from ' "+ str(self._locked_devices[index].name)+"' ("+str(index+1)+")")
self._locked_device_index = None
elif self._locked_devices[index] != None:
self._locked_device_index = index
self.set_device(self._locked_devices[index])
if self._locked_devices[index]!= None:
self._parent._parent.show_message("Launchpad95: locked to device "+ str(index+1)+" : " + str(self._locked_devices[index].name))
self._parent._parent.show_message("locked to '"+ str(self._locked_devices[index].name)+" (" +str(index+1)+")" )
self.update()
self.update_track_buttons()
self.update_device_buttons()
Expand Down
18 changes: 18 additions & 0 deletions InstrumentControllerComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def tuple_idx(self, tuple, obj):

def _matrix_value_quickscale(self, value, x, y, is_momentary): # matrix buttons listener for advanced mode
if self.is_enabled() and not self._scales.is_enabled() and self._scales.is_quick_scale:
keys = ["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"]
if ((value != 0) or (not is_momentary)):
if self._quick_scale_root:
root = -1
Expand All @@ -161,8 +162,10 @@ def _matrix_value_quickscale(self, value, x, y, is_momentary): # matrix buttons
if y == 1 and x < 7 or y == 0 and x in[0, 1, 3, 4, 5]:
if y == 1:
root = [0, 2, 4, 5, 7, 9, 11, 12][x]
self._parent._parent.show_message(keys[root]+" "+str(self._scales._modus_names[selected_modus]))
if y == 0 and x < 6:
root = [0, 2, 4, 5, 7, 9, 11, 12][x] + 1
self._parent._parent.show_message(keys[root]+" "+str(self._scales._modus_names[selected_modus]))
if root == selected_key: # alternate minor/major
if selected_modus == 0:
selected_modus = self._scales._current_minor_mode
Expand All @@ -173,18 +176,26 @@ def _matrix_value_quickscale(self, value, x, y, is_momentary): # matrix buttons
selected_modus = 12
elif selected_modus == 12:
selected_modus = 11
self._parent._parent.show_message(keys[root]+" "+str(self._scales._modus_names[selected_modus]))
else:
if y == 0 and x == 7: # change mode
self._quick_scale_root = not self._quick_scale_root
if self._quick_scale_root:
self._parent._parent.show_message("quick scale : root")
else:
self._parent._parent.show_message("quick scale : modes")
self.update()
if y == 1 and x == 7 and False: # rotate minor scales
if self._scales._selected_modus in self._scales._minor_modes:
self._scales.set_selected_modus(self._scales._minor_modes[(self.tuple_idx(self._scales._minor_modes, self._scales._selected_modus) + 1) % 3])
self._parent._parent.show_message(keys[root]+" "+str(self._scales._modus_names[self._scales._selected_modus]))
self.update()
if y == 1 and x == 7: # nav circle of 5th right
root = CIRCLE_OF_FIFTHS[(self.tuple_idx(CIRCLE_OF_FIFTHS, selected_key) + 1 + 12) % 12]
self._parent._parent.show_message("circle of 5ths -> "+keys[selected_key]+" "+str(self._scales._modus_names[selected_modus])+" => "+keys[root]+" "+str(self._scales._modus_names[selected_modus]))
if y == 0 and x == 6: # nav circle of 5th left
root = CIRCLE_OF_FIFTHS[(self.tuple_idx(CIRCLE_OF_FIFTHS, selected_key) - 1 + 12) % 12]
self._parent._parent.show_message("circle of 5ths <- "+keys[selected_key]+" "+str(self._scales._modus_names[selected_modus])+" => "+keys[root]+" "+str(self._scales._modus_names[selected_modus]))
if y == 0 and x == 2: # relative scale
if selected_modus == 0:
selected_modus = self._scales._current_minor_mode
Expand All @@ -199,6 +210,7 @@ def _matrix_value_quickscale(self, value, x, y, is_momentary): # matrix buttons
elif selected_modus == 12:
selected_modus = 11
root = CIRCLE_OF_FIFTHS[(self.tuple_idx(CIRCLE_OF_FIFTHS, selected_key) - 3 + 12) % 12]
self._parent._parent.show_message("Relative scale : "+keys[root]+" "+str(self._scales._modus_names[selected_modus]))

if root != -1:
self._scales.set_selected_modus(selected_modus)
Expand All @@ -209,13 +221,19 @@ def _matrix_value_quickscale(self, value, x, y, is_momentary): # matrix buttons
if(y == 0):
if x < 7 and self._quick_scales[x] != -1:
self._scales.set_selected_modus(self._quick_scales[x])
self._parent._parent.show_message("mode : "+str(self._scales._modus_names[self._scales._selected_modus]))
self.update()
if x == 7:
self._quick_scale_root = not self._quick_scale_root
if self._quick_scale_root:
self._parent._parent.show_message("quick scale : root")
else:
self._parent._parent.show_message("quick scale : modes")
self.update()
if(y == 1):
if x < 8 and self._quick_scales[x + 7] != -1:
self._scales.set_selected_modus(self._quick_scales[x + 7])
self._parent._parent.show_message("mode : "+str(self._scales._modus_names[self._scales._selected_modus]))
self.update()

def update(self):
Expand Down
Binary file added M4LDevice/Launchpad95 OSD.amxd
Binary file not shown.
Binary file added M4LDevice/Launchpad95Helper.amxd
Binary file not shown.
34 changes: 26 additions & 8 deletions ScaleComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,14 @@ def modus(self):
def set_key(self, n):
self._selected_key = n % 12


def set_octave_index(self, n):
self._octave_index = n

def set_selected_modus(self, n):
if n > -1 and n < len(self._modus_list):
self._selected_modus = n
# show message not working in live 9
if self._parent != None:
self._parent._parent._parent.log_message(str(self._modus_names[n]))
self._parent._parent._parent.show_message(str(self._modus_names[n]))


def _set_preset(self, n):
if n > -1 and n < 6:
Expand All @@ -251,6 +249,7 @@ def set_matrix(self, matrix):
self._matrix.add_value_listener(self._matrix_value)
self.update()


def _matrix_value(self, value, x, y, is_momentary): # matrix buttons listener
if self.is_enabled():
if ((value != 0) or (not is_momentary)):
Expand All @@ -259,26 +258,37 @@ def _matrix_value(self, value, x, y, is_momentary): # matrix buttons listener
if not self.is_drumrack():
if x == 0:
self.is_absolute = not self.is_absolute
if self.is_absolute:
self._parent._parent._parent.show_message("absolute root")
else:
self._parent._parent._parent.show_message("relative root")
if x == 1:
self._presets.toggle_orientation()
if x == 2:
self.set_chromatic_gtr()
self._presets.set_orientation('horizontal')
self._parent._parent._parent.show_message("mode: chromatic gtr")
if x == 3:
self.set_diatonic_ns()
self._presets.set_orientation('horizontal')
self._parent._parent._parent.show_message("mode: diatonic not staggered")
if x == 4:
self.set_diatonic(2)
self._presets.set_orientation('vertical')
if x == 6:
self.set_chromatic()
self._presets.set_orientation('horizontal')
self._parent._parent._parent.show_message("mode: diatonic vertical (chords)")
if x == 5:
self.set_diatonic(3)
self._presets.set_orientation('horizontal')
self._parent._parent._parent.show_message("mode: diatonic")
if x == 6:
self.set_chromatic()
self._presets.set_orientation('horizontal')
self._parent._parent._parent.show_message("mode: chromatic")
if x == 7:
self.set_drumrack(True)

self._parent._parent._parent.show_message("mode: drumrack")

keys = ["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"]
# root note
if not self.is_drumrack():
root = -1
Expand All @@ -288,6 +298,7 @@ def _matrix_value(self, value, x, y, is_momentary): # matrix buttons listener
root = [0, 2, 4, 5, 7, 9, 11, 12][x]
if y == 1:
root = root + 1
self._parent._parent._parent.show_message("root "+keys[root])

# if root == selected_key:#alternate minor/major
# if selected_modus==0:
Expand All @@ -302,8 +313,10 @@ def _matrix_value(self, value, x, y, is_momentary): # matrix buttons listener

if y == 2 and x == 7: # nav circle of 5th right
root = CIRCLE_OF_FIFTHS[(self.tuple_idx(CIRCLE_OF_FIFTHS, selected_key) + 1 + 12) % 12]
self._parent._parent._parent.show_message("circle of 5ths -> "+keys[selected_key]+" "+str(self._modus_names[selected_modus])+" => "+keys[root]+" "+str(self._modus_names[selected_modus]))
if y == 1 and x == 6: # nav circle of 5th left
root = CIRCLE_OF_FIFTHS[(self.tuple_idx(CIRCLE_OF_FIFTHS, selected_key) - 1 + 12) % 12]
self._parent._parent._parent.show_message("circle of 5ths <- "+keys[selected_key]+" "+str(self._modus_names[selected_modus])+" => "+keys[root]+" "+str(self._modus_names[selected_modus]))
if y == 1 and x == 2: # relative scale
if self._selected_modus == 0:
selected_modus = self._current_minor_mode
Expand All @@ -318,18 +331,23 @@ def _matrix_value(self, value, x, y, is_momentary): # matrix buttons listener
elif self._selected_modus == 12:
selected_modus = 11
root = CIRCLE_OF_FIFTHS[(self.tuple_idx(CIRCLE_OF_FIFTHS, selected_key) - 3 + 12) % 12]
self._parent._parent._parent.show_message("Relative scale : "+keys[root]+" "+str(self._modus_names[selected_modus]))
if root != -1:
self.set_selected_modus(selected_modus)
self.set_key(root)

if y == 1 and x == 7 and not self.is_drumrack():
self.is_quick_scale = not self.is_quick_scale
self._parent._parent._parent.show_message("Quick scale")
# octave
if y == 3:
self._octave_index = x
self._parent._parent._parent.show_message("octave : "+str(n))
# modus
if y > 3 and not self.is_drumrack():
self.set_selected_modus((y - 4) * 8 + x)
self._parent._parent._parent.show_message("mode : "+str(self._modus_names[n]))


self.update()

Expand Down
7 changes: 7 additions & 0 deletions StepSequencerComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,8 @@ def set_enabled(self, enabled):
self.on_clip_slot_changed()
# call super.set_enabled()
CompoundComponent.set_enabled(self, enabled)
if self._clip != None and self._is_locked:
self._parent._parent.show_message("stepseq : clip '"+str(self._clip.name)+"'")
self._on_notes_changed()
self._update_OSD()

Expand Down Expand Up @@ -1326,13 +1328,15 @@ def _quantization_button_value(self, value, sender):
self._last_quantize_button_press = now
else:
if now - self._last_quantize_button_press > 0.5:
self._parent._parent.show_message("stepseq : duplicate clip")
self.duplicate_clip()
else:
if(self._mode == STEPSEQ_MODE_SCALE_EDIT):
self._quantization_index = (self._quantization_index - 1+len(QUANTIZATION_MAP)) % len(QUANTIZATION_MAP)
else:
self._quantization_index = (self._quantization_index + 1) % len(QUANTIZATION_MAP)
self.set_quantization(QUANTIZATION_MAP[self._quantization_index])
self._parent._parent.show_message("quantisation : "+QUANTIZATION_NAMES[self._quantization_index])
self._update_quantization_button()

def set_quantization(self, quantization):
Expand Down Expand Up @@ -1384,10 +1388,13 @@ def _lock_value(self, value, sender):
if now - self._last_lock_button_press > self._long_press:
self._lock_to_track = (not self._lock_to_track)
if not self._is_locked:
self._parent._parent.show_message("stepseq : locked to clip '"+str(self._clip.name)+"'")
self._is_locked = True
self._update_lock_button()
else:
self._is_locked = (not self._is_locked)
if self._is_locked:
self._parent._parent.show_message("stepseq : locked to clip '"+str(self._clip.name)+"'")
self._update_lock_button()
self._update_OSD()

Expand Down
37 changes: 37 additions & 0 deletions TrackControllerComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,31 @@ def _session_record_value(self, value):
if now - self._last_session_record_button_press > self._long_press * 4:
self._implicit_arm = not self._implicit_arm
self._do_implicit_arm()
if self._implicit_arm:
self._parent.show_message("implicit arm : on")
else:
self._parent.show_message("implicit arm : off")
self.update()
elif now - self._last_session_record_button_press > self._long_press:
self.song().metronome = not self.song().metronome
if self.song().metronome :
self._parent.show_message("metronome : on")
else:
self._parent.show_message("metronome : off")
else:
if self._implicit_arm:
self.song().session_record = not self.song().session_record
if self.song().session_record :
self._parent.show_message("session record : on")
else:
self._parent.show_message("session record : off")
else:
if (self._selected_track.can_be_armed):
self._selected_track.arm = not self._selected_track.arm
if self._selected_track.arm :
self._parent.show_message("track "+str(self._selected_track.name)+" armed")
else:
self._parent.show_message("track "+str(self._selected_track.name)+" unarmed")
self.update()

def _play_value(self, value):
Expand All @@ -282,6 +298,7 @@ def _play_value(self, value):
if self.song().view.selected_scene != None:
slot = self.song().view.selected_scene.clip_slots[self.selected_track_idx()]
slot.fire()
self._parent.show_message("fire clip")
else:
self._play_button.turn_off()

Expand All @@ -300,11 +317,13 @@ def _stop_value(self, value):
slot = self.song().view.selected_scene.clip_slots[self.selected_track_idx()]
if slot and slot.has_clip:
slot.delete_clip()
self._parent.show_message("delete clip")
else:

if self.song().view.selected_scene != None:
slot = self.song().view.selected_scene.clip_slots[self.selected_track_idx()]
slot.stop()
self._parent.show_message("stop clip")
self._stop_button.turn_off()

def _mute_value(self, value):
Expand All @@ -314,6 +333,10 @@ def _mute_value(self, value):
if self.is_enabled():
if ((value != 0) or (not self._mute_button.is_momentary())):
self._selected_track.mute = not self._selected_track.mute
if self._selected_track.mute :
self._parent.show_message("track "+str(self._selected_track.name)+" muted")
else:
self._parent.show_message("track "+str(self._selected_track.name)+" unmuted")
self.update()

def _solo_value(self, value):
Expand All @@ -331,6 +354,10 @@ def _solo_value(self, value):
self._selected_track.mute = not self._selected_track.mute
else:
self._selected_track.solo = not self._selected_track.solo
if self._selected_track.solo :
self._parent.show_message("track "+str(self._selected_track.name)+" solo")
else:
self._parent.show_message("track "+str(self._selected_track.name)+" unsolo")
self.update()

def _undo_value(self, value):
Expand All @@ -342,9 +369,11 @@ def _undo_value(self, value):
if now - self._last_undo_button_press < self._long_press:
if self.song().can_undo:
self.song().undo()
self._parent.show_message("undo!")
else:
if self.song().can_redo:
self.song().redo()
self._parent.show_message("redo!")
self.update()

def _arm_value(self, value):
Expand All @@ -358,10 +387,18 @@ def _arm_value(self, value):
else:
if now - self._last_arm_button_press > self._long_press:
self._implicit_arm = not self._implicit_arm
if self._implicit_arm:
self._parent.show_message("implicit arm : on")
else:
self._parent.show_message("implicit arm : off")
self._do_implicit_arm()
else:
if self._selected_track.can_be_armed:
self._selected_track.arm = not self._selected_track.arm
if self._selected_track.arm :
self._parent.show_message("track "+str(self._selected_track.name)+" armed")
else:
self._parent.show_message("track "+str(self._selected_track.name)+" unarmed")
self.update()

def update(self):
Expand Down

0 comments on commit 4691ec4

Please sign in to comment.