No description
Find a file
2026-02-06 08:41:55 -07:00
.vim Milestone 2 2026-01-29 17:24:51 -07:00
docs Examples 2026-01-31 11:28:37 -07:00
examples Milestone 5 2026-01-29 21:13:18 -07:00
gui Fix node details 2026-02-06 08:41:55 -07:00
include/warppipe Node editor 2026-02-06 08:01:27 -07:00
perf Docs 2026-01-31 11:21:28 -07:00
src Fix node details 2026-02-06 08:41:55 -07:00
tests Docs 2026-01-31 11:21:28 -07:00
.clangd Milestone 2 2026-01-29 17:24:51 -07:00
.envrc Milestone 2 2026-01-29 17:24:51 -07:00
.envrc.example Milestone 2 2026-01-29 17:24:51 -07:00
.gitignore Fix sisyphus path 2026-01-31 11:36:06 -07:00
clangd-wrapper.sh Milestone 2 2026-01-29 17:24:51 -07:00
CMakeLists.txt Add custom routing 2026-01-30 16:39:52 -07:00
GUI_PLAN.md warppipe -> Warp Pipe 2026-01-31 11:44:55 -07:00
LSP_SETUP.md warppipe -> Warp Pipe 2026-01-31 11:44:55 -07:00
opencode.json Opencode lsp working 2026-01-30 07:09:57 -07:00
PLAN.md warppipe -> Warp Pipe 2026-01-31 11:44:55 -07:00
README.md warppipe -> Warp Pipe 2026-01-31 11:44:55 -07:00

Warp Pipe

Warp Pipe is a C++20 static library wrapping libpipewire for virtual audio node management, link routing, and per-app routing policy.

Features

  • Virtual sinks/sources — create Audio/Sink and Audio/Source nodes with configurable sample rate and channels
  • Link management — connect and disconnect ports by node+port name or ID, with passive and linger options
  • Per-app routing rules — match applications by name, process binary, or media role and auto-route to target sinks
  • Persistence — JSON config with atomic writes, auto-save on change, auto-load on startup
  • Volume control — set per-node volume and mute state
  • Audio metering — per-node and master peak meters
  • Metadata integration — read and set default audio sink/source via PipeWire metadata
  • Policy-only mode — observe and set metadata without creating links (avoids fighting WirePlumber)
  • Thread-safe — dedicated PipeWire thread loop; all public methods callable from any thread

Build

Requirements:

  • CMake 3.20+
  • pkg-config
  • libpipewire-0.3 development files
  • C++20 compiler
  • Qt6 6.2+ (for the GUI target; disable with -DWARPPIPE_BUILD_GUI=OFF)
  • Catch2 v3 (for tests; required when -DWARPPIPE_BUILD_TESTS=ON)
cmake -S . -B build
cmake --build build

Targets: warppipe (library), warppipe_example, warppipe_cli, warppipe_tests, warppipe_perf, warppipe-gui, warppipe-gui-tests

Dependencies

  • libpipewire-0.3 — system package
  • nlohmann/json — fetched automatically if not installed
  • Catch2 v3 — required for tests (via find_package)
  • Qt6 — required for warppipe-gui (default on)
  • QtNodes — fetched automatically when GUI is enabled

Quick Start

#include <warppipe/warppipe.hpp>

warppipe::ConnectionOptions opts;
opts.application_name = "my-app";
opts.config_path = "/home/user/.config/warppipe/config.json";

auto result = warppipe::Client::Create(opts);
auto& client = result.value;

// Create a virtual sink
auto sink = client->CreateVirtualSink("my-sink");

// Route Firefox audio to it
warppipe::RouteRule rule;
rule.match.application_name = "Firefox";
rule.target_node = "my-sink";
client->AddRouteRule(rule);

// The policy engine auto-links Firefox when it starts playing

CLI

warppipe_cli provides full access to the library for manual testing and scripting:

warppipe_cli list-nodes
warppipe_cli list-ports <node-id>
warppipe_cli list-links
warppipe_cli list-rules
warppipe_cli create-sink <name> [--rate N] [--channels N]
warppipe_cli create-source <name> [--rate N] [--channels N]
warppipe_cli link <out-node> <out-port> <in-node> <in-port> [--passive] [--linger]
warppipe_cli unlink <link-id>
warppipe_cli add-rule --app <name> --target <node> [--process <bin>] [--role <role>]
warppipe_cli remove-rule <rule-id>
warppipe_cli save-config <path>
warppipe_cli load-config <path>
warppipe_cli defaults

link uses node and port names (not IDs). --passive sets PW_KEY_LINK_PASSIVE, and --linger sets PW_KEY_OBJECT_LINGER so links persist after the client exits. defaults prints the current and configured default sink/source names.

create-sink and create-source block until interrupted with Ctrl-C.

Configuration

Config is JSON. Set ConnectionOptions::config_path to enable auto-save/load, or use SaveConfig/LoadConfig manually. The config persists virtual nodes, routing rules, saved links, and per-node volume/mute state.

{
  "version": 1,
  "virtual_nodes": [
    {
      "name": "warppipe-gaming-sink",
      "is_source": false,
      "rate": 48000,
      "channels": 2,
      "loopback": false,
      "target_node": "",
      "volume": 1.0,
      "mute": false
    }
  ],
  "route_rules": [
    {
      "match": {
        "application_name": "Firefox",
        "process_binary": "",
        "media_role": ""
      },
      "target_node": "warppipe-gaming-sink"
    }
  ],
  "links": [
    {
      "out_node": "Firefox",
      "out_port": "output_FL",
      "in_node": "warppipe-gaming-sink",
      "in_port": "input_FL"
    }
  ]
}

See docs/config-schema.md for full schema documentation.

Policy-Only Mode

When running alongside WirePlumber, enable policy_only to prevent Warp Pipe from creating links that conflict with the session manager:

warppipe::ConnectionOptions opts;
opts.policy_only = true;

In this mode the policy engine still evaluates rules but does not create links. Metadata defaults can still be read and set.

Documentation

  • API Reference — full API, threading model, error model, performance notes
  • Config Schema — JSON configuration format and persistence behavior
  • GUI Usage — how to run the Qt GUI and capture screenshots
  • Examples — common patterns and usage recipes

Tests

./build/warppipe_tests

31 test cases covering connection, registry, virtual nodes, links, route rules, policy engine, persistence, and metadata.

Performance

./build/warppipe_perf --mode <create-destroy|registry|links|policy|e2e>
Mode Workload Typical Result
create-destroy 200 sink create/destroy < 1s
registry 1000 object ingest + 100 events < 1s
links 200 link create/destroy < 1s
policy 200 ephemeral sources routed ~370ms
e2e 200 full iterations (sink + rule + source + teardown) median ~3ms, p95 ~4ms