Skip to content
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
working
Devices/ableton
Devices/Push2
Devices/Ubermap
Devices/configobj.py
43 changes: 27 additions & 16 deletions Devices/UbermapDevices.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os.path
import re
from . configobj import ConfigObj
from functools import partial
import hashlib
from Ubermap.UbermapLibs import log, log_call, config
from Ubermap.UbermapLibs import log, config

class UbermapDevices:
PARAMS_PER_BANK = 8
Expand All @@ -24,9 +24,8 @@ def get_device_name(self, device):
name = device.class_display_name
if self.cfg.get('use_md5'):
params = ''
for i in device.parameters[1:]:
params += i.original_name
name += '_' + hashlib.md5(params.encode('utf-8')).hexdigest()
for device_parameter in device.parameters[1:]:
params += device_parameter.original_name
return name

def get_device_filename(self, device):
Expand Down Expand Up @@ -57,13 +56,13 @@ def dump_device(self, device):
count = 0
bank = 1
total_count = 1
for i in device.parameters[1:]:
for device_parameter in device.parameters[1:]:
if(count == 0):
section = 'Bank ' + str(bank)
config[self.SECTION_BANKS][section] = {}
bank = bank + 1

config[self.SECTION_BANKS][section][str(total_count) + "_" + i.original_name] = i.original_name
config[self.SECTION_BANKS][section][str(total_count) + "_" + device_parameter.original_name] = device_parameter.original_name

count = count + 1
total_count = total_count + 1
Expand Down Expand Up @@ -119,16 +118,28 @@ def get_custom_parameter_values(parameter_name):
if values_type:
return parse_custom_parameter_values(values_type)

def get_parameter_by_name(device, nameMapping):
def get_parameter_by_name(device, name_mapping):
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
for device_parameter in device.parameters:
original_name = name_mapping[0]
if (original_name == device_parameter.original_name) \
or (original_name == str(count) + "_" + device_parameter.original_name) \
or re.match("^\\d+_\\w+$" + device_parameter.original_name, original_name):

if not name_mapping[1]:
custom_name = original_name
elif name_mapping[1] == "*":
# this line just splits words by case: SomeWord -> Some Word
custom_name = " ".join(re.sub('([A-Z][a-z]+)', r' \1', re.sub('([A-Z]+)', r' \1', original_name)).split())
else:
custom_name = name_mapping[1]

device_parameter.custom_name = custom_name

[device_parameter.custom_parameter_values, device_parameter.custom_parameter_start_points] = \
get_custom_parameter_values(original_name)

return device_parameter
count = count + 1

def names_to_params(bank):
Expand Down
49 changes: 49 additions & 0 deletions Devices/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
##############################################################################################
# Windows 10 / WIndows 11 PowerShell install script #
# Paths may differ from the defaults used in this script and may be adjusted #
##############################################################################################
$LIVE_MIDI_REMOTE_PATH = "C:\ProgramData\Ableton\Live 11 Suite\Resources\MIDI Remote Scripts"

# Backup Existing Midi Remote Folder
# Copy-Item $LIVE_MIDI_REMOTE_PATH -Destination $LIVE_MIDI_REMOTE_PATH" ORIG" -Recurse

# Copy
$UBERMAP_MIDI_REMOTE_PATH = $LIVE_MIDI_REMOTE_PATH + '/Ubermap'
New-Item -Path $UBERMAP_MIDI_REMOTE_PATH -ItemType "directory" -Force
Copy-Item ../Common/__init__.py -Destination $UBERMAP_MIDI_REMOTE_PATH -Force
Copy-Item ../Common/configobj.py -Destination $UBERMAP_MIDI_REMOTE_PATH -Force
Copy-Item ../Common/UbermapLibs.py -Destination $UBERMAP_MIDI_REMOTE_PATH -Force
Copy-Item UbermapDevices.py -Destination $UBERMAP_MIDI_REMOTE_PATH -Force
Copy-Item UbermapDevicesPatches.py -Destination $UBERMAP_MIDI_REMOTE_PATH -Force

# Copy config
$UBERMAP_USER = $HOME + '/Ubermap'
New-Item -Path $UBERMAP_USER -ItemType "directory" -Force
New-Item -Path $UBERMAP_USER"/Devices" -ItemType "directory" -Force
Copy-Item ..\Config\devices.cfg -Destination $UBERMAP_USER -Force
Copy-Item ..\Config\global.cfg -Destination $UBERMAP_USER -Force
Copy-Item ..\Config\browser.cfg -Destination $UBERMAP_USER -Force

# PluginAutoPopulateThreshold Setting
$SETTINGS_FOLDER_SEARCH = $HOME + '\AppData\Roaming\Ableton'
$LIVE_VERSION_FOLDER_NAME = (Get-ChildItem $SETTINGS_FOLDER_SEARCH | Where-Object {$_.name -match "Live .[0-9.]"} | Sort-Object | Select-Object -Last 1).Name
$OPTIONS_FILE = $HOME + '\AppData\Roaming\Ableton\' + $LIVE_VERSION_FOLDER_NAME + '\Preferences\Options.txt'

$SETTING = "-_PluginAutoPopulateThreshold=-1"
if(!(Test-path $OPTIONS_FILE))
{
$SETTING | Out-File $OPTIONS_FILE
} else {
$contains = Select-String -Path $OPTIONS_FILE "-_PluginAutoPopulateThreshold"

if ($null -eq $contains)
{
Add-Content $OPTIONS_FILE $SETTING
}
}

# Remove .pyc
Get-ChildItem -Path $LIVE_MIDI_REMOTE_PATH"/Ubermap" *.pyc | ForEach-Object { Remove-Item -Path $_.FullName }

Write-Output 'Ubermap installed - now restart Ableton Live.'
Read-Host 'Press ENTER to close...'