Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue fixing #41

Merged
merged 3 commits into from
Nov 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions ColorsMK1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Rgb:
RED_HALF = Color(6)
RED_THIRD = Color(5)

#RED BLINK
RED_BLINK = Color(11)
RED_BLINK_HALF = Color(10)
RED_BLINK_THIRD = Color(9)
Expand All @@ -19,6 +20,7 @@ class Rgb:
GREEN_HALF = Color(36)
GREEN_THIRD = Color(20)

#GREEN_BLINK
GREEN_BLINK = Color(56)
GREEN_BLINK_HALF = Color(40)
GREEN_BLINK_THIRD = Color(24)
Expand All @@ -29,6 +31,7 @@ class Rgb:
AMBER_HALF = Color(38)
AMBER_THIRD = Color(21)

#AMBER_BLINK
AMBER_BLINK = Color(59)
AMBER_BLINK_HALF = Color(42)
AMBER_BLINK_THIRD = Color(25)
Expand All @@ -52,8 +55,8 @@ class Rgb:
#MISC
MANDARIN = Color(23)
MANDARIN_FULL = Color(23)
ORANGE_BLINK = Color(27)
MANDARIN_BLINK = Color(27)

LIME = Color(43)
LIME_FULL = Color(43)
LIME_BLINK = Color(47)
LIME = Color(53)
LIME_FULL = Color(53)
LIME_BLINK = Color(57)
11 changes: 6 additions & 5 deletions ConfigurableButtonElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ConfigurableButtonElement(ButtonElement):
False, which can be defined by setting the 'states' property.
Thus 'set_light' can take any state or skin color.
"""
default_states = {True: 'DefaultButton.On', False: 'DefaultButton.Disabled'}
default_states = {True: 'DefaultButton.On', False: 'DefaultButton.Off'}
send_depends_on_forwarding = False

def __init__(self, is_momentary, msg_type, channel, identifier, skin = None, default_states = None, control_surface = None, *a, **k):
Expand Down Expand Up @@ -44,21 +44,22 @@ def _try_fetch_skin_value(self, value):

def reset(self):
self.set_light('DefaultButton.Disabled')
self.reset_state()
#self.reset_state()

def reset_state(self):
self.states = dict(self.default_states)
super(ConfigurableButtonElement, self).reset_state()
self.set_enabled(True)

def set_on_off_values(self, on_value, off_value = None):
self.clear_send_cache()
if off_value == None:
self.states[True] = str(on_value)+".On"
self.states[False] = str(on_value)+".Off"
else:
self.states[True] = on_value
self.states[False] = off_value

def set_enabled(self, enabled):
self.suppress_script_forwarding = not enabled

Expand All @@ -80,7 +81,7 @@ def send_value(self, value, **k):
super(ConfigurableButtonElement, self).send_value(value, **k)
else:
self._draw_skin(value)

def force_next_send(self):
"""
Enforces sending the next value regardless of wether the
Expand All @@ -95,7 +96,7 @@ def _do_send_on_value(self, **k):
super(ConfigurableButtonElement, self).send_value(self._on_value, **k)
else:
self._draw_skin(self._on_value)

def _do_send_off_value(self, **k):
if type(self._off_value) is int:
super(ConfigurableButtonElement, self).send_value(self._off_value, **k)
Expand Down
39 changes: 21 additions & 18 deletions SkinMK1.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Mixer:

class Session:
# scene
SceneTriggered = Rgb.AMBER_BLINK
SceneTriggered = Rgb.GREEN_BLINK
Scene = Rgb.AMBER_THIRD
NoScene = Rgb.BLACK
# clip states
Expand All @@ -53,8 +53,8 @@ class Session:
ClipTriggeredRecord = Rgb.RED_BLINK
RecordButton = Rgb.RED_THIRD
# stop button
StopClip = Rgb.RED
StopClipTriggered = Rgb.RED_BLINK
StopClip = Rgb.ORANGE_HALF
StopClipTriggered = Rgb.ORANGE_BLINK_HALF
# Enabled = Rgb.GREEN
# Off = Rgb.GREEN_THIRD

