Skip to content
Open

10.0 #14

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
62 changes: 35 additions & 27 deletions Devices/Push/__init__.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
# Embedded file name: /Users/versonator/Jenkins/live/output/mac_64_static/Release/python-bundle/MIDI Remote Scripts/Push/__init__.py
from __future__ import absolute_import, print_function
from ableton.v2.control_surface.capabilities import controller_id, inport, outport, AUTO_LOAD_KEY, CONTROLLER_ID_KEY, FIRMWARE_KEY, HIDDEN, NOTES_CC, PORTS_KEY, SCRIPT, SYNC, TYPE_KEY
from .firmware_handling import get_provided_firmware_version
from .push import Push

from Ubermap import UbermapDevicesPatches

def get_capabilities():
return {CONTROLLER_ID_KEY: controller_id(vendor_id=2536, product_ids=[21], model_name='Ableton Push'),
PORTS_KEY: [inport(props=[HIDDEN, NOTES_CC, SCRIPT]),
inport(props=[]),
outport(props=[HIDDEN,
NOTES_CC,
SYNC,
SCRIPT]),
outport(props=[])],
TYPE_KEY: 'push',
FIRMWARE_KEY: get_provided_firmware_version(),
AUTO_LOAD_KEY: True}

def create_instance(c_instance):
""" Creates and returns the Push script """

UbermapDevicesPatches.apply_ubermap_patches()

return Push(c_instance=c_instance)
# Embedded file name: c:\Jenkins\live\output\win_64_static\Release\python-bundle\MIDI Remote Scripts\Push\__init__.py
from __future__ import absolute_import, print_function, unicode_literals
from ableton.v2.control_surface.capabilities import controller_id, inport, outport, AUTO_LOAD_KEY, CONTROLLER_ID_KEY, FIRMWARE_KEY, HIDDEN, NOTES_CC, PORTS_KEY, SCRIPT, SYNC, TYPE_KEY
from .firmware_handling import get_provided_firmware_version
from .push import Push

#FIX TO WORK WITH CLYPHX
#from Ubermap import UbermapDevicesPatches
#END OF FIX

def get_capabilities():
return {CONTROLLER_ID_KEY: controller_id(vendor_id=2536, product_ids=[21], model_name=u'Ableton Push'),
PORTS_KEY: [inport(props=[HIDDEN, NOTES_CC, SCRIPT]),
inport(props=[]),
outport(props=[HIDDEN,
NOTES_CC,
SYNC,
SCRIPT]),
outport(props=[])],
TYPE_KEY: u'push',
FIRMWARE_KEY: get_provided_firmware_version(),
AUTO_LOAD_KEY: True}


def create_instance(c_instance):
u""" Creates and returns the Push script """

#FIX TO WORK WITH CLYPHX
from Ubermap import UbermapDevicesPatches
#END OF FIX
#FIX MULTIPLE VERSION BEING
# UbermapDevicesPatches.apply_ubermap_patches()
UbermapDevicesPatches.apply_ubermap_patches(True)
#FIX END
return Push(c_instance=c_instance)
Binary file added Devices/Push/__init__.pyc
Binary file not shown.
60 changes: 33 additions & 27 deletions Devices/Push2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
# Embedded file name: /Users/versonator/Jenkins/live/output/mac_64_static/Release/python-bundle/MIDI Remote Scripts/Push2/__init__.py
from __future__ import absolute_import, print_function

from Ubermap import UbermapDevicesPatches

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]),
caps.inport(props=[]),
caps.outport(props=[caps.HIDDEN,
caps.NOTES_CC,
caps.SYNC,
caps.SCRIPT]),
caps.outport(props=[])],
caps.TYPE_KEY: 'push2',
caps.AUTO_LOAD_KEY: True}


def create_instance(c_instance):
from .push2 import Push2
from .push2_model import Root, Sender
root = Root(sender=Sender(message_sink=c_instance.send_model_update, process_connected=c_instance.process_connected))

UbermapDevicesPatches.apply_ubermap_patches()

return Push2(c_instance=c_instance, model=root)
# Embedded file name: c:\Jenkins\live\output\win_64_static\Release\python-bundle\MIDI Remote Scripts\Push2\__init__.py
from __future__ import absolute_import, print_function, unicode_literals
#FIX FOR USING WITH CLYPHX
#from Ubermap import UbermapDevicesPatches
#END OF FIX

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=u'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.TYPE_KEY: u'push2',
caps.AUTO_LOAD_KEY: True}


