@soundworks/core 4.0.0-alpha.26 → 4.0.0-alpha.28

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
@@ -1,3 +1,11 @@
1
+ ## v4.0.0-alpha.28 - 06/09/2025
2
+
3
+ - Fix: make it can work without `node_modules` when bundled to `.cjs` for use in Max
4
+
5
+ ## v4.0.0-alpha.27 - 06/09/2025
6
+
7
+ - Fix: assign to `const`
8
+
1
9
  ## v4.0.0-alpha.26 - 05/09/2025
2
10
 
3
11
  - Fix: improve reconnect strategy in case of socket connection failure
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soundworks/core",
3
- "version": "4.0.0-alpha.26",
3
+ "version": "4.0.0-alpha.28",
4
4
  "description": "Open-source creative coding framework for distributed applications based on Web technologies",
5
5
  "authors": [
6
6
  "Benjamin Matuszewski",
@@ -1,2 +1,2 @@
1
1
  // [WARNING] This file is generated, do not edit
2
- export default '4.0.0-alpha.26';
2
+ export default '4.0.0-alpha.28';
@@ -173,7 +173,7 @@ class Sockets {
173
173
  * JSON compatible data types (i.e. string, number, boolean, object, array and null).
174
174
  */
175
175
  broadcast(roomIds, excludeSocket, channel, ...args) {
176
- const targets = new Set();
176
+ let targets = new Set();
177
177
 
178
178
  if (typeof roomIds === 'string' || Array.isArray(roomIds)) {
179
179
  if (typeof roomIds === 'string') {
@@ -4,6 +4,7 @@
4
4
  // Should move back to regular esm module once Max has fixed its loader
5
5
  export default `
6
6
  const { parentPort } = require('node:worker_threads');
7
+ const { hrtime } = require('node:process');
7
8
 
8
9
  let stack = [];
9
10
  let averageLatencyWindow = 5;
@@ -13,12 +14,14 @@ let intervalId = null;
13
14
  let meanLatency = 0;
14
15
 
15
16
  // workaround that sc-utils is pure emascript module
16
- let getTime;
17
- let inited = new Promise(async (resolve) => {
18
- module = await import('@ircam/sc-utils');
19
- getTime = module.getTime;
20
- resolve(true);
21
- });
17
+ // 2024/09/06 - Just copy getTime implementation so that we don't even need the node_modules
18
+ const start = hrtime.bigint();
19
+
20
+ function getTime() {
21
+ const now = hrtime.bigint();
22
+ const delta = now - start;
23
+ return Number(delta) * 1e-9;
24
+ }
22
25
 
23
26
  parentPort.on('message', async msg => {
24
27
  switch (msg.type) {
@@ -26,7 +29,6 @@ parentPort.on('message', async msg => {
26
29
  averageLatencyWindow = msg.value.averageLatencyWindow;
27
30
  averageLatencyPeriod = msg.value.averageLatencyPeriod;
28
31
 
29
- await inited;
30
32
  // launch compute in its own loop so that the number of computation is
31
33
  // decoupled from the number of connected clients
32
34
  clearInterval(intervalId);