ableton-js 3.7.2 → 3.7.3
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 +6 -0
- package/midi-script/AbletonJS.py +1 -1
- package/midi-script/Socket.py +20 -7
- package/midi-script/version.py +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,14 @@ 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.7.3](https://github.com/leolabs/ableton.js/compare/v3.7.2...v3.7.3)
|
|
8
|
+
|
|
9
|
+
- :bug: Fix Live not properly sending "disconnect" events [`21fd462`](https://github.com/leolabs/ableton.js/commit/21fd46247fb62f753a5bab5f0549fb8a4998dbfc)
|
|
10
|
+
|
|
7
11
|
#### [v3.7.2](https://github.com/leolabs/ableton.js/compare/v3.7.1...v3.7.2)
|
|
8
12
|
|
|
13
|
+
> 2 December 2025
|
|
14
|
+
|
|
9
15
|
- Fix a missing str() coercion [`#136`](https://github.com/leolabs/ableton.js/pull/136)
|
|
10
16
|
- :bug: Fix issues with larger payloads not being received properly [`bed4e22`](https://github.com/leolabs/ableton.js/commit/bed4e226cb7febb448700c32979ce50a6a67ef69)
|
|
11
17
|
- :zap: Always assign a new port to the Python UDP server on start and store it in the port file [`47566f9`](https://github.com/leolabs/ableton.js/commit/47566f9eb347784746f6d50093491f3b2d591c58)
|
package/midi-script/AbletonJS.py
CHANGED
|
@@ -106,7 +106,7 @@ class AbletonJS(ControlSurface):
|
|
|
106
106
|
logger.info("Disconnecting")
|
|
107
107
|
if FAST_POLLING:
|
|
108
108
|
self.recv_loop.stop()
|
|
109
|
-
self.socket.send("disconnect")
|
|
109
|
+
self.socket.send("disconnect", immediate=True)
|
|
110
110
|
self.socket.shutdown()
|
|
111
111
|
Interface.listeners.clear()
|
|
112
112
|
super(AbletonJS, self).disconnect()
|
package/midi-script/Socket.py
CHANGED
|
@@ -77,13 +77,22 @@ class Socket(object):
|
|
|
77
77
|
self._client_addr = ("127.0.0.1", port)
|
|
78
78
|
|
|
79
79
|
if self._socket:
|
|
80
|
-
self.send(
|
|
80
|
+
self.send(
|
|
81
|
+
"connect", {"port": self._server_addr[1]}, immediate=True)
|
|
81
82
|
except Exception as e:
|
|
82
83
|
self.log_error_once(
|
|
83
84
|
"Couldn't read remote port file: " + str(e.args))
|
|
84
85
|
|
|
85
86
|
def shutdown(self):
|
|
86
87
|
logger.info("Shutting down...")
|
|
88
|
+
send_buffer_length = len(self._send_buffer)
|
|
89
|
+
|
|
90
|
+
for i, packet in enumerate(self._send_buffer):
|
|
91
|
+
logger.info("Sending remaining packet " + str(i) +
|
|
92
|
+
" of " + str(send_buffer_length))
|
|
93
|
+
self._socket.sendto(packet, self._client_addr)
|
|
94
|
+
|
|
95
|
+
self._send_buffer.clear()
|
|
87
96
|
self._socket.close()
|
|
88
97
|
self._socket = None
|
|
89
98
|
|
|
@@ -115,7 +124,7 @@ class Socket(object):
|
|
|
115
124
|
raise e
|
|
116
125
|
|
|
117
126
|
try:
|
|
118
|
-
self.send("connect", {"port": port})
|
|
127
|
+
self.send("connect", {"port": port}, immediate=True)
|
|
119
128
|
except Exception as e:
|
|
120
129
|
logger.error("Couldn't send connect to " +
|
|
121
130
|
str(self._client_addr) + ":")
|
|
@@ -137,7 +146,7 @@ class Socket(object):
|
|
|
137
146
|
callback=self.init_socket, interval=5000, repeat=False)
|
|
138
147
|
t.start()
|
|
139
148
|
|
|
140
|
-
def _sendto(self, msg):
|
|
149
|
+
def _sendto(self, msg, immediate):
|
|
141
150
|
'''Send a raw message to the client, compressed and chunked, if necessary'''
|
|
142
151
|
compressed = zlib.compress(msg.encode("utf8")) + b'\n'
|
|
143
152
|
|
|
@@ -148,8 +157,12 @@ class Socket(object):
|
|
|
148
157
|
message_id_byte = struct.pack("B", self._message_id)
|
|
149
158
|
|
|
150
159
|
if len(compressed) < self._chunk_limit:
|
|
151
|
-
|
|
152
|
-
|
|
160
|
+
packet = message_id_byte + b'\x00\x01' + compressed
|
|
161
|
+
|
|
162
|
+
if immediate:
|
|
163
|
+
self._socket.sendto(packet, self._client_addr)
|
|
164
|
+
else:
|
|
165
|
+
self._send_buffer.append(packet)
|
|
153
166
|
else:
|
|
154
167
|
chunks = list(split_by_n(compressed, self._chunk_limit))
|
|
155
168
|
count = len(chunks)
|
|
@@ -159,7 +172,7 @@ class Socket(object):
|
|
|
159
172
|
self._send_buffer.append(
|
|
160
173
|
message_id_byte + packet_byte + count_byte + chunk)
|
|
161
174
|
|
|
162
|
-
def send(self, name, obj=None, uuid=None):
|
|
175
|
+
def send(self, name, obj=None, uuid=None, immediate=False):
|
|
163
176
|
def jsonReplace(o):
|
|
164
177
|
try:
|
|
165
178
|
return list(o)
|
|
@@ -173,7 +186,7 @@ class Socket(object):
|
|
|
173
186
|
try:
|
|
174
187
|
data = json.dumps(
|
|
175
188
|
{"event": name, "data": obj, "uuid": uuid}, default=jsonReplace, ensure_ascii=False)
|
|
176
|
-
self._sendto(data)
|
|
189
|
+
self._sendto(data, immediate)
|
|
177
190
|
except socket.error as e:
|
|
178
191
|
logger.error("Socket error:")
|
|
179
192
|
logger.exception(e)
|
package/midi-script/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
version = "3.7.
|
|
1
|
+
version = "3.7.3"
|