accelr8 3.0.4 → 3.0.5

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/protocol.ts
4
- var VERSION = true ? "3.0.4" : "3.0.2";
4
+ var VERSION = true ? "3.0.5" : "3.0.2";
5
5
  var PROTO = 3;
6
6
  var PORT = 8787;
7
7
  var DEFAULT_SERVER = "wss://accelr8-canvas.patonchain.workers.dev";
@@ -7,7 +7,7 @@ import {
7
7
  VERSION,
8
8
  decode,
9
9
  encode
10
- } from "./chunk-I5NIANY6.js";
10
+ } from "./chunk-CZENTCH6.js";
11
11
  import {
12
12
  DEFAULT_MODEL,
13
13
  addAccount,
@@ -1186,23 +1186,41 @@ var DRAIN_KILL_MS = 2e3;
1186
1186
  var MAX_PLAYERS = 8;
1187
1187
  var STDERR_TAIL = 400;
1188
1188
  var VERIFY_MIN_BYTES = SAMPLE_RATE * 2 / 10;
1189
- var PLAYBACK_ARGS = [
1190
- "-hide_banner",
1191
- "-loglevel",
1192
- "error",
1193
- "-nodisp",
1194
- "-sync",
1195
- "audio",
1196
- "-infbuf",
1197
- "-f",
1198
- "s16le",
1199
- "-ar",
1200
- String(SAMPLE_RATE),
1201
- "-ch_layout",
1202
- "mono",
1203
- "-i",
1204
- "-"
1205
- ];
1189
+ function playbackArgs(ffplayPath) {
1190
+ const ch = ffplayChannelFlag(ffplayPath);
1191
+ return [
1192
+ "-hide_banner",
1193
+ "-loglevel",
1194
+ "error",
1195
+ "-nodisp",
1196
+ "-sync",
1197
+ "audio",
1198
+ "-infbuf",
1199
+ "-f",
1200
+ "s16le",
1201
+ "-ar",
1202
+ String(SAMPLE_RATE),
1203
+ ...ch,
1204
+ "-i",
1205
+ "-"
1206
+ ];
1207
+ }
1208
+ var chFlagCache = null;
1209
+ function ffplayChannelFlag(ffplayPath) {
1210
+ if (chFlagCache) return chFlagCache;
1211
+ let modern = true;
1212
+ try {
1213
+ const out = spawnSync(ffplayPath, ["-hide_banner", "-version"], { encoding: "utf8", timeout: 3e3 });
1214
+ const m = ((out.stdout || "") + (out.stderr || "")).match(/version\s+n?(\d+)\.(\d+)/i);
1215
+ if (m) {
1216
+ const major = +m[1], minor = +m[2];
1217
+ modern = major > 5 || major === 5 && minor >= 1;
1218
+ }
1219
+ } catch {
1220
+ }
1221
+ chFlagCache = modern ? ["-ch_layout", "mono"] : ["-ac", "1"];
1222
+ return chFlagCache;
1223
+ }
1206
1224
  function detectVoiceTools() {
1207
1225
  const ffmpegPath = which("ffmpeg");
1208
1226
  const ffplayPath = which("ffplay");
@@ -1422,7 +1440,7 @@ var VoicePlayback = class {
1422
1440
  spawnPlayer(speakerId) {
1423
1441
  let child;
1424
1442
  try {
1425
- child = spawn(this.tools.ffplayPath, PLAYBACK_ARGS, { stdio: ["pipe", "ignore", "ignore"] });
1443
+ child = spawn(this.tools.ffplayPath, playbackArgs(this.tools.ffplayPath), { stdio: ["pipe", "ignore", "ignore"] });
1426
1444
  } catch {
1427
1445
  return null;
1428
1446
  }
@@ -1657,13 +1675,19 @@ var voicePlayback = null;
1657
1675
  var voiceDevice = process.env.ACCELR8_MIC || void 0;
1658
1676
  var voiceRetries = 0;
1659
1677
  function autoPickMic() {
1660
- if (process.platform !== "darwin") return void 0;
1661
- const mics = listMicDevices();
1662
- if (!mics.length) return void 0;
1663
- const builtin = mics.find((m) => /macbook|built.?in|internal/i.test(m.name));
1664
- if (builtin) return builtin.index;
1665
- const notPhone = mics.find((m) => !/iphone|ipad|continuity|desk view/i.test(m.name));
1666
- return notPhone?.index;
1678
+ if (process.platform === "darwin") {
1679
+ const mics = listMicDevices();
1680
+ if (!mics.length) return void 0;
1681
+ const builtin = mics.find((m) => /macbook|built.?in|internal/i.test(m.name));
1682
+ if (builtin) return builtin.index;
1683
+ const notPhone = mics.find((m) => !/iphone|ipad|continuity|desk view/i.test(m.name));
1684
+ return notPhone?.index;
1685
+ }
1686
+ if (process.platform === "win32") {
1687
+ const mics = listMicDevices();
1688
+ return mics[0]?.index;
1689
+ }
1690
+ return void 0;
1667
1691
  }
1668
1692
  function startCapture() {
1669
1693
  if (!voiceCapture) return;
@@ -6,7 +6,7 @@ import {
6
6
  LIMITS,
7
7
  PORT,
8
8
  PROTO
9
- } from "./chunk-I5NIANY6.js";
9
+ } from "./chunk-CZENTCH6.js";
10
10
 
11
11
  // src/server.ts
12
12
  import { WebSocketServer, WebSocket } from "ws";
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DEFAULT_SERVER,
4
4
  PORT,
5
5
  VERSION
6
- } from "./chunks/chunk-I5NIANY6.js";
6
+ } from "./chunks/chunk-CZENTCH6.js";
7
7
 
8
8
  // src/cli.ts
9
9
  var HELP = `
@@ -52,7 +52,7 @@ async function main() {
52
52
  console.error(`invalid port: ${argVal(args, "--port")}`);
53
53
  process.exit(1);
54
54
  }
55
- const { runServer } = await import("./chunks/server-QZIOVRDR.js");
55
+ const { runServer } = await import("./chunks/server-OGAKQFOU.js");
56
56
  runServer(port);
57
57
  return;
58
58
  }
@@ -76,7 +76,7 @@ async function main() {
76
76
  const { cachedUpdate, refreshUpdateCache } = await import("./chunks/update-UEPNGB6Y.js");
77
77
  refreshUpdateCache();
78
78
  const update = cachedUpdate(VERSION);
79
- const { runClient } = await import("./chunks/client-BVLUBSS7.js");
79
+ const { runClient } = await import("./chunks/client-DGDZ22XC.js");
80
80
  runClient({
81
81
  name: argVal(args, "--name"),
82
82
  server: argVal(args, "--server"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accelr8",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "Collaborative ascii canvas in your terminal. Real multiplayer, live cursors, mouse-driven TUI.",
5
5
  "type": "module",
6
6
  "license": "ISC",