@arcanewizards/timecode-toolbox 0.1.5 → 0.1.7

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/dist/index.js CHANGED
@@ -6781,7 +6781,7 @@ var createArtnet = (config) => {
6781
6781
  return;
6782
6782
  }
6783
6783
  const iface = await getInterface();
6784
- const bindAddress = iface.internal ? iface.address : iface.broadcastAddress;
6784
+ const bindAddress = iface.internal || process.platform === "win32" ? iface.address : iface.broadcastAddress;
6785
6785
  const socket = (0, import_dgram.createSocket)({ type: "udp4", reuseAddr: true });
6786
6786
  receiveSocket = socket;
6787
6787
  socket.on("message", (packet, source) => {
@@ -13208,7 +13208,7 @@ var createTCNetNode = (props) => {
13208
13208
  const nodes = {};
13209
13209
  const portInformation = {
13210
13210
  broadcastSend: {
13211
- direction: "output",
13211
+ direction: process.platform === "win32" ? "both" : "output",
13212
13212
  target: { type: "interface", interface: props.networkInterface },
13213
13213
  port: PORT_BROADCAST,
13214
13214
  status: "disabled"
@@ -13550,7 +13550,7 @@ var createTCNetNode = (props) => {
13550
13550
  {
13551
13551
  type: "udp4",
13552
13552
  reuseAddr: true,
13553
- reusePort: process.platform !== "darwin"
13553
+ reusePort: process.platform === "linux"
13554
13554
  },
13555
13555
  handleBroadcastMessage
13556
13556
  );
@@ -13559,7 +13559,7 @@ var createTCNetNode = (props) => {
13559
13559
  await bindSocket2(broadcastSendPort, PORT_BROADCAST, iface.address);
13560
13560
  } catch (err) {
13561
13561
  const error = new TCNetInitializationError(
13562
- `Failed to bind broadcast port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13562
+ `Failed to bind broadcast (send) port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13563
13563
  err instanceof Error ? err : new Error(String(err))
13564
13564
  );
13565
13565
  portInformation.broadcastSend.status = "error";
@@ -13569,46 +13569,48 @@ var createTCNetNode = (props) => {
13569
13569
  broadcastSendPort.setBroadcast(true);
13570
13570
  portInformation.broadcastSend.status = "active";
13571
13571
  sendPortStateChanged();
13572
- portInformation.broadcastRecv.status = "connecting";
13573
- const broadcastRecvPort = (0, import_dgram2.createSocket)(
13574
- {
13575
- type: "udp4",
13576
- reuseAddr: true,
13577
- reusePort: process.platform !== "darwin"
13578
- },
13579
- handleBroadcastMessage
13580
- );
13581
- sockets.broadcastRecv = broadcastRecvPort;
13582
- try {
13583
- await bindSocket2(
13584
- broadcastRecvPort,
13585
- PORT_BROADCAST,
13586
- iface.broadcastAddress
13587
- );
13588
- } catch (err) {
13589
- const error = new TCNetInitializationError(
13590
- `Failed to bind broadcast port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13591
- err instanceof Error ? err : new Error(String(err))
13572
+ if (process.platform !== "win32") {
13573
+ portInformation.broadcastRecv.status = "connecting";
13574
+ const broadcastRecvPort = (0, import_dgram2.createSocket)(
13575
+ {
13576
+ type: "udp4",
13577
+ reuseAddr: true,
13578
+ reusePort: process.platform === "linux"
13579
+ },
13580
+ handleBroadcastMessage
13592
13581
  );
13593
- portInformation.broadcastRecv.status = "error";
13594
- portInformation.broadcastRecv.errors = [error.message];
13595
- throw error;
13582
+ sockets.broadcastRecv = broadcastRecvPort;
13583
+ try {
13584
+ await bindSocket2(
13585
+ broadcastRecvPort,
13586
+ PORT_BROADCAST,
13587
+ iface.broadcastAddress
13588
+ );
13589
+ } catch (err) {
13590
+ const error = new TCNetInitializationError(
13591
+ `Failed to bind broadcast (receive) port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13592
+ err instanceof Error ? err : new Error(String(err))
13593
+ );
13594
+ portInformation.broadcastRecv.status = "error";
13595
+ portInformation.broadcastRecv.errors = [error.message];
13596
+ throw error;
13597
+ }
13598
+ broadcastRecvPort.setBroadcast(true);
13599
+ portInformation.broadcastRecv.status = "active";
13600
+ sendPortStateChanged();
13596
13601
  }
13597
- broadcastRecvPort.setBroadcast(true);
13598
- portInformation.broadcastRecv.status = "active";
13599
- sendPortStateChanged();
13600
13602
  portInformation.time.status = "connecting";
13601
13603
  const timePort = (0, import_dgram2.createSocket)(
13602
13604
  {
13603
13605
  type: "udp4",
13604
13606
  reuseAddr: true,
13605
- reusePort: process.platform !== "darwin"
13607
+ reusePort: process.platform === "linux"
13606
13608
  },
13607
13609
  handleTimeMessage
13608
13610
  );
13609
13611
  sockets.time = timePort;
13610
13612
  try {
13611
- await bindSocket2(timePort, PORT_TIME, iface.broadcastAddress);
13613
+ await bindSocket2(timePort, PORT_TIME, iface.address);
13612
13614
  } catch (err) {
13613
13615
  const error = new TCNetInitializationError(
13614
13616
  `Failed to bind time port ${PORT_TIME} on interface ${props.networkInterface}`,
@@ -14040,16 +14042,17 @@ var TcnetInputConnection = ({
14040
14042
  protocolVersion: nodeInfo.protocolVersion,
14041
14043
  details: [`Type: ${nodeInfo.nodeType}`]
14042
14044
  }));
14043
- const hasError = Object.values(connections).some(
14044
- (port) => port?.status === "error"
14045
+ const errors = Object.values(connections).flatMap(
14046
+ (port) => port?.errors ?? []
14045
14047
  );
14046
14048
  const isConnecting = Object.values(connections).some(
14047
14049
  (port) => port?.status === "connecting"
14048
14050
  );
14049
14051
  setConnection({
14050
- status: hasError ? "error" : isConnecting ? "connecting" : "active",
14052
+ status: errors.length > 0 ? "error" : isConnecting ? "connecting" : "active",
14051
14053
  clients,
14052
14054
  warnings,
14055
+ errors,
14053
14056
  timecode: timecodeGroup
14054
14057
  });
14055
14058
  };
@@ -14311,8 +14314,12 @@ var ArtnetOutputConnection = ({
14311
14314
  }
14312
14315
  if (timecodeState?.state === "playing" || timecodeState?.state === "lagging") {
14313
14316
  const tcState = timecodeState;
14317
+ let transmit = true;
14314
14318
  let timeoutId = null;
14315
14319
  const sendNextFrame = () => {
14320
+ if (!transmit) {
14321
+ return;
14322
+ }
14316
14323
  const time = (Date.now() - tcState.effectiveStartTimeMillis) * tcState.speed;
14317
14324
  artnetInstance.sendTimecode(mode, time).then(({ nextFrameTimeMillis }) => {
14318
14325
  const delay = nextFrameTimeMillis - time + 1;
@@ -14332,6 +14339,7 @@ var ArtnetOutputConnection = ({
14332
14339
  };
14333
14340
  scheduleNextFrame();
14334
14341
  return () => {
14342
+ transmit = false;
14335
14343
  if (timeoutId) {
14336
14344
  clearTimeout(timeoutId);
14337
14345
  }
@@ -14963,7 +14971,7 @@ var createApp = (props) => {
14963
14971
  };
14964
14972
 
14965
14973
  // package.json
14966
- var version = "0.1.5";
14974
+ var version = "0.1.7";
14967
14975
 
14968
14976
  // src/urls.ts
14969
14977
  var urls_exports = {};
package/dist/index.mjs CHANGED
@@ -6793,7 +6793,7 @@ var createArtnet = (config) => {
6793
6793
  return;
6794
6794
  }
6795
6795
  const iface = await getInterface();
6796
- const bindAddress = iface.internal ? iface.address : iface.broadcastAddress;
6796
+ const bindAddress = iface.internal || process.platform === "win32" ? iface.address : iface.broadcastAddress;
6797
6797
  const socket = createSocket({ type: "udp4", reuseAddr: true });
6798
6798
  receiveSocket = socket;
6799
6799
  socket.on("message", (packet, source) => {
@@ -13226,7 +13226,7 @@ var createTCNetNode = (props) => {
13226
13226
  const nodes = {};
13227
13227
  const portInformation = {
13228
13228
  broadcastSend: {
13229
- direction: "output",
13229
+ direction: process.platform === "win32" ? "both" : "output",
13230
13230
  target: { type: "interface", interface: props.networkInterface },
13231
13231
  port: PORT_BROADCAST,
13232
13232
  status: "disabled"
@@ -13568,7 +13568,7 @@ var createTCNetNode = (props) => {
13568
13568
  {
13569
13569
  type: "udp4",
13570
13570
  reuseAddr: true,
13571
- reusePort: process.platform !== "darwin"
13571
+ reusePort: process.platform === "linux"
13572
13572
  },
13573
13573
  handleBroadcastMessage
13574
13574
  );
@@ -13577,7 +13577,7 @@ var createTCNetNode = (props) => {
13577
13577
  await bindSocket2(broadcastSendPort, PORT_BROADCAST, iface.address);
13578
13578
  } catch (err) {
13579
13579
  const error = new TCNetInitializationError(
13580
- `Failed to bind broadcast port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13580
+ `Failed to bind broadcast (send) port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13581
13581
  err instanceof Error ? err : new Error(String(err))
13582
13582
  );
13583
13583
  portInformation.broadcastSend.status = "error";
@@ -13587,46 +13587,48 @@ var createTCNetNode = (props) => {
13587
13587
  broadcastSendPort.setBroadcast(true);
13588
13588
  portInformation.broadcastSend.status = "active";
13589
13589
  sendPortStateChanged();
13590
- portInformation.broadcastRecv.status = "connecting";
13591
- const broadcastRecvPort = createSocket2(
13592
- {
13593
- type: "udp4",
13594
- reuseAddr: true,
13595
- reusePort: process.platform !== "darwin"
13596
- },
13597
- handleBroadcastMessage
13598
- );
13599
- sockets.broadcastRecv = broadcastRecvPort;
13600
- try {
13601
- await bindSocket2(
13602
- broadcastRecvPort,
13603
- PORT_BROADCAST,
13604
- iface.broadcastAddress
13605
- );
13606
- } catch (err) {
13607
- const error = new TCNetInitializationError(
13608
- `Failed to bind broadcast port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13609
- err instanceof Error ? err : new Error(String(err))
13590
+ if (process.platform !== "win32") {
13591
+ portInformation.broadcastRecv.status = "connecting";
13592
+ const broadcastRecvPort = createSocket2(
13593
+ {
13594
+ type: "udp4",
13595
+ reuseAddr: true,
13596
+ reusePort: process.platform === "linux"
13597
+ },
13598
+ handleBroadcastMessage
13610
13599
  );
13611
- portInformation.broadcastRecv.status = "error";
13612
- portInformation.broadcastRecv.errors = [error.message];
13613
- throw error;
13600
+ sockets.broadcastRecv = broadcastRecvPort;
13601
+ try {
13602
+ await bindSocket2(
13603
+ broadcastRecvPort,
13604
+ PORT_BROADCAST,
13605
+ iface.broadcastAddress
13606
+ );
13607
+ } catch (err) {
13608
+ const error = new TCNetInitializationError(
13609
+ `Failed to bind broadcast (receive) port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13610
+ err instanceof Error ? err : new Error(String(err))
13611
+ );
13612
+ portInformation.broadcastRecv.status = "error";
13613
+ portInformation.broadcastRecv.errors = [error.message];
13614
+ throw error;
13615
+ }
13616
+ broadcastRecvPort.setBroadcast(true);
13617
+ portInformation.broadcastRecv.status = "active";
13618
+ sendPortStateChanged();
13614
13619
  }
13615
- broadcastRecvPort.setBroadcast(true);
13616
- portInformation.broadcastRecv.status = "active";
13617
- sendPortStateChanged();
13618
13620
  portInformation.time.status = "connecting";
13619
13621
  const timePort = createSocket2(
13620
13622
  {
13621
13623
  type: "udp4",
13622
13624
  reuseAddr: true,
13623
- reusePort: process.platform !== "darwin"
13625
+ reusePort: process.platform === "linux"
13624
13626
  },
13625
13627
  handleTimeMessage
13626
13628
  );
13627
13629
  sockets.time = timePort;
13628
13630
  try {
13629
- await bindSocket2(timePort, PORT_TIME, iface.broadcastAddress);
13631
+ await bindSocket2(timePort, PORT_TIME, iface.address);
13630
13632
  } catch (err) {
13631
13633
  const error = new TCNetInitializationError(
13632
13634
  `Failed to bind time port ${PORT_TIME} on interface ${props.networkInterface}`,
@@ -14058,16 +14060,17 @@ var TcnetInputConnection = ({
14058
14060
  protocolVersion: nodeInfo.protocolVersion,
14059
14061
  details: [`Type: ${nodeInfo.nodeType}`]
14060
14062
  }));
14061
- const hasError = Object.values(connections).some(
14062
- (port) => port?.status === "error"
14063
+ const errors = Object.values(connections).flatMap(
14064
+ (port) => port?.errors ?? []
14063
14065
  );
14064
14066
  const isConnecting = Object.values(connections).some(
14065
14067
  (port) => port?.status === "connecting"
14066
14068
  );
14067
14069
  setConnection({
14068
- status: hasError ? "error" : isConnecting ? "connecting" : "active",
14070
+ status: errors.length > 0 ? "error" : isConnecting ? "connecting" : "active",
14069
14071
  clients,
14070
14072
  warnings,
14073
+ errors,
14071
14074
  timecode: timecodeGroup
14072
14075
  });
14073
14076
  };
@@ -14334,8 +14337,12 @@ var ArtnetOutputConnection = ({
14334
14337
  }
14335
14338
  if (timecodeState?.state === "playing" || timecodeState?.state === "lagging") {
14336
14339
  const tcState = timecodeState;
14340
+ let transmit = true;
14337
14341
  let timeoutId = null;
14338
14342
  const sendNextFrame = () => {
14343
+ if (!transmit) {
14344
+ return;
14345
+ }
14339
14346
  const time = (Date.now() - tcState.effectiveStartTimeMillis) * tcState.speed;
14340
14347
  artnetInstance.sendTimecode(mode, time).then(({ nextFrameTimeMillis }) => {
14341
14348
  const delay = nextFrameTimeMillis - time + 1;
@@ -14355,6 +14362,7 @@ var ArtnetOutputConnection = ({
14355
14362
  };
14356
14363
  scheduleNextFrame();
14357
14364
  return () => {
14365
+ transmit = false;
14358
14366
  if (timeoutId) {
14359
14367
  clearTimeout(timeoutId);
14360
14368
  }
@@ -14991,7 +14999,7 @@ var createApp = (props) => {
14991
14999
  };
14992
15000
 
14993
15001
  // package.json
14994
- var version = "0.1.5";
15002
+ var version = "0.1.7";
14995
15003
 
14996
15004
  // src/urls.ts
14997
15005
  var urls_exports = {};
package/dist/start.js CHANGED
@@ -6782,7 +6782,7 @@ var createArtnet = (config) => {
6782
6782
  return;
6783
6783
  }
6784
6784
  const iface = await getInterface();
6785
- const bindAddress = iface.internal ? iface.address : iface.broadcastAddress;
6785
+ const bindAddress = iface.internal || process.platform === "win32" ? iface.address : iface.broadcastAddress;
6786
6786
  const socket = (0, import_dgram.createSocket)({ type: "udp4", reuseAddr: true });
6787
6787
  receiveSocket = socket;
6788
6788
  socket.on("message", (packet, source) => {
@@ -13209,7 +13209,7 @@ var createTCNetNode = (props) => {
13209
13209
  const nodes = {};
13210
13210
  const portInformation = {
13211
13211
  broadcastSend: {
13212
- direction: "output",
13212
+ direction: process.platform === "win32" ? "both" : "output",
13213
13213
  target: { type: "interface", interface: props.networkInterface },
13214
13214
  port: PORT_BROADCAST,
13215
13215
  status: "disabled"
@@ -13551,7 +13551,7 @@ var createTCNetNode = (props) => {
13551
13551
  {
13552
13552
  type: "udp4",
13553
13553
  reuseAddr: true,
13554
- reusePort: process.platform !== "darwin"
13554
+ reusePort: process.platform === "linux"
13555
13555
  },
13556
13556
  handleBroadcastMessage
13557
13557
  );
@@ -13560,7 +13560,7 @@ var createTCNetNode = (props) => {
13560
13560
  await bindSocket2(broadcastSendPort, PORT_BROADCAST, iface.address);
13561
13561
  } catch (err) {
13562
13562
  const error = new TCNetInitializationError(
13563
- `Failed to bind broadcast port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13563
+ `Failed to bind broadcast (send) port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13564
13564
  err instanceof Error ? err : new Error(String(err))
13565
13565
  );
13566
13566
  portInformation.broadcastSend.status = "error";
@@ -13570,46 +13570,48 @@ var createTCNetNode = (props) => {
13570
13570
  broadcastSendPort.setBroadcast(true);
13571
13571
  portInformation.broadcastSend.status = "active";
13572
13572
  sendPortStateChanged();
13573
- portInformation.broadcastRecv.status = "connecting";
13574
- const broadcastRecvPort = (0, import_dgram2.createSocket)(
13575
- {
13576
- type: "udp4",
13577
- reuseAddr: true,
13578
- reusePort: process.platform !== "darwin"
13579
- },
13580
- handleBroadcastMessage
13581
- );
13582
- sockets.broadcastRecv = broadcastRecvPort;
13583
- try {
13584
- await bindSocket2(
13585
- broadcastRecvPort,
13586
- PORT_BROADCAST,
13587
- iface.broadcastAddress
13588
- );
13589
- } catch (err) {
13590
- const error = new TCNetInitializationError(
13591
- `Failed to bind broadcast port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13592
- err instanceof Error ? err : new Error(String(err))
13573
+ if (process.platform !== "win32") {
13574
+ portInformation.broadcastRecv.status = "connecting";
13575
+ const broadcastRecvPort = (0, import_dgram2.createSocket)(
13576
+ {
13577
+ type: "udp4",
13578
+ reuseAddr: true,
13579
+ reusePort: process.platform === "linux"
13580
+ },
13581
+ handleBroadcastMessage
13593
13582
  );
13594
- portInformation.broadcastRecv.status = "error";
13595
- portInformation.broadcastRecv.errors = [error.message];
13596
- throw error;
13583
+ sockets.broadcastRecv = broadcastRecvPort;
13584
+ try {
13585
+ await bindSocket2(
13586
+ broadcastRecvPort,
13587
+ PORT_BROADCAST,
13588
+ iface.broadcastAddress
13589
+ );
13590
+ } catch (err) {
13591
+ const error = new TCNetInitializationError(
13592
+ `Failed to bind broadcast (receive) port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13593
+ err instanceof Error ? err : new Error(String(err))
13594
+ );
13595
+ portInformation.broadcastRecv.status = "error";
13596
+ portInformation.broadcastRecv.errors = [error.message];
13597
+ throw error;
13598
+ }
13599
+ broadcastRecvPort.setBroadcast(true);
13600
+ portInformation.broadcastRecv.status = "active";
13601
+ sendPortStateChanged();
13597
13602
  }
13598
- broadcastRecvPort.setBroadcast(true);
13599
- portInformation.broadcastRecv.status = "active";
13600
- sendPortStateChanged();
13601
13603
  portInformation.time.status = "connecting";
13602
13604
  const timePort = (0, import_dgram2.createSocket)(
13603
13605
  {
13604
13606
  type: "udp4",
13605
13607
  reuseAddr: true,
13606
- reusePort: process.platform !== "darwin"
13608
+ reusePort: process.platform === "linux"
13607
13609
  },
13608
13610
  handleTimeMessage
13609
13611
  );
13610
13612
  sockets.time = timePort;
13611
13613
  try {
13612
- await bindSocket2(timePort, PORT_TIME, iface.broadcastAddress);
13614
+ await bindSocket2(timePort, PORT_TIME, iface.address);
13613
13615
  } catch (err) {
13614
13616
  const error = new TCNetInitializationError(
13615
13617
  `Failed to bind time port ${PORT_TIME} on interface ${props.networkInterface}`,
@@ -14041,16 +14043,17 @@ var TcnetInputConnection = ({
14041
14043
  protocolVersion: nodeInfo.protocolVersion,
14042
14044
  details: [`Type: ${nodeInfo.nodeType}`]
14043
14045
  }));
14044
- const hasError = Object.values(connections).some(
14045
- (port) => port?.status === "error"
14046
+ const errors = Object.values(connections).flatMap(
14047
+ (port) => port?.errors ?? []
14046
14048
  );
14047
14049
  const isConnecting = Object.values(connections).some(
14048
14050
  (port) => port?.status === "connecting"
14049
14051
  );
14050
14052
  setConnection({
14051
- status: hasError ? "error" : isConnecting ? "connecting" : "active",
14053
+ status: errors.length > 0 ? "error" : isConnecting ? "connecting" : "active",
14052
14054
  clients,
14053
14055
  warnings,
14056
+ errors,
14054
14057
  timecode: timecodeGroup
14055
14058
  });
14056
14059
  };
@@ -14312,8 +14315,12 @@ var ArtnetOutputConnection = ({
14312
14315
  }
14313
14316
  if (timecodeState?.state === "playing" || timecodeState?.state === "lagging") {
14314
14317
  const tcState = timecodeState;
14318
+ let transmit = true;
14315
14319
  let timeoutId = null;
14316
14320
  const sendNextFrame = () => {
14321
+ if (!transmit) {
14322
+ return;
14323
+ }
14317
14324
  const time = (Date.now() - tcState.effectiveStartTimeMillis) * tcState.speed;
14318
14325
  artnetInstance.sendTimecode(mode, time).then(({ nextFrameTimeMillis }) => {
14319
14326
  const delay = nextFrameTimeMillis - time + 1;
@@ -14333,6 +14340,7 @@ var ArtnetOutputConnection = ({
14333
14340
  };
14334
14341
  scheduleNextFrame();
14335
14342
  return () => {
14343
+ transmit = false;
14336
14344
  if (timeoutId) {
14337
14345
  clearTimeout(timeoutId);
14338
14346
  }
@@ -14964,7 +14972,7 @@ var createApp = (props) => {
14964
14972
  };
14965
14973
 
14966
14974
  // package.json
14967
- var version = "0.1.5";
14975
+ var version = "0.1.7";
14968
14976
 
14969
14977
  // src/index.ts
14970
14978
  var runTimecodeToolboxServer = ({
package/dist/start.mjs CHANGED
@@ -6798,7 +6798,7 @@ var createArtnet = (config) => {
6798
6798
  return;
6799
6799
  }
6800
6800
  const iface = await getInterface();
6801
- const bindAddress = iface.internal ? iface.address : iface.broadcastAddress;
6801
+ const bindAddress = iface.internal || process.platform === "win32" ? iface.address : iface.broadcastAddress;
6802
6802
  const socket = createSocket({ type: "udp4", reuseAddr: true });
6803
6803
  receiveSocket = socket;
6804
6804
  socket.on("message", (packet, source) => {
@@ -13231,7 +13231,7 @@ var createTCNetNode = (props) => {
13231
13231
  const nodes = {};
13232
13232
  const portInformation = {
13233
13233
  broadcastSend: {
13234
- direction: "output",
13234
+ direction: process.platform === "win32" ? "both" : "output",
13235
13235
  target: { type: "interface", interface: props.networkInterface },
13236
13236
  port: PORT_BROADCAST,
13237
13237
  status: "disabled"
@@ -13573,7 +13573,7 @@ var createTCNetNode = (props) => {
13573
13573
  {
13574
13574
  type: "udp4",
13575
13575
  reuseAddr: true,
13576
- reusePort: process.platform !== "darwin"
13576
+ reusePort: process.platform === "linux"
13577
13577
  },
13578
13578
  handleBroadcastMessage
13579
13579
  );
@@ -13582,7 +13582,7 @@ var createTCNetNode = (props) => {
13582
13582
  await bindSocket2(broadcastSendPort, PORT_BROADCAST, iface.address);
13583
13583
  } catch (err) {
13584
13584
  const error = new TCNetInitializationError(
13585
- `Failed to bind broadcast port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13585
+ `Failed to bind broadcast (send) port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13586
13586
  err instanceof Error ? err : new Error(String(err))
13587
13587
  );
13588
13588
  portInformation.broadcastSend.status = "error";
@@ -13592,46 +13592,48 @@ var createTCNetNode = (props) => {
13592
13592
  broadcastSendPort.setBroadcast(true);
13593
13593
  portInformation.broadcastSend.status = "active";
13594
13594
  sendPortStateChanged();
13595
- portInformation.broadcastRecv.status = "connecting";
13596
- const broadcastRecvPort = createSocket2(
13597
- {
13598
- type: "udp4",
13599
- reuseAddr: true,
13600
- reusePort: process.platform !== "darwin"
13601
- },
13602
- handleBroadcastMessage
13603
- );
13604
- sockets.broadcastRecv = broadcastRecvPort;
13605
- try {
13606
- await bindSocket2(
13607
- broadcastRecvPort,
13608
- PORT_BROADCAST,
13609
- iface.broadcastAddress
13610
- );
13611
- } catch (err) {
13612
- const error = new TCNetInitializationError(
13613
- `Failed to bind broadcast port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13614
- err instanceof Error ? err : new Error(String(err))
13595
+ if (process.platform !== "win32") {
13596
+ portInformation.broadcastRecv.status = "connecting";
13597
+ const broadcastRecvPort = createSocket2(
13598
+ {
13599
+ type: "udp4",
13600
+ reuseAddr: true,
13601
+ reusePort: process.platform === "linux"
13602
+ },
13603
+ handleBroadcastMessage
13615
13604
  );
13616
- portInformation.broadcastRecv.status = "error";
13617
- portInformation.broadcastRecv.errors = [error.message];
13618
- throw error;
13605
+ sockets.broadcastRecv = broadcastRecvPort;
13606
+ try {
13607
+ await bindSocket2(
13608
+ broadcastRecvPort,
13609
+ PORT_BROADCAST,
13610
+ iface.broadcastAddress
13611
+ );
13612
+ } catch (err) {
13613
+ const error = new TCNetInitializationError(
13614
+ `Failed to bind broadcast (receive) port ${PORT_BROADCAST} on interface ${props.networkInterface}`,
13615
+ err instanceof Error ? err : new Error(String(err))
13616
+ );
13617
+ portInformation.broadcastRecv.status = "error";
13618
+ portInformation.broadcastRecv.errors = [error.message];
13619
+ throw error;
13620
+ }
13621
+ broadcastRecvPort.setBroadcast(true);
13622
+ portInformation.broadcastRecv.status = "active";
13623
+ sendPortStateChanged();
13619
13624
  }
13620
- broadcastRecvPort.setBroadcast(true);
13621
- portInformation.broadcastRecv.status = "active";
13622
- sendPortStateChanged();
13623
13625
  portInformation.time.status = "connecting";
13624
13626
  const timePort = createSocket2(
13625
13627
  {
13626
13628
  type: "udp4",
13627
13629
  reuseAddr: true,
13628
- reusePort: process.platform !== "darwin"
13630
+ reusePort: process.platform === "linux"
13629
13631
  },
13630
13632
  handleTimeMessage
13631
13633
  );
13632
13634
  sockets.time = timePort;
13633
13635
  try {
13634
- await bindSocket2(timePort, PORT_TIME, iface.broadcastAddress);
13636
+ await bindSocket2(timePort, PORT_TIME, iface.address);
13635
13637
  } catch (err) {
13636
13638
  const error = new TCNetInitializationError(
13637
13639
  `Failed to bind time port ${PORT_TIME} on interface ${props.networkInterface}`,
@@ -14063,16 +14065,17 @@ var TcnetInputConnection = ({
14063
14065
  protocolVersion: nodeInfo.protocolVersion,
14064
14066
  details: [`Type: ${nodeInfo.nodeType}`]
14065
14067
  }));
14066
- const hasError = Object.values(connections).some(
14067
- (port) => port?.status === "error"
14068
+ const errors = Object.values(connections).flatMap(
14069
+ (port) => port?.errors ?? []
14068
14070
  );
14069
14071
  const isConnecting = Object.values(connections).some(
14070
14072
  (port) => port?.status === "connecting"
14071
14073
  );
14072
14074
  setConnection({
14073
- status: hasError ? "error" : isConnecting ? "connecting" : "active",
14075
+ status: errors.length > 0 ? "error" : isConnecting ? "connecting" : "active",
14074
14076
  clients,
14075
14077
  warnings,
14078
+ errors,
14076
14079
  timecode: timecodeGroup
14077
14080
  });
14078
14081
  };
@@ -14339,8 +14342,12 @@ var ArtnetOutputConnection = ({
14339
14342
  }
14340
14343
  if (timecodeState?.state === "playing" || timecodeState?.state === "lagging") {
14341
14344
  const tcState = timecodeState;
14345
+ let transmit = true;
14342
14346
  let timeoutId = null;
14343
14347
  const sendNextFrame = () => {
14348
+ if (!transmit) {
14349
+ return;
14350
+ }
14344
14351
  const time = (Date.now() - tcState.effectiveStartTimeMillis) * tcState.speed;
14345
14352
  artnetInstance.sendTimecode(mode, time).then(({ nextFrameTimeMillis }) => {
14346
14353
  const delay = nextFrameTimeMillis - time + 1;
@@ -14360,6 +14367,7 @@ var ArtnetOutputConnection = ({
14360
14367
  };
14361
14368
  scheduleNextFrame();
14362
14369
  return () => {
14370
+ transmit = false;
14363
14371
  if (timeoutId) {
14364
14372
  clearTimeout(timeoutId);
14365
14373
  }
@@ -14996,7 +15004,7 @@ var createApp = (props) => {
14996
15004
  };
14997
15005
 
14998
15006
  // package.json
14999
- var version = "0.1.5";
15007
+ var version = "0.1.7";
15000
15008
 
15001
15009
  // src/index.ts
15002
15010
  var runTimecodeToolboxServer = ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcanewizards/timecode-toolbox",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -55,11 +55,11 @@
55
55
  "osc-js": "^2.4.1",
56
56
  "radix-ui": "^1.4.3",
57
57
  "@arcanewizards/apis": "^0.0.1",
58
- "@arcanewizards/artnet": "^0.1.4",
58
+ "@arcanewizards/artnet": "^0.1.5",
59
59
  "@arcanewizards/eslint-config": "^0.0.0",
60
60
  "@arcanewizards/net-utils": "^0.1.3",
61
- "@arcanewizards/sigil": "^0.1.7",
62
- "@arcanewizards/tcnet": "^0.1.3",
61
+ "@arcanewizards/sigil": "^0.1.8",
62
+ "@arcanewizards/tcnet": "^0.1.4",
63
63
  "@arcanewizards/typescript-config": "^0.0.0"
64
64
  },
65
65
  "dependencies": {