def create_instance(c_instance):
from .push2 import Push2
from .push2_model import Root, Sender
root = Root(sender=Sender(message_sink=c_instance.send_model_update, process_connected=c_instance.process_connected))

#FIX FOR USING WITH CLYPHX
from Ubermap import UbermapDevicesPatches
#END OF FIX
#FIX MULTIPLE VERSION BEING
UbermapDevicesPatches.apply_ubermap_patches(False)
# UbermapDevicesPatches.apply_ubermap_patches()
#FIX END
return Push2(c_instance=c_instance, model=root)
Binary file added Devices/Push2/__init__.pyc
Binary file not shown.
59 changes: 39 additions & 20 deletions Devices/UbermapDevices.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

class UbermapDevices:
PARAMS_PER_BANK = 8
SECTION_BANKS = 'Banks'
SECTION_BANKS = 'Banks'
SECTION_PARAMETER_VALUES = 'ParameterValues'
SECTION_PARAMETER_VALUE_TYPES = 'ParameterValueTypes'
SECTION_CONFIG = 'Config'

device_config_cache = {}
Expand All @@ -20,6 +22,9 @@ def get_device_name(self, device):
return ''

name = device.class_display_name
#BBE TEST BEGIN
log.info('load device name='+device.name+' class_name='+device.class_name+' class_display_name='+device.class_display_name)
#BBE TEST END
if self.cfg.get('use_md5'):
params = ''
for i in device.parameters[1:]:
Expand All @@ -44,28 +49,14 @@ def dump_device(self, device):
config = ConfigObj()
config.filename = filepath

config[self.SECTION_BANKS] = {}
config[self.SECTION_CONFIG] = {}
config[self.SECTION_BANKS] = {}
config[self.SECTION_PARAMETER_VALUES] = {}
config[self.SECTION_PARAMETER_VALUE_TYPES] = {}

config[self.SECTION_CONFIG] = {}
config[self.SECTION_CONFIG]['Cache'] = False
config[self.SECTION_CONFIG]['Ignore'] = True

'''
Code to dump original ableton mapping - not working

bank_names = parameter_bank_names(device, skip = True)
banks = parameter_banks(device, skip = True)

count = 0
for bank_name in bank_names:
config[SECTION_BANKS][bank_name] = {}
for param in banks[count]:
if(param):
config[SECTION_BANKS][bank_name][param.original_name] = param.original_name
count = count + 1
#config[SECTION_BEST_OF]['Bank'] = best_of_parameter_bank(device, _ubermap_skip = True)
config[SECTION_BEST_OF]['Bank'] = config[SECTION_BANKS].itervalues().next()
'''

count = 0
bank = 1
total_count = 1
Expand Down Expand Up @@ -95,6 +86,7 @@ def get_device_config(self, device):
def get_custom_device_banks(self, device):
device_config = self.get_device_config(device)
if(not device_config):
self.dump_device(device)
return False

return device_config.get(self.SECTION_BANKS).keys()
Expand All @@ -107,11 +99,38 @@ def get_custom_device_params(self, device, bank_name = None):
if(not device_config):
return False

def parse_custom_parameter_values(values):
# Split the values on || to see if we have custom value start points specified
values_split = map(lambda s: s.split('||'), values)
has_value_start_points = all(len(x) == 2 for x in values_split)
if not has_value_start_points:
return [values, None]

return [[x[0] for x in values_split], [float(x[1]) for x in values_split]]

def get_custom_parameter_values(parameter_name):
values = device_config.get(self.SECTION_PARAMETER_VALUES, parameter_name)
if not values:
return [None, None]

# If we have an array, i.e. comma separated list, just use that
if isinstance(values, list):
return parse_custom_parameter_values(values)

# Otherwise try and look up the string key in ParameterValueTypes and use that
values_type = device_config.get(self.SECTION_PARAMETER_VALUE_TYPES, values)
if values_type:
return parse_custom_parameter_values(values_type)

def get_parameter_by_name(device, nameMapping):
count = 0
for i in device.parameters:
if nameMapping[0] == str(count) + "_" + i.original_name or nameMapping[0] == i.original_name:
log.info("got " + nameMapping[1] + " for " + nameMapping[0])
i.custom_name = nameMapping[1]

[i.custom_parameter_values, i.custom_parameter_start_points] = get_custom_parameter_values(nameMapping[0])

return i
count = count + 1

Expand Down
Loading