Skip to content

Commit

Permalink
Fix setting of device parameters.
Browse files Browse the repository at this point in the history
- Added the ability to set a device parameter value.
- Fixed a crash on startup reading the arm state of tracks without a readable arm property.
  • Loading branch information
soulfresh committed Jun 4, 2015
1 parent c862f48 commit e17f44b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LO2ChannelStripComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def _lo2__on_solo_changed(self):
self.send_default('/live/'+self._track_types[self._type]+'solo', self._track.solo)

def _lo2__on_arm_changed(self):
if self._type == 0 and self._type is not None:
if self._type == 0 and self._type is not None and self._track.can_be_armed:
self.send_default('/live/'+self._track_types[self._type]+'arm', self._track.arm)

def _lo2__on_track_name_changed(self):
Expand Down
5 changes: 4 additions & 1 deletion LO2MixerComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ def _lo2__on_return_tracks_changed(self):

# Callbacks
def _lo2_on_track_list_changed(self):
self.log_message('on_track_list_changed')
if len(self.song().tracks) != self._track_count:
self.log_message('/live/tracks:' + str(len(self.song().tracks)))
self.send('/live/tracks', len(self.song().tracks))
self._track_count = len(self.song().tracks)

def _lo2_on_selected_track_changed(self):
self.log_message('on_selected_track_changed')
id, type = self.track_id_type(self.song().view.selected_track)

self.send('/live/track/select', type, id)
Expand All @@ -83,4 +86,4 @@ def _track_name_block(self, msg, src):
b.append(i, '')

self.send('/live/track/name/block', b)


2 changes: 0 additions & 2 deletions LO2Mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
# beginning _lo2_<FrameworkListener>
def _decorate(fn, child, name):
def wrap(*a, **kw):
LO2Mixin.log_message('calling LO2 wrapper: '+name)

ret = fn(*a, **kw)
child(*a, **kw)

Expand Down
7 changes: 6 additions & 1 deletion LO2ParameterComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def __init__(self, send = False):
def set_parameter(self, param):
self._parameter = param
self._on_value_changed.subject = param


def set_parameter_value(self, value):
self._parameter.value = value


@subject_slot('value')
Expand All @@ -32,4 +36,5 @@ def _on_value_changed(self):

p = list(self._parameter.canonical_parent.parameters).index(self._parameter)

self.send('/live/'+self._track_types[ty]+'device/param', tid, d, p, self._parameter.value, str(self._parameter.name))
self.send('/live/'+self._track_types[ty]+'device/param', tid, d, p, self._parameter.value, str(self._parameter.name))

0 comments on commit e17f44b

Please sign in to comment.