ableton-js 3.1.5 → 3.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/midi-script/AbletonJS.py +2 -1
- package/midi-script/Config.py +1 -0
- package/midi-script/Interface.py +15 -7
- package/midi-script/Song.py +7 -0
- package/midi-script/version.py +1 -1
- package/ns/song.d.ts +4 -0
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,22 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v3.1.7](https://github.com/leolabs/ableton.js/compare/v3.1.6...v3.1.7)
|
|
8
|
+
|
|
9
|
+
- :mute: Don't clutter the logs by default [`333ff7b`](https://github.com/leolabs/ableton.js/commit/333ff7bf0a51bc3eace927a3b7ae0ff740ac616f)
|
|
10
|
+
- :sparkles: Add the `appointed_device` property [`ae47bd2`](https://github.com/leolabs/ableton.js/commit/ae47bd2e0ed8b68f5bfab561709eab65238bce06)
|
|
11
|
+
- :wrench: Copy the MIDI script into the User Library instead of into the app [`c4050d6`](https://github.com/leolabs/ableton.js/commit/c4050d664755fdae41152e9c376d91eea2071c94)
|
|
12
|
+
|
|
13
|
+
#### [v3.1.6](https://github.com/leolabs/ableton.js/compare/v3.1.5...v3.1.6)
|
|
14
|
+
|
|
15
|
+
> 6 April 2023
|
|
16
|
+
|
|
17
|
+
- :bug: Fix an issue with Live 10 where umlauts in a cached response would throw an error [`f4f6a20`](https://github.com/leolabs/ableton.js/commit/f4f6a20e30d9a0c97e585a12799255cbd769c240)
|
|
18
|
+
|
|
7
19
|
#### [v3.1.5](https://github.com/leolabs/ableton.js/compare/v3.1.4...v3.1.5)
|
|
8
20
|
|
|
21
|
+
> 16 March 2023
|
|
22
|
+
|
|
9
23
|
- :zap: Try binding to the last used port first to speed up the connection to Live [`b86bc5d`](https://github.com/leolabs/ableton.js/commit/b86bc5d2b2872b030978a87cc3b001e2e997722d)
|
|
10
24
|
- :memo: Add logging to the example code [`7b5dfbf`](https://github.com/leolabs/ableton.js/commit/7b5dfbf5beb8140588211a4b54c970e48f9980c9)
|
|
11
25
|
- :bug: Don't emit an error when a received message can't be assigned to any request [`3186bdb`](https://github.com/leolabs/ableton.js/commit/3186bdbdc6cb1190d9d2de1f29905fed6e5030dd)
|
package/midi-script/AbletonJS.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import absolute_import
|
|
2
2
|
|
|
3
3
|
from .version import version
|
|
4
|
+
from .Config import DEBUG
|
|
4
5
|
from .Socket import Socket
|
|
5
6
|
from .Interface import Interface
|
|
6
7
|
from .Application import Application
|
|
@@ -80,7 +81,7 @@ class AbletonJS(ControlSurface):
|
|
|
80
81
|
namespace = payload["ns"]
|
|
81
82
|
|
|
82
83
|
# Don't clutter the logs
|
|
83
|
-
if not (namespace == "internal" and payload["name"] == "get_prop" and payload["args"]["prop"] == "ping"):
|
|
84
|
+
if not (namespace == "internal" and payload["name"] == "get_prop" and payload["args"]["prop"] == "ping") and DEBUG:
|
|
84
85
|
self.log_message("Received command: " + str(payload))
|
|
85
86
|
|
|
86
87
|
if namespace in self.handlers:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DEBUG = False
|
package/midi-script/Interface.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import hashlib
|
|
2
2
|
import json
|
|
3
3
|
|
|
4
|
+
from .Config import DEBUG
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
class Interface(object):
|
|
6
8
|
obj_ids = dict()
|
|
@@ -25,6 +27,10 @@ class Interface(object):
|
|
|
25
27
|
self.socket = socket
|
|
26
28
|
self.log_message = c_instance.log_message
|
|
27
29
|
|
|
30
|
+
def log_debug(self, message: str):
|
|
31
|
+
if DEBUG:
|
|
32
|
+
self.log_message(message)
|
|
33
|
+
|
|
28
34
|
def get_ns(self, nsid):
|
|
29
35
|
return Interface.obj_ids[nsid]
|
|
30
36
|
|
|
@@ -36,8 +42,8 @@ class Interface(object):
|
|
|
36
42
|
def jsonReplace(o):
|
|
37
43
|
return str(o)
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
response = json.dumps(result, default=jsonReplace, ensure_ascii=False)
|
|
46
|
+
hash = hashlib.md5(response.encode("utf-8", "replace")).hexdigest()
|
|
41
47
|
|
|
42
48
|
if hash == etag:
|
|
43
49
|
return self.socket.send("result", {"__cached": True}, uuid)
|
|
@@ -72,6 +78,7 @@ class Interface(object):
|
|
|
72
78
|
self.socket.send("error", "Function call failed: " + payload["name"] +
|
|
73
79
|
" doesn't exist or isn't callable", uuid)
|
|
74
80
|
except Exception as e:
|
|
81
|
+
self.log_message("Handler Error: " + str(e.args))
|
|
75
82
|
self.socket.send("error", str(e.args[0]), uuid)
|
|
76
83
|
|
|
77
84
|
def add_listener(self, ns, prop, eventId, nsid="Default"):
|
|
@@ -81,24 +88,25 @@ class Interface(object):
|
|
|
81
88
|
raise Exception("Listener " + str(prop) + " does not exist.")
|
|
82
89
|
|
|
83
90
|
key = str(nsid) + ":" + prop
|
|
84
|
-
self.
|
|
91
|
+
self.log_debug("Listener key: " + key)
|
|
92
|
+
|
|
85
93
|
if key in self.listeners:
|
|
86
|
-
self.
|
|
94
|
+
self.log_debug("Key already has a listener")
|
|
87
95
|
return self.listeners[key]["id"]
|
|
88
96
|
|
|
89
97
|
def fn():
|
|
90
98
|
value = self.get_prop(ns, prop)
|
|
91
99
|
return self.socket.send(eventId, value)
|
|
92
100
|
|
|
93
|
-
self.
|
|
94
|
-
|
|
101
|
+
self.log_debug("Attaching listener: " +
|
|
102
|
+
key + ", event ID: " + eventId)
|
|
95
103
|
add_fn(fn)
|
|
96
104
|
self.listeners[key] = {"id": eventId, "fn": fn}
|
|
97
105
|
return eventId
|
|
98
106
|
|
|
99
107
|
def remove_listener(self, ns, prop, nsid="Default"):
|
|
100
108
|
key = str(nsid) + ":" + prop
|
|
101
|
-
self.
|
|
109
|
+
self.log_debug("Remove key: " + key)
|
|
102
110
|
if key not in self.listeners:
|
|
103
111
|
raise Exception("Listener " + str(prop) + " does not exist.")
|
|
104
112
|
|
package/midi-script/Song.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import absolute_import
|
|
2
2
|
from .Interface import Interface
|
|
3
3
|
from .CuePoint import CuePoint
|
|
4
|
+
from .Device import Device
|
|
4
5
|
from .Scene import Scene
|
|
5
6
|
from .Track import Track
|
|
6
7
|
|
|
@@ -29,6 +30,9 @@ class Song(Interface):
|
|
|
29
30
|
sorted_points = sorted(ns.cue_points, key=lambda cue: cue.time)
|
|
30
31
|
return map(CuePoint.serialize_cue_point, sorted_points)
|
|
31
32
|
|
|
33
|
+
def get_appointed_device(self, ns):
|
|
34
|
+
return Device.serialize_device(ns.appointed_device)
|
|
35
|
+
|
|
32
36
|
def get_master_track(self, ns):
|
|
33
37
|
return Track.serialize_track(ns.master_track)
|
|
34
38
|
|
|
@@ -53,3 +57,6 @@ class Song(Interface):
|
|
|
53
57
|
def get_current_smpte_song_time(self, ns, timeFormat):
|
|
54
58
|
time = ns.get_current_smpte_song_time(timeFormat)
|
|
55
59
|
return {'hours': time.hours, 'minutes': time.minutes, 'seconds': time.seconds, 'frames': time.frames}
|
|
60
|
+
|
|
61
|
+
def set_appointed_device(self, ns, device_id):
|
|
62
|
+
ns.appointed_device = Interface.get_obj(device_id)
|
package/midi-script/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
version = "3.1.
|
|
1
|
+
version = "3.1.7"
|
package/ns/song.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ import { Track, RawTrack } from "./track";
|
|
|
4
4
|
import { CuePoint, RawCuePoint } from "./cue-point";
|
|
5
5
|
import { SongView } from "./song-view";
|
|
6
6
|
import { Scene, RawScene } from "./scene";
|
|
7
|
+
import { RawDevice } from "./device";
|
|
7
8
|
export interface GettableProperties {
|
|
9
|
+
appointed_device: RawDevice;
|
|
8
10
|
arrangement_overdub: boolean;
|
|
9
11
|
back_to_arranger: number;
|
|
10
12
|
can_capture_midi: boolean;
|
|
@@ -60,6 +62,7 @@ export interface TransformedProperties {
|
|
|
60
62
|
scenes: Scene[];
|
|
61
63
|
}
|
|
62
64
|
export interface SettableProperties {
|
|
65
|
+
appointed_device: string;
|
|
63
66
|
arrangement_overdub: boolean;
|
|
64
67
|
back_to_arranger: number;
|
|
65
68
|
clip_trigger_quantization: Quantization;
|
|
@@ -99,6 +102,7 @@ export interface SettableProperties {
|
|
|
99
102
|
visible_tracks: number;
|
|
100
103
|
}
|
|
101
104
|
export interface ObservableProperties {
|
|
105
|
+
appointed_device: RawDevice;
|
|
102
106
|
arrangement_overdub: boolean;
|
|
103
107
|
back_to_arranger: number;
|
|
104
108
|
can_capture_midi: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ableton-js",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.7",
|
|
4
4
|
"description": "Control Ableton Live from Node",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Leo Bernard <admin@leolabs.org>",
|
|
@@ -16,14 +16,13 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"ableton:clean": "rm -f midi-script/AbletonJS/*.pyc",
|
|
19
|
-
"
|
|
19
|
+
"ableton:copy-script": "set -- ~/Music/Ableton/User\\ Library/Remote\\ Scripts && rm -rf \"$1/AbletonJS\" && cp -r \"$(pwd)/midi-script\" \"$1/AbletonJS\" && rm -rf \"$1/AbletonJS/_Framework\"",
|
|
20
20
|
"ableton10:launch": "set -- /Applications/Ableton*10* && open \"$1\"",
|
|
21
|
-
"ableton11:copy-script": "set -- /Applications/Ableton*11*/Contents/App-Resources/MIDI\\ Remote\\ Scripts && rm -rf \"$1/AbletonJS\" && cp -r \"$(pwd)/midi-script\" \"$1/AbletonJS\" && rm -rf \"$1/AbletonJS/_Framework\"",
|
|
22
21
|
"ableton11:launch": "set -- /Applications/Ableton*11* && open \"$1\"",
|
|
23
22
|
"ableton:logs": "tail -n 50 -f ~/Library/Preferences/Ableton/*/Log.txt | grep -i -e RemoteScriptError -e RemoteScriptMessage",
|
|
24
23
|
"ableton:kill": "pkill -KILL -f \"Ableton Live\"",
|
|
25
|
-
"ableton10:start": "yarn ableton:kill; yarn ableton:clean && yarn
|
|
26
|
-
"ableton11:start": "yarn ableton:kill; yarn ableton:clean && yarn
|
|
24
|
+
"ableton10:start": "yarn ableton:kill; yarn ableton:clean && yarn ableton:copy-script && yarn ableton10:launch && yarn ableton:logs",
|
|
25
|
+
"ableton11:start": "yarn ableton:kill; yarn ableton:clean && yarn ableton:copy-script && yarn ableton11:launch && yarn ableton:logs",
|
|
27
26
|
"prepublishOnly": "yarn build",
|
|
28
27
|
"postinstall": "node hooks/postinstall.js",
|
|
29
28
|
"build:doc": "jsdoc2md --files src/**/*.ts --configure ./jsdoc2md.json > ./API.md",
|