accelr8 3.0.2 → 3.0.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.
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
VERSION,
|
|
8
8
|
decode,
|
|
9
9
|
encode
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SY2ASAWX.js";
|
|
11
11
|
import {
|
|
12
12
|
DEFAULT_MODEL,
|
|
13
13
|
addAccount,
|
|
@@ -1181,6 +1181,7 @@ var SAMPLE_RATE = 16e3;
|
|
|
1181
1181
|
var CHUNK_BYTES = 1280;
|
|
1182
1182
|
var KILL_GRACE_MS = 300;
|
|
1183
1183
|
var SPEAKER_IDLE_MS = 2e3;
|
|
1184
|
+
var PREBUFFER_BYTES = 4800;
|
|
1184
1185
|
var DRAIN_KILL_MS = 2e3;
|
|
1185
1186
|
var MAX_PLAYERS = 8;
|
|
1186
1187
|
var STDERR_TAIL = 400;
|
|
@@ -1190,10 +1191,9 @@ var PLAYBACK_ARGS = [
|
|
|
1190
1191
|
"-loglevel",
|
|
1191
1192
|
"error",
|
|
1192
1193
|
"-nodisp",
|
|
1193
|
-
"-
|
|
1194
|
-
"
|
|
1195
|
-
"-
|
|
1196
|
-
"low_delay",
|
|
1194
|
+
"-sync",
|
|
1195
|
+
"audio",
|
|
1196
|
+
"-infbuf",
|
|
1197
1197
|
"-f",
|
|
1198
1198
|
"s16le",
|
|
1199
1199
|
"-ar",
|
|
@@ -1355,13 +1355,31 @@ var VoicePlayback = class {
|
|
|
1355
1355
|
if (!spawned) return;
|
|
1356
1356
|
p = spawned;
|
|
1357
1357
|
}
|
|
1358
|
-
if (!
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1358
|
+
if (!p.flowing) {
|
|
1359
|
+
p.pre.push(bytes);
|
|
1360
|
+
if (p.pre.reduce((n, b) => n + b.length, 0) >= PREBUFFER_BYTES) {
|
|
1361
|
+
const cushion = Buffer.concat(p.pre);
|
|
1362
|
+
p.pre = [];
|
|
1363
|
+
p.flowing = true;
|
|
1364
|
+
const np2 = this.writeOrRespawn(speakerId, p, cushion);
|
|
1365
|
+
if (np2) this.touch(speakerId, np2);
|
|
1366
|
+
} else {
|
|
1367
|
+
this.touch(speakerId, p);
|
|
1368
|
+
}
|
|
1369
|
+
return;
|
|
1363
1370
|
}
|
|
1364
|
-
this.
|
|
1371
|
+
const np = this.writeOrRespawn(speakerId, p, bytes);
|
|
1372
|
+
if (np) this.touch(speakerId, np);
|
|
1373
|
+
}
|
|
1374
|
+
/** Write to a player; on EPIPE (it died) respawn once and write there. Returns
|
|
1375
|
+
* the live player, or null if it couldn't be (re)spawned. */
|
|
1376
|
+
writeOrRespawn(speakerId, p, buf) {
|
|
1377
|
+
if (this.write(p, buf)) return p;
|
|
1378
|
+
this.reap(speakerId, p);
|
|
1379
|
+
const fresh = this.players.size < MAX_PLAYERS ? this.spawnPlayer(speakerId) : null;
|
|
1380
|
+
if (!fresh || !this.write(fresh, buf)) return null;
|
|
1381
|
+
fresh.flowing = true;
|
|
1382
|
+
return fresh;
|
|
1365
1383
|
}
|
|
1366
1384
|
/** Graceful close for one speaker (voiceStop): end stdin so ffplay drains
|
|
1367
1385
|
* its buffered audio, then a SIGKILL backstop after 2s (we dropped -autoexit,
|
|
@@ -1408,7 +1426,7 @@ var VoicePlayback = class {
|
|
|
1408
1426
|
} catch {
|
|
1409
1427
|
return null;
|
|
1410
1428
|
}
|
|
1411
|
-
const p = { child, alive: true, idleTimer: null };
|
|
1429
|
+
const p = { child, alive: true, idleTimer: null, pre: [], flowing: false };
|
|
1412
1430
|
child.stdin?.on("error", () => {
|
|
1413
1431
|
p.alive = false;
|
|
1414
1432
|
});
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DEFAULT_SERVER,
|
|
4
4
|
PORT,
|
|
5
5
|
VERSION
|
|
6
|
-
} from "./chunks/chunk-
|
|
6
|
+
} from "./chunks/chunk-SY2ASAWX.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-
|
|
55
|
+
const { runServer } = await import("./chunks/server-IVR5UHTM.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-
|
|
79
|
+
const { runClient } = await import("./chunks/client-HLMFYYAQ.js");
|
|
80
80
|
runClient({
|
|
81
81
|
name: argVal(args, "--name"),
|
|
82
82
|
server: argVal(args, "--server"),
|