forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprotocol.ts
More file actions
21 lines (20 loc) · 1.2 KB
/
Copy pathprotocol.ts
File metadata and controls
21 lines (20 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Audio-mute helper stdio opcodes (request frame: [uint32 LE len][1 byte opcode][JSON]).
//
// Deliberately decoupled from the automation/OCR helpers — its own opcode space
// and version, owned by Track 2. The pure length-prefixed framing
// (encodeRequest / FrameDecoder) is protocol-agnostic and shared from
// ../ocr/helperProtocol; only the opcodes + version live here.
export const OP_MUTE = 1
export const OP_RESTORE = 2
export const OP_HELLO = 3
// Bumped whenever the wire shape changes; the bridge asserts a match on spawn.
// Must equal ProtocolVersion in src/main/audio/helper/Program.cs.
// v2: MUTE's no-op response carries {reason, peak}, and the "is audio playing"
// test samples a window instead of a single instant (a single MasterPeakValue
// read is 0 between the render client's buffer fills, so v1 silently refused
// to mute while audio WAS playing).
// v3: MUTE returns the {deviceId} it muted and RESTORE accepts an optional
// {deviceId} hint, so a mute stranded by a killed helper (the endpoint mute is
// persistent OS state — it outlives the process) can still be undone by its
// replacement. The helper also unmutes on stdin EOF / exit.
export const PROTOCOL_VERSION = 3