ableton-js 3.2.6 → 3.2.8

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,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.2.8](https://github.com/leolabs/ableton.js/compare/v3.2.7...v3.2.8)
8
+
9
+ - :wrench: Make fast polling optional, in an attempt to fix flaky behavior in Live 11.3 [`17f1634`](https://github.com/leolabs/ableton.js/commit/17f16342896f5f1989ef7f5147a7b3fce1e924fa)
10
+
11
+ #### [v3.2.7](https://github.com/leolabs/ableton.js/compare/v3.2.6...v3.2.7)
12
+
13
+ > 6 July 2023
14
+
15
+ - :white_check_mark: Switch from Jest to Vitest for faster testing [`d2af8b7`](https://github.com/leolabs/ableton.js/commit/d2af8b756ff9dfe2d76927d2695fba55226ab480)
16
+ - :mute: Don't log the result of setting the client port [`2206ab7`](https://github.com/leolabs/ableton.js/commit/2206ab74afc9d2388059d88a863dc8e5eed5a32f)
17
+ - :sparkles: When client is already starting or started, return a promise that waits for a connection [`97c2e1a`](https://github.com/leolabs/ableton.js/commit/97c2e1a81cbe3e8e7ee2f8ef7d349903b728e67e)
18
+
7
19
  #### [v3.2.6](https://github.com/leolabs/ableton.js/compare/v3.2.5...v3.2.6)
8
20
 
21
+ > 5 July 2023
22
+
9
23
  - :bug: Fix Live 11.3.3 hanging in some scenarios [`f3933b1`](https://github.com/leolabs/ableton.js/commit/f3933b1b714d1d87a1e4952bc142d017d513242b)
10
24
  - :mute: Make logging less noisy when the heartbeat to Live fails [`2f46968`](https://github.com/leolabs/ableton.js/commit/2f46968db10ce82288fb221d5c6e22e5fb0c6972)
11
25
  - :loud_sound: Truncate arguments in the error message when a command times out [`8bd0a9c`](https://github.com/leolabs/ableton.js/commit/8bd0a9cd7f1b4864e163fd22d87997f0d1c3dc30)
package/index.d.ts CHANGED
@@ -118,7 +118,7 @@ export declare class Ableton extends EventEmitter implements ConnectionEventEmit
118
118
  * If set, the function will throw an error if it can't establish a connection
119
119
  * in the given time. Should be higher than 2000ms to avoid false positives.
120
120
  */
121
- start(timeoutMs?: number): Promise<void>;
121
+ start(timeoutMs?: number): Promise<unknown>;
122
122
  /** Closes the client */
123
123
  close(): Promise<void>;
124
124
  /**
package/index.js CHANGED
@@ -107,7 +107,7 @@ class Ableton extends events_1.EventEmitter {
107
107
  async start(timeoutMs) {
108
108
  if (this.clientState !== "closed") {
109
109
  this.logger?.warn("Tried calling start, but client is already " + this.clientState);
110
- return;
110
+ return this.waitForConnection();
111
111
  }
112
112
  this.clientState = "starting";
113
113
  this.client = dgram_1.default.createSocket({ type: "udp4" });
@@ -147,8 +147,7 @@ class Ableton extends events_1.EventEmitter {
147
147
  try {
148
148
  const port = this.client.address().port;
149
149
  this.logger?.info("Sending port to Live:", { port });
150
- const result = await this.setProp("internal", "", "client_port", port);
151
- this.logger?.info("Got response from Live:", { port, result });
150
+ await this.setProp("internal", "", "client_port", port);
152
151
  }
153
152
  catch (e) {
154
153
  this.logger?.info("Live doesn't seem to be loaded yet, waiting...");
@@ -1,7 +1,7 @@
1
1
  from __future__ import absolute_import
2
2
 
3
3
  from .version import version
4
- from .Config import DEBUG
4
+ from .Config import DEBUG, FAST_POLLING
5
5
  from .Socket import Socket
6
6
  from .Interface import Interface
7
7
  from .Application import Application
@@ -51,12 +51,14 @@ class AbletonJS(ControlSurface):
51
51
  "clip": Clip(c_instance, self.socket),
52
52
  }
53
53
 
54
- self.recv_loop = Live.Base.Timer(
55
- callback=self.socket.process, interval=10, repeat=True)
56
-
57
- self.recv_loop.start()
58
54
  self.tick()
59
55
 
56
+ if FAST_POLLING:
57
+ self.recv_loop = Live.Base.Timer(
58
+ callback=self.socket.process, interval=10, repeat=True)
59
+
60
+ self.recv_loop.start()
61
+
60
62
  def tick(self):
61
63
  self.socket.process()
62
64
  self.schedule_message(1, self.tick)
@@ -76,7 +78,8 @@ class AbletonJS(ControlSurface):
76
78
 
77
79
  def disconnect(self):
78
80
  self.log_message("Disconnecting")
79
- self.recv_loop.stop()
81
+ if FAST_POLLING:
82
+ self.recv_loop.stop()
80
83
  self.socket.send("disconnect")
81
84
  self.socket.shutdown()
82
85
  Interface.listeners.clear()
@@ -1 +1,3 @@
1
1
  DEBUG = False
2
+
3
+ FAST_POLLING = False
@@ -1 +1 @@
1
- version = "3.2.6"
1
+ version = "3.2.8"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ableton-js",
3
- "version": "3.2.6",
3
+ "version": "3.2.8",
4
4
  "description": "Control Ableton Live from Node",
5
5
  "main": "index.js",
6
6
  "author": "Leo Bernard <admin@leolabs.org>",
@@ -27,23 +27,20 @@
27
27
  "build:doc": "jsdoc2md --files src/**/*.ts --configure ./jsdoc2md.json > ./API.md",
28
28
  "version": "node hooks/prepublish.js && git add midi-script/version.py && auto-changelog -p -l 100 && git add CHANGELOG.md",
29
29
  "build": "tsc",
30
- "test": "jest --runInBand"
30
+ "test": "vitest --run --no-threads"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/jest": "^26.0.23",
34
33
  "@types/lodash": "^4.14.194",
35
34
  "@types/node": "^20.3.0",
36
35
  "@types/node-uuid": "^0.0.28",
37
36
  "@types/semver": "^7.3.6",
38
37
  "@types/uuid": "^8.3.0",
39
38
  "auto-changelog": "^2.3.0",
40
- "jest": "^27.0.3",
41
- "jest-extended": "^0.11.5",
42
39
  "lodash": "^4.17.21",
43
40
  "p-all": "^3",
44
- "ts-jest": "^29.1.0",
45
- "ts-node": "^10.9.1",
46
- "typescript": "^5.1.3"
41
+ "tsx": "^3.12.7",
42
+ "typescript": "^5.1.3",
43
+ "vitest": "^0.32.4"
47
44
  },
48
45
  "dependencies": {
49
46
  "lru-cache": "^7.14.0",
package/jest.config.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- roots: ["<rootDir>/src"],
3
- transform: {
4
- "^.+\\.tsx?$": "ts-jest",
5
- },
6
- setupFilesAfterEnv: ["jest-extended"],
7
- };
@@ -1 +0,0 @@
1
- import "jest-extended";
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tests_1 = require("../util/tests");
4
- require("jest-extended");
5
- const gettableProps = [
6
- "browse_mode",
7
- "focused_document_view",
8
- ];
9
- describe("Application", () => {
10
- it("should be able to read all properties without erroring", async () => {
11
- await (0, tests_1.withAbleton)(async (ab) => {
12
- await Promise.all(gettableProps.map((p) => ab.application.view.get(p)));
13
- });
14
- });
15
- });
@@ -1 +0,0 @@
1
- import "jest-extended";
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tests_1 = require("../util/tests");
4
- require("jest-extended");
5
- const gettableProps = [
6
- "major_version",
7
- "minor_version",
8
- "bugfix_version",
9
- "version",
10
- "open_dialog_count",
11
- "current_dialog_message",
12
- "current_dialog_button_count",
13
- ];
14
- describe("Application", () => {
15
- it("should be able to read all properties without erroring", async () => {
16
- await (0, tests_1.withAbleton)(async (ab) => {
17
- await Promise.all(gettableProps.map((p) => ab.application.get(p)));
18
- });
19
- });
20
- });
@@ -1 +0,0 @@
1
- import "jest-extended";
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tests_1 = require("../util/tests");
4
- require("jest-extended");
5
- const gettableProps = [
6
- //"crossfade_assign", (not applicable to the master track)
7
- "crossfader",
8
- "cue_volume",
9
- "left_split_stereo",
10
- "panning",
11
- "panning_mode",
12
- "right_split_stereo",
13
- "sends",
14
- "song_tempo",
15
- "track_activator",
16
- "volume",
17
- ];
18
- describe("Mixer Device", () => {
19
- it("should be able to read all properties without erroring", async () => {
20
- await (0, tests_1.withAbleton)(async (ab) => {
21
- const masterTrack = await ab.song.get("master_track");
22
- const mixerDevice = await masterTrack.get("mixer_device");
23
- await Promise.all(gettableProps.map((p) => mixerDevice.get(p)));
24
- });
25
- });
26
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tests_1 = require("../util/tests");
4
- const gettableProps = [
5
- "detail_clip",
6
- "draw_mode",
7
- "follow_song",
8
- "highlighted_clip_slot",
9
- "selected_chain",
10
- "selected_parameter",
11
- "selected_scene",
12
- "selected_track",
13
- ];
14
- describe("Song View", () => {
15
- it("should be able to read all properties without erroring", async () => {
16
- await (0, tests_1.withAbleton)(async (ab) => {
17
- await Promise.all(gettableProps.map((p) => ab.song.view.get(p)));
18
- });
19
- });
20
- });
package/ns/song.spec.d.ts DELETED
@@ -1 +0,0 @@
1
- import "jest-extended";
package/ns/song.spec.js DELETED
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tests_1 = require("../util/tests");
4
- require("jest-extended");
5
- const gettableProps = [
6
- "arrangement_overdub",
7
- "back_to_arranger",
8
- "can_capture_midi",
9
- "can_jump_to_next_cue",
10
- "can_jump_to_prev_cue",
11
- "can_redo",
12
- "can_undo",
13
- "clip_trigger_quantization",
14
- "count_in_duration",
15
- "cue_points",
16
- "current_song_time",
17
- "exclusive_arm",
18
- "exclusive_solo",
19
- "groove_amount",
20
- "is_counting_in",
21
- "is_playing",
22
- "last_event_time",
23
- "loop",
24
- "loop_length",
25
- "loop_start",
26
- "master_track",
27
- "metronome",
28
- "midi_recording_quantization",
29
- "nudge_down",
30
- "nudge_up",
31
- "overdub",
32
- "punch_in",
33
- "punch_out",
34
- "re_enable_automation_enabled",
35
- "record_mode",
36
- "return_tracks",
37
- "root_note",
38
- "scale_name",
39
- "scenes",
40
- "select_on_launch",
41
- "session_automation_record",
42
- "session_record",
43
- "session_record_status",
44
- "signature_denominator",
45
- "signature_numerator",
46
- "song_length",
47
- "swing_amount",
48
- "tempo",
49
- "tracks",
50
- "visible_tracks",
51
- ];
52
- describe("Song", () => {
53
- it("should be able to read all properties without erroring", async () => {
54
- await (0, tests_1.withAbleton)(async (ab) => {
55
- await Promise.all(gettableProps.map((p) => ab.song.get(p)));
56
- });
57
- });
58
- it("should return the proper types for properties", async () => {
59
- await (0, tests_1.withAbleton)(async (ab) => {
60
- const songTime = await ab.song.get("current_song_time");
61
- expect(songTime).toBeNumber();
62
- const clipTriggerQuantization = await ab.song.get("clip_trigger_quantization");
63
- expect(clipTriggerQuantization).toBeString();
64
- const isPlaying = await ab.song.get("is_playing");
65
- expect(isPlaying).toBeBoolean();
66
- });
67
- });
68
- it("should be able to write and read large objects from the project", async () => {
69
- await (0, tests_1.withAbleton)(async (ab) => {
70
- const largeArray = [];
71
- for (let i = 0; i < 100000; i++) {
72
- largeArray.push(i);
73
- }
74
- await ab.song.setData("abletonjs_test", largeArray);
75
- const received = await ab.song.getData("abletonjs_test");
76
- expect(received).toEqual(largeArray);
77
- });
78
- });
79
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const package_version_1 = require("./package-version");
4
- const semver_1 = require("semver");
5
- describe("Package Version", () => {
6
- it("should get a valid package version without erroring", () => {
7
- const version = (0, package_version_1.getPackageVersion)();
8
- expect((0, semver_1.valid)(version)).toBeTruthy();
9
- });
10
- });