ableton-js 3.2.8 → 3.2.10

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,21 @@ 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.10](https://github.com/leolabs/ableton.js/compare/v3.2.9...v3.2.10)
8
+
9
+ - :sparkles: Remove the socket after closing it to avoid dangling event listeners trying to send messages after the plugin has been shut down [`54278f2`](https://github.com/leolabs/ableton.js/commit/54278f2b4ccb6efe34592fc108cd10c35e404e58)
10
+
11
+ #### [v3.2.9](https://github.com/leolabs/ableton.js/compare/v3.2.8...v3.2.9)
12
+
13
+ > 14 July 2023
14
+
15
+ - :sparkles: Only send the client port to Live once [`29e9443`](https://github.com/leolabs/ableton.js/commit/29e9443194294f5b55805df909d234b67e52eca2)
16
+ - :sparkles: Send the current client port to Live every time the server port changes [`eb42ce3`](https://github.com/leolabs/ableton.js/commit/eb42ce32f4fa91bd57e4c026a7d29d961afa0a04)
17
+
7
18
  #### [v3.2.8](https://github.com/leolabs/ableton.js/compare/v3.2.7...v3.2.8)
8
19
 
20
+ > 14 July 2023
21
+
9
22
  - :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
23
 
11
24
  #### [v3.2.7](https://github.com/leolabs/ableton.js/compare/v3.2.6...v3.2.7)
package/index.js CHANGED
@@ -120,12 +120,12 @@ class Ableton extends events_1.EventEmitter {
120
120
  });
121
121
  this.client.bind(undefined, "127.0.0.1");
122
122
  // Wait for the server port file to exist
123
- await new Promise(async (res) => {
123
+ const sentPort = await new Promise(async (res) => {
124
124
  try {
125
125
  const serverPort = await (0, promises_1.readFile)(this.serverPortFile);
126
126
  this.serverPort = Number(serverPort.toString());
127
127
  this.logger?.info("Server port:", { port: this.serverPort });
128
- res();
128
+ res(false);
129
129
  }
130
130
  catch (e) {
131
131
  this.logger?.info("Server doesn't seem to be online yet, waiting for it to go online...");
@@ -138,19 +138,33 @@ class Ableton extends events_1.EventEmitter {
138
138
  if (!isNaN(newPort) && newPort !== this.serverPort) {
139
139
  this.logger?.info("Server port changed:", { port: newPort });
140
140
  this.serverPort = Number(serverPort.toString());
141
+ if (this.client) {
142
+ try {
143
+ const port = this.client.address().port;
144
+ this.logger?.info("Sending port to Live:", { port });
145
+ await this.setProp("internal", "", "client_port", port);
146
+ res(true);
147
+ return;
148
+ }
149
+ catch (e) {
150
+ this.logger?.info("Sending port to Live failed", { e });
151
+ }
152
+ }
141
153
  }
142
- res();
154
+ res(false);
143
155
  }
144
156
  });
145
157
  });
146
158
  // Send used port to Live in case the plugin is already started
147
- try {
148
- const port = this.client.address().port;
149
- this.logger?.info("Sending port to Live:", { port });
150
- await this.setProp("internal", "", "client_port", port);
151
- }
152
- catch (e) {
153
- this.logger?.info("Live doesn't seem to be loaded yet, waiting...");
159
+ if (!sentPort) {
160
+ try {
161
+ const port = this.client.address().port;
162
+ this.logger?.info("Sending port to Live:", { port });
163
+ await this.setProp("internal", "", "client_port", port);
164
+ }
165
+ catch (e) {
166
+ this.logger?.info("Live doesn't seem to be loaded yet, waiting...");
167
+ }
154
168
  }
155
169
  this.logger?.info("Checking connection...");
156
170
  const connection = this.waitForConnection();
@@ -93,6 +93,7 @@ class Socket(object):
93
93
  def shutdown(self):
94
94
  self.log_message("Shutting down...")
95
95
  self._socket.close()
96
+ self._socket = None
96
97
 
97
98
  def init_socket(self, try_stored=False):
98
99
  self.log_message(
@@ -150,6 +151,9 @@ class Socket(object):
150
151
  # https://stackoverflow.com/questions/22819214/udp-message-too-long
151
152
  limit = 7500
152
153
 
154
+ if self._socket == None:
155
+ return
156
+
153
157
  if len(compressed) < limit:
154
158
  self._socket.sendto(b'\xFF' + compressed, self._client_addr)
155
159
  else:
@@ -1 +1 @@
1
- version = "3.2.8"
1
+ version = "3.2.10"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ableton-js",
3
- "version": "3.2.8",
3
+ "version": "3.2.10",
4
4
  "description": "Control Ableton Live from Node",
5
5
  "main": "index.js",
6
6
  "author": "Leo Bernard <admin@leolabs.org>",