ableton-js 3.2.2 → 3.2.4
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 +12 -0
- package/index.d.ts +1 -1
- package/index.js +13 -4
- package/midi-script/Clip.py +1 -0
- package/midi-script/Track.py +8 -1
- package/midi-script/version.py +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,20 @@ 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.2.4](https://github.com/leolabs/ableton.js/compare/v3.2.3...v3.2.4)
|
|
8
|
+
|
|
9
|
+
- :sparkles: Add `color_index` to the raw props of clips and tracks [`fc6f38d`](https://github.com/leolabs/ableton.js/commit/fc6f38dbcf0a2293f1cd774656a42cdd2ca6f4fc)
|
|
10
|
+
|
|
11
|
+
#### [v3.2.3](https://github.com/leolabs/ableton.js/compare/v3.2.2...v3.2.3)
|
|
12
|
+
|
|
13
|
+
> 25 June 2023
|
|
14
|
+
|
|
15
|
+
- :bug: Fix stray heartbeats emitting a disconnect event [`6157a95`](https://github.com/leolabs/ableton.js/commit/6157a952b766f4c9548e8752c12bde599ccc1a07)
|
|
16
|
+
|
|
7
17
|
#### [v3.2.2](https://github.com/leolabs/ableton.js/compare/v3.2.1...v3.2.2)
|
|
8
18
|
|
|
19
|
+
> 23 June 2023
|
|
20
|
+
|
|
9
21
|
- :sparkles: Add a fallback `schedule_message` in case the Timer doesn't work as expected [`b5fdbe1`](https://github.com/leolabs/ableton.js/commit/b5fdbe12726d3c76a2fe74ec0fe0a731367fcb4f)
|
|
10
22
|
|
|
11
23
|
#### [v3.2.1](https://github.com/leolabs/ableton.js/compare/v3.2.0...v3.2.1)
|
package/index.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ export declare class Ableton extends EventEmitter implements ConnectionEventEmit
|
|
|
102
102
|
private serverPortFile;
|
|
103
103
|
private logger;
|
|
104
104
|
private clientState;
|
|
105
|
-
private
|
|
105
|
+
private cancelDisconnectEvents;
|
|
106
106
|
constructor(options?: AbletonOptions | undefined);
|
|
107
107
|
private handleConnect;
|
|
108
108
|
private handleDisconnect;
|
package/index.js
CHANGED
|
@@ -51,7 +51,7 @@ class Ableton extends events_1.EventEmitter {
|
|
|
51
51
|
serverPortFile;
|
|
52
52
|
logger;
|
|
53
53
|
clientState = "closed";
|
|
54
|
-
|
|
54
|
+
cancelDisconnectEvents = [];
|
|
55
55
|
constructor(options) {
|
|
56
56
|
super();
|
|
57
57
|
this.options = options;
|
|
@@ -166,17 +166,26 @@ class Ableton extends events_1.EventEmitter {
|
|
|
166
166
|
this.clientState = "started";
|
|
167
167
|
this.handleConnect("start");
|
|
168
168
|
const heartbeat = async () => {
|
|
169
|
+
// Add a cancel function to the array of heartbeats
|
|
170
|
+
let canceled = false;
|
|
171
|
+
const cancel = () => {
|
|
172
|
+
canceled = true;
|
|
173
|
+
this.logger?.debug("Cancelled heartbeat");
|
|
174
|
+
};
|
|
175
|
+
this.cancelDisconnectEvents.push(cancel);
|
|
169
176
|
try {
|
|
170
177
|
await this.internal.get("ping");
|
|
171
178
|
this.handleConnect("heartbeat");
|
|
172
179
|
}
|
|
173
180
|
catch (e) {
|
|
174
|
-
|
|
181
|
+
this.logger?.warn("Heartbeat failed:", { error: e, canceled });
|
|
182
|
+
// If the heartbeat has been canceled, don't emit a disconnect event
|
|
183
|
+
if (!canceled) {
|
|
175
184
|
this.handleDisconnect("heartbeat");
|
|
176
185
|
}
|
|
177
186
|
}
|
|
178
187
|
finally {
|
|
179
|
-
this.
|
|
188
|
+
this.cancelDisconnectEvents = this.cancelDisconnectEvents.filter((e) => e !== cancel);
|
|
180
189
|
}
|
|
181
190
|
};
|
|
182
191
|
this.heartbeatInterval = setInterval(heartbeat, this.options?.heartbeatInterval ?? 2000);
|
|
@@ -254,7 +263,7 @@ class Ableton extends events_1.EventEmitter {
|
|
|
254
263
|
if (data.event === "connect") {
|
|
255
264
|
// If some heartbeat ping from the old connection is still pending,
|
|
256
265
|
// cancel it to prevent a double disconnect/connect event.
|
|
257
|
-
this.
|
|
266
|
+
this.cancelDisconnectEvents.forEach((cancel) => cancel());
|
|
258
267
|
if (data.data?.port && data.data?.port !== this.serverPort) {
|
|
259
268
|
this.logger?.info("Got new server port via connect:", {
|
|
260
269
|
port: data.data.port,
|
package/midi-script/Clip.py
CHANGED
package/midi-script/Track.py
CHANGED
|
@@ -14,7 +14,14 @@ class Track(Interface):
|
|
|
14
14
|
return None
|
|
15
15
|
|
|
16
16
|
track_id = Interface.save_obj(track)
|
|
17
|
-
return {
|
|
17
|
+
return {
|
|
18
|
+
"id": track_id,
|
|
19
|
+
"name": track.name,
|
|
20
|
+
"color": track.color,
|
|
21
|
+
"color_index": track.color_index,
|
|
22
|
+
"is_foldable": track.is_foldable,
|
|
23
|
+
"is_grouped": track.is_grouped
|
|
24
|
+
}
|
|
18
25
|
|
|
19
26
|
@staticmethod
|
|
20
27
|
def serialize_routing_channel(channel):
|
package/midi-script/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
version = "3.2.
|
|
1
|
+
version = "3.2.4"
|