ableton-js 3.2.0 → 3.2.2

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 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.2](https://github.com/leolabs/ableton.js/compare/v3.2.1...v3.2.2)
8
+
9
+ - :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
+
11
+ #### [v3.2.1](https://github.com/leolabs/ableton.js/compare/v3.2.0...v3.2.1)
12
+
13
+ > 12 June 2023
14
+
15
+ - :sparkles: Add the ability to warn when a command takes longer than expected [`24b046a`](https://github.com/leolabs/ableton.js/commit/24b046a6047945d1e5b4011d5b6912cbf2093158)
16
+
7
17
  #### [v3.2.0](https://github.com/leolabs/ableton.js/compare/v3.1.9...v3.2.0)
8
18
 
19
+ > 12 June 2023
20
+
9
21
  - :package: Upgrade TypeScript and related deps [`f1c3479`](https://github.com/leolabs/ableton.js/commit/f1c34791deaf6ea6f3040d957741756be0cb454c)
10
22
  - :sparkles: Allow changing the timeout for commands [`d216432`](https://github.com/leolabs/ableton.js/commit/d21643289b53cb727bd438a1a0aebb3f275bcad7)
11
23
  - :memo: Document class options [`b6c8b7c`](https://github.com/leolabs/ableton.js/commit/b6c8b7c2ed6242f78dd3b5d7343f98c984b1f59c)
package/index.d.ts CHANGED
@@ -66,6 +66,13 @@ export interface AbletonOptions {
66
66
  * @default 2000
67
67
  */
68
68
  commandTimeoutMs?: number;
69
+ /**
70
+ * Defines how long ableton-js waits for an answer from the Remote
71
+ * Script after sending a command logging a warning about the delay.
72
+ *
73
+ * @default 1000
74
+ */
75
+ commandWarnMs?: number;
69
76
  /**
70
77
  * Options for the response cache.
71
78
  */
package/index.js CHANGED
@@ -300,7 +300,14 @@ class Ableton extends events_1.EventEmitter {
300
300
  const currentTimestamp = Date.now();
301
301
  this.msgMap.set(msgId, {
302
302
  res: (result) => {
303
- this.setPing(Date.now() - currentTimestamp);
303
+ const duration = Date.now() - currentTimestamp;
304
+ if (duration > (this.options?.commandWarnMs ?? 1000)) {
305
+ this.logger?.warn(`Command took longer than expected`, {
306
+ command,
307
+ duration,
308
+ });
309
+ }
310
+ this.setPing(duration);
304
311
  clearTimeout(timeoutId);
305
312
  res(result);
306
313
  },
@@ -55,6 +55,11 @@ class AbletonJS(ControlSurface):
55
55
  callback=self.socket.process, interval=10, repeat=True)
56
56
 
57
57
  self.recv_loop.start()
58
+ self.tick()
59
+
60
+ def tick(self):
61
+ self.socket.process()
62
+ self.schedule_message(1, self.tick)
58
63
 
59
64
  def build_midi_map(self, midi_map_handle):
60
65
  script_handle = self._c_instance.handle()
@@ -1 +1 @@
1
- version = "3.2.0"
1
+ version = "3.2.2"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ableton-js",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "description": "Control Ableton Live from Node",
5
5
  "main": "index.js",
6
6
  "author": "Leo Bernard <admin@leolabs.org>",