Introduce initial implementation of the vmic CLI with PipeWire integration

- Added `Cargo.toml` to define dependencies and project metadata.
- Implemented core CLI functionality for managing virtual microphones (`create`, `edit`, `delete`, `list`, `route`, and `wipe` commands) using `clap`.
- Integrated `rusqlite` for persistent state storage and `pipewire` to manage PipeWire nodes.
- Ensured graceful handling of feedback loops and system defaults during virtual mic creation and deletion.
- Added error handling via `thiserror` for cleaner error definitions.
This commit is contained in:
2026-08-11 13:28:33 +02:00
parent 76c129a5dc
commit e19f398397
18 changed files with 2151 additions and 1 deletions

28
src/pw/mod.rs Normal file
View File

@@ -0,0 +1,28 @@
//! PipeWire control, split into three modules:
//!
//! - `graph` - live graph control (link/unlink ports, break feedback
//! rings, node/port/link introspection) via `pipewire-rs`,
//! using only numeric object ids and this program's own
//! ASCII node names.
//! - `loopback` - creates/destroys the two chained loopback stages and the
//! self-monitor loopback, built on top of `graph`.
//! - `text` - byte-safe text matching (`pactl` subprocess output) for
//! anything that has to match against human-authored,
//! possibly-multibyte device names/descriptions.
//!
//! Module *lifecycle* (spawning/loading the loopback stages and the
//! self-monitor) can't go through `graph`: `pw_context_load_module` loads a
//! module into the *calling process's own* context, which then has to keep
//! running its main loop forever for the module's nodes to keep producing
//! audio - that's what `pw-loopback` itself is. A one-shot CLI invocation
//! can't be that persistent host, so the two chained stages stay
//! `pw-loopback` subprocesses (tracked by pid), and the self-monitor stays a
//! `pactl load-module`/`unload-module` call. Everything downstream of
//! that - linking, unlinking, ring-breaking, liveness - is native
//! `pipewire-rs` via `graph`.
pub mod graph;
pub mod loopback;
pub mod text;
pub use graph::PwGraph;