Files
client/scripts/lib/appaudio-pcm-fixture.cjs
T
omar e6464bc4ed feat: checkpoint account-free client workflows and source-matched UI
Preserve accumulated client implementation since v0.1.4, including local identities, multi-server state, chat, administration, audio and streaming controls. Refine official-source layout, original artwork, responsive composer overflow, settings navigation and chat scroll anchoring.

Current verification: Node suite passes; isolated packaged chat and responsive control smokes pass without device capture. Native core is reused, not rebuilt in this pass. Strict whole-screen visual parity remains incomplete; no 1:1 or cross-platform acceptance claim. Local checkpoint only; no release or push.
2026-11-01 19:43:18 +03:00

26 lines
1.6 KiB
JavaScript

'use strict';
// Synthetic transport diagnostic ONLY: not WASAPI, PulseAudio or isolation proof.
// No audio device is opened. Emits the exact native helper wire contract.
const mode = process.argv[2];
const ids = ['fixture:440', 'fixture:997'];
if (mode === 'list') {
process.stdout.write(`${JSON.stringify({ supported: true, platform: 'synthetic-diagnostic', scope: 'process-tree', hostAncestors: [Number(process.env.APPAUDIO_FIXTURE_HOST_PID)], applications: ids.map((id, index) => ({ id, label: `Synthetic PCM ${index ? 997 : 440} Hz (not native capture)`, pid: 44044 + index, ancestors: [] })) })}\n`);
} else if (mode === 'capture' && ids.includes(process.argv[3])) {
const frequency = process.argv[3] === ids[0] ? 440 : 997;
process.stdout.write(`${JSON.stringify({ event: 'format', sampleRate: 48000, channels: 2, format: 's16le', frames: 960 })}\n`);
let sequence = 0;
let sample = 0;
const timer = setInterval(() => {
const pcm = Buffer.allocUnsafe(3840);
for (let frame = 0; frame < 960; frame++, sample++) {
const value = Math.round(327 * Math.sin(2 * Math.PI * frequency * sample / 48000));
pcm.writeInt16LE(value, frame * 4); pcm.writeInt16LE(value, frame * 4 + 2);
}
if (process.stdout.writableLength < 32768) process.stdout.write(`${JSON.stringify({ event: 'pcm', sequence: sequence++, pcm: pcm.toString('base64') })}\n`);
}, 20);
const stop = () => { clearInterval(timer); process.exit(0); };
process.stdin.resume();
process.stdin.on('end', stop);
process.stdin.on('data', stop);
} else { process.stderr.write('Invalid synthetic fixture mode.'); process.exitCode = 1; }