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

Added push2 and pushbase for 9.7.1 #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Empty file removed Push2/.DS_Store_failed
Empty file.
19 changes: 10 additions & 9 deletions Push2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#Embedded file name: /Users/versonator/Jenkins/live/output/mac_64_static/Release/python-bundle/MIDI Remote Scripts/Push2/__init__.py
# Embedded file name: /Users/versonator/Jenkins/live/output/mac_64_static/Release/python-bundle/MIDI Remote Scripts/Push2/__init__.py
# Compiled at: 2016-05-20 03:43:52
from __future__ import absolute_import, print_function

def get_capabilities():
from ableton.v2.control_surface import capabilities as caps
return {caps.CONTROLLER_ID_KEY: caps.controller_id(vendor_id=10626, product_ids=[6503], model_name='Ableton Push 2'),
caps.PORTS_KEY: [caps.inport(props=[caps.HIDDEN, caps.NOTES_CC, caps.SCRIPT]),
return {caps.CONTROLLER_ID_KEY: caps.controller_id(vendor_id=10626, product_ids=[
6503], model_name='Ableton Push 2'),
caps.PORTS_KEY: [
caps.inport(props=[caps.HIDDEN, caps.NOTES_CC, caps.SCRIPT]),
caps.inport(props=[]),
caps.outport(props=[caps.HIDDEN,
caps.NOTES_CC,
caps.SYNC,
caps.SCRIPT]),
caps.outport(props=[caps.HIDDEN, caps.NOTES_CC, caps.SYNC, caps.SCRIPT]),
caps.outport(props=[])],
caps.TYPE_KEY: 'push2',
caps.AUTO_LOAD_KEY: True}
caps.TYPE_KEY: 'push2',
caps.AUTO_LOAD_KEY: True
}


def create_instance(c_instance):
Expand Down
37 changes: 25 additions & 12 deletions Push2/actions.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
#Embedded file name: /Users/versonator/Jenkins/live/output/mac_64_static/Release/python-bundle/MIDI Remote Scripts/Push2/actions.py
# Embedded file name: /Users/versonator/Jenkins/live/output/mac_64_static/Release/python-bundle/MIDI Remote Scripts/Push2/actions.py
# Compiled at: 2016-09-29 19:13:24
from __future__ import absolute_import, print_function
from ableton.v2.base import liveobj_valid
from pushbase.actions import CaptureAndInsertSceneComponent as CaptureAndInsertSceneComponentBase
from .clip_decoration import ClipDecoratedPropertiesCopier

class CaptureAndInsertSceneComponent(CaptureAndInsertSceneComponentBase):

def __init__(self, name = None, decorator_factory = None, *a, **k):
def __init__(self, name=None, decorator_factory=None, *a, **k):
super(CaptureAndInsertSceneComponent, self).__init__(name, *a, **k)
self._decorator_factory = decorator_factory

def _copy_decorated_properties(self, source_clip, destination_clip):
ClipDecoratedPropertiesCopier(source_clip=source_clip, destination_clip=destination_clip, decorator_factory=self._decorator_factory).post_duplication_action()

def post_trigger_action(self):
view = self.song.view
if liveobj_valid(view.detail_clip) and view.detail_clip.is_arrangement_clip:
previous_detail_clip = view.detail_clip
super(CaptureAndInsertSceneComponent, self).post_trigger_action()
self._copy_decorated_properties(previous_detail_clip, view.detail_clip)
else:

def get_playing_clip(track):
slot_ix = track.playing_slot_index
if slot_ix > -1:
return track.clip_slots[slot_ix].clip
def get_playing_clip(track):
slot_ix = track.playing_slot_index
if slot_ix > -1:
return track.clip_slots[slot_ix].clip
else:
return None

played_clips = [ get_playing_clip(track) for track in self.song.tracks ]
super(CaptureAndInsertSceneComponent, self).post_trigger_action()
new_slots = self.song.view.selected_scene.clip_slots
for ix, clip in enumerate(played_clips):
if clip:
ClipDecoratedPropertiesCopier(target_clip=clip, destination_clip=new_slots[ix].clip, decorator_factory=self._decorator_factory).post_duplication_action()
played_clips = [ get_playing_clip(track) for track in self.song.tracks ]
super(CaptureAndInsertSceneComponent, self).post_trigger_action()
new_slots = view.selected_scene.clip_slots
for ix, clip in enumerate(played_clips):
if liveobj_valid(clip):
self._copy_decorated_properties(clip, new_slots[ix].clip)
37 changes: 29 additions & 8 deletions Push2/automation.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#Embedded file name: /Users/versonator/Jenkins/live/output/mac_64_static/Release/python-bundle/MIDI Remote Scripts/Push2/automation.py
# Embedded file name: /Users/versonator/Jenkins/live/output/mac_64_static/Release/python-bundle/MIDI Remote Scripts/Push2/automation.py
# Compiled at: 2016-05-20 03:43:52
from __future__ import absolute_import, print_function
from itertools import ifilter
from ableton.v2.base import liveobj_valid, listenable_property
from ableton.v2.base import liveobj_valid, listenable_property, listens
from pushbase.automation_component import AutomationComponent as AutomationComponentBase
from pushbase.internal_parameter import InternalParameterBase
from pushbase.parameter_provider import ParameterInfo

class StepAutomationParameter(InternalParameterBase):

def __init__(self, parameter = None, *a, **k):
raise liveobj_valid(parameter) or AssertionError
def __init__(self, parameter=None, *a, **k):
assert liveobj_valid(parameter)
super(StepAutomationParameter, self).__init__(name=parameter.name, *a, **k)
self._parameter = parameter
self._value = self._parameter.value
Expand Down Expand Up @@ -65,7 +66,7 @@ def make_automation_parameter(parameter_info):

class AutomationComponent(AutomationComponentBase):
ENCODER_SENSITIVITY_FACTOR = 0.5
__events__ = ('parameters',)
__events__ = ('parameters', )

def __init__(self, *a, **k):
self._parameter_infos = []
Expand All @@ -75,14 +76,28 @@ def __init__(self, *a, **k):
@property
def deviceType(self):
device_type = 'default'
if hasattr(self.parameter_provider, 'device'):
device = self.device
if liveobj_valid(device):
device = self.parameter_provider.device()
device_type = device.class_name if liveobj_valid(device) else device_type
return device_type

@listenable_property
def device(self):
device = None
if hasattr(self.parameter_provider, 'device'):
device = self.parameter_provider.device()
return device

def _on_parameter_provider_changed(self, provider):
self.notify_device()
self.__on_device_changed.subject = provider if getattr(self.parameter_provider, 'device', None) is not None else None
return

@property
def parameters(self):
return map(lambda info: (info.parameter if info else None), self._parameter_infos)
return map(lambda info: if info:
info.parameterNone, self._parameter_infos)

@property
def parameter_infos(self):
Expand Down Expand Up @@ -123,4 +138,10 @@ def _update_parameter_values(self):

def _parameter_for_index(self, parameters, index):
if parameters[index]:
return parameters[index].original_parameter
return parameters[index].original_parameter
else:
return None

@listens('device')
def __on_device_changed(self):
self.notify_device()
Loading