Expand All @@ -72,31 +72,34 @@ class Solo:
On = Rgb.RED
Off = Rgb.RED_THIRD
class Mute:
On = Rgb.AMBER_THIRD
Off = Rgb.AMBER
On = Rgb.AMBER
Off = Rgb.AMBER_THIRD
class Stop:
On = Rgb.RED
Off = Rgb.RED_THIRD
class Selected:
On = Rgb.AMBER
Off = Rgb.AMBER_THIRD
class Volume:
On = Rgb.GREEN
Off = Rgb.GREEN_THIRD
On = Rgb.GREEN_THIRD
Off = Rgb.GREEN
class VolumeSlider:
On = Rgb.GREEN
Off = Rgb.BLACK
class Pan:
On = Rgb.GREEN
Off = Rgb.GREEN_THIRD
On = Rgb.GREEN_THIRD
Off = Rgb.GREEN
class PanSlider:
On = Rgb.GREEN
On = Rgb.AMBER
Off = Rgb.BLACK
class Sends:
On = Rgb.GREEN
Off = Rgb.GREEN_THIRD
class SendsSlider:
On = Rgb.AMBER
On = Rgb.GREEN_THIRD
Off = Rgb.GREEN
class SendsSlider_1:
On = Rgb.ORANGE
Off = Rgb.BLACK
class SendsSlider_2:
On = Rgb.YELLOW
Off = Rgb.BLACK

class Sends: # not used yet on legacy launchpad
Expand Down Expand Up @@ -241,11 +244,11 @@ class Play:
On = Rgb.RED
Off = Rgb.RED_THIRD
class Stop:
On = Rgb.RED
Off = Rgb.RED_THIRD
On = Rgb.ORANGE
Off = Rgb.ORANGE_HALF
class Mute:
On = Rgb.RED
Off = Rgb.RED_THIRD
On = Rgb.AMBER
Off = Rgb.AMBER_THIRD
class Undo:
On = Rgb.AMBER
Off = Rgb.AMBER_THIRD
Expand Down
18 changes: 17 additions & 1 deletion SpecialSessionComponent.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from _Framework.SessionComponent import SessionComponent
from ClipSlotMK2 import ClipSlotMK2
from _Framework.SceneComponent import SceneComponent

import Live
class SpecialSessionComponent(SessionComponent):

""" Special session subclass that handles ConfigurableButtons """
Expand All @@ -26,6 +26,22 @@ def link_with_track_offset(self, track_offset):
self.set_offsets(track_offset, 0)
self._link()

def _update_stop_clips_led(self, index):
if ((self.is_enabled()) and (self._stop_track_clip_buttons != None) and (index < len(self._stop_track_clip_buttons))):
button = self._stop_track_clip_buttons[index]
tracks_to_use = self.tracks_to_use()
track_index = index + self.track_offset()
if 0 <= track_index < len(tracks_to_use):
track = tracks_to_use[track_index]
if track.fired_slot_index == -2:
button.send_value(self._stop_clip_triggered_value)
elif track.playing_slot_index >= 0:
button.send_value(self._stop_clip_value)
else:
button.turn_off()
else:
button.send_value(4)

def set_osd(self, osd):
self._osd = osd

Expand Down
2 changes: 1 addition & 1 deletion StepSequencerComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def _loop_button_value(self, value, sender): #Allows to make selection by hold a
self._delete_notes_in_range(start * self._blocksize * self._quantization, end * self._blocksize * self._quantization)
else:
if self._is_velocity_shifted: # FIX, see if can copy backwards
self._extend_clip_content(start * self._blocksize * self._quantization, end * self._blocksize * self._quantization, self._loop_start, self._loop_end)
self._extend_clip_content(start * self._blocksize * self._quantization, self._loop_end, end * self._blocksize * self._quantization)
self.set_clip_loop(start * self._blocksize * self._quantization, end * self._blocksize * self._quantization)

self._step_sequencer.set_page(self._block) # set sequencer focus
Expand Down
53 changes: 20 additions & 33 deletions SubSelectorComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def set_update_callback(self, callback):
self._update_callback = callback

def set_modes_buttons(self, buttons):
assert ((buttons == None) or (isinstance(buttons, tuple) or (len(buttons) == self.number_of_modes())))
assert ((buttons == None) or (isinstance(buttons, tuple)))
assert (len(buttons) == self.number_of_modes())
identify_sender = True
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
Expand Down Expand Up @@ -114,6 +115,7 @@ def release_controls(self):
self._session.set_stop_all_clips_button(None)

def update(self):
super(SubSelectorComponent, self).update()
assert (self._modes_buttons != None)
if self.is_enabled():
if (self._modes_buttons != None):
Expand All @@ -127,18 +129,10 @@ def update(self):
button.set_on_off_values("Mixer.Sends")
elif index == 3:
button.set_on_off_values("Mixer.Sends")
elif index == 4:
button.set_on_off_values("Mixer.Stop")
elif index == 5:
button.set_on_off_values("Mixer.Mute")
elif index == 6:
button.set_on_off_values("Mixer.Solo")
elif index == 7:
button.set_on_off_values("Mixer.Arm")
if (index == self._mode_index):
button.turn_on()
else:
button.turn_off()
else:
button.turn_on()

for button in self._side_buttons:
button.set_on_off_values(127, "DefaultButton.Disabled")
Expand All @@ -165,8 +159,8 @@ def update(self):
self._update_callback()
self._mixer.set_allow_update(True)
self._session.set_allow_update(True)
#else:
#self.release_controls()
else:
self.release_controls()

def _setup_mixer_overview(self):
stop_buttons = []
Expand Down Expand Up @@ -200,25 +194,18 @@ def _setup_mixer_overview(self):
strip.set_solo_button(self._matrix.get_button(track, 6))
strip.set_arm_button(self._matrix.get_button(track, 7))

for button in self._side_buttons:
if row == 0:
button.set_on_off_values("Mixer.Volume")
elif row == 1:
button.set_on_off_values("Mixer.Pan")
elif row == 2:
button.set_on_off_values("Mixer.Sends")
elif row == 3:
button.set_on_off_values("Mixer.Sends")
elif row == 4:
button.set_on_off_values("Mixer.Stop")
elif row == 5:
button.set_on_off_values("Mixer.Mute")
elif row == 6:
button.set_on_off_values("Mixer.Solo")
elif row == 7:
button.set_on_off_values("Mixer.Arm")
for button in self._side_buttons:
if list(self._side_buttons).index(button) == 0:
button.set_on_off_values("Mixer.Stop")
elif list(self._side_buttons).index(button) == 1:
button.set_on_off_values("Mixer.Mute")
elif list(self._side_buttons).index(button) == 2:
button.set_on_off_values("Mixer.Solo")
elif list(self._side_buttons).index(button) == 3:
button.set_on_off_values("Mixer.Arm")

button.force_next_send()
button.turn_on()
button.turn_off()

self._session.set_stop_track_clip_buttons(tuple(stop_buttons))
self._session.set_stop_all_clips_button(self._side_buttons[0])
Expand Down Expand Up @@ -274,7 +261,7 @@ def _setup_send1_mode(self):
strip.set_volume_control(None)
strip.set_pan_control(None)
for row in range(self._matrix.height()):
self._matrix.get_button(track, row).set_on_off_values("Mixer.SendsSlider")
self._matrix.get_button(track, row).set_on_off_values("Mixer.SendsSlider_1")

self._sliders[track].set_mode(SLIDER_MODE_VOLUME)
self._sliders[track].set_value_map(SEND_VALUE_MAP)
Expand All @@ -294,7 +281,7 @@ def _setup_send2_mode(self):
strip.set_volume_control(None)
strip.set_pan_control(None)
for row in range(self._matrix.height()):
self._matrix.get_button(track, row).set_on_off_values("Mixer.SendsSlider")
self._matrix.get_button(track, row).set_on_off_values("Mixer.SendsSlider_2")

self._sliders[track].set_mode(SLIDER_MODE_VOLUME)
self._sliders[track].set_value_map(SEND_VALUE_MAP)
Expand Down