Skip to content

feat: CpalBackend wiring for TNC binaries + on-air test plan#105

Merged
dc0sk merged 2 commits intomainfrom
cpal-audio-backend
May 5, 2026
Merged

feat: CpalBackend wiring for TNC binaries + on-air test plan#105
dc0sk merged 2 commits intomainfrom
cpal-audio-backend

Conversation

@dc0sk
Copy link
Copy Markdown
Owner

@dc0sk dc0sk commented May 5, 2026

Summary

  • openpulse-config: new [audio] section — backend (cpal/loopback), input_device, output_device; default backend is cpal
  • openpulse-ardop + openpulse-kiss: cpal feature flag enables openpulse-audio/cpal-backend; --backend CLI flag overrides config; graceful fallback to loopback with warning when feature not compiled in
  • docs/on-air_testplan.md: full test plan with station setup, config examples, 5-test matrix, regulatory checklist, and diagnostics table

Build for production (real audio)

cargo build --release -p openpulse-kiss --features cpal
cargo build --release -p openpulse-ardop --features cpal

CI continues to use --no-default-features (loopback only — no hardware required).

Test plan

  • cargo test --workspace --no-default-features
  • cargo clippy --workspace --no-default-features -- -D warnings
  • cargo fmt --all -- --check

- openpulse-config: add [audio] section (backend, input_device,
  output_device); default backend is "cpal" for production builds
- openpulse-ardop + openpulse-kiss: add `cpal` feature flag that enables
  openpulse-audio/cpal-backend; add --backend CLI flag; select CpalBackend
  when feature is compiled in, fall back to loopback with a warning if not
- docs/on-air_testplan.md: detailed setup instructions, station config
  examples, test matrix (BPSK250 exchange, rate adaptation, Winlink RMS
  via RF, multi-mode ladder, ID compliance), diagnostics table
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds configurable audio-backend selection (CPAL vs loopback) to the ARDOP and KISS TNC binaries, extends openpulse-config with an [audio] section, and introduces an on-air test plan document to guide real-station validation.

Changes:

  • Add [audio] config (backend + device name fields) to openpulse-config and its generated config template.
  • Wire --backend CLI override + config-based backend selection into openpulse-tnc and openpulse-kisstnc, including a non-CPAL fallback path.
  • Add docs/on-air_testplan.md with station setup, build steps, and test matrix.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
docs/on-air_testplan.md New on-air validation plan and operational checklist for two-station testing.
crates/openpulse-kiss/src/main.rs Adds backend CLI/config selection and CPAL feature-gated wiring for the KISS TNC binary.
crates/openpulse-kiss/Cargo.toml Introduces a cpal feature that enables openpulse-audio/cpal-backend.
crates/openpulse-config/src/lib.rs Adds [audio] config section (backend + device names) and updates the init template.
crates/openpulse-ardop/src/main.rs Adds backend CLI/config selection and CPAL feature-gated wiring for the ARDOP TNC binary.
crates/openpulse-ardop/Cargo.toml Introduces a cpal feature that enables openpulse-audio/cpal-backend.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/on-air_testplan.md Outdated
Comment on lines +123 to +124
# Connect to the KISS TCP port and send a test AX.25 UI frame
echo -n "TEST" | socat - TCP:127.0.0.1:8100
Comment thread docs/on-air_testplan.md Outdated

```bash
# Long-running IRS session
./target/release/openpulse-tnc --mode BPSK250 --backend cpal --log debug
Comment thread crates/openpulse-kiss/src/main.rs Outdated
Comment on lines +67 to +68
name => anyhow::bail!("unknown audio backend '{name}' — use 'cpal' or 'loopback'"),
};
Comment thread crates/openpulse-kiss/src/main.rs Outdated
Comment on lines +61 to +65
"cpal" | "default" => {
tracing::warn!(
"cpal backend not compiled in (build with --features cpal); using loopback"
);
Box::new(LoopbackBackend::default())
Comment thread crates/openpulse-ardop/src/main.rs Outdated
Comment on lines +74 to +75
name => anyhow::bail!("unknown audio backend '{name}' — use 'cpal' or 'loopback'"),
};
Comment thread crates/openpulse-ardop/src/main.rs Outdated
Comment on lines +68 to +72
"cpal" | "default" => {
tracing::warn!(
"cpal backend not compiled in (build with --features cpal); using loopback"
);
Box::new(LoopbackBackend::default())
Comment thread crates/openpulse-config/src/lib.rs Outdated
Comment on lines +43 to +51
/// Audio backend and device selection.
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(default)]
pub struct AudioConfig {
/// Audio backend: `cpal` (real hardware) or `loopback` (testing).
pub backend: String,
/// Input device name. Empty string selects the system default.
pub input_device: String,
/// Output device name. Empty string selects the system default.
…t backend, fix testplan examples

- Remove input_device/output_device from AudioConfig (not wired to engine)
- Change AudioConfig default backend from "cpal" to "default"
- Split "cpal" vs "default" backend match arms: "default" silently falls back
  to loopback when cpal feature absent; "cpal" warns
- Update --backend help text and bail message to include "default"
- Update init_template [audio] section with backend option descriptions
- Fix KISS frame example in on-air_testplan.md (socat → Python socket)
- Replace --log debug with RUST_LOG=debug in testplan examples
- Remove input_device/output_device from testplan station config example
- Change testplan backend example from "cpal" to "default"
Copy link
Copy Markdown
Owner Author

@dc0sk dc0sk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-review updated changes.

@dc0sk
Copy link
Copy Markdown
Owner Author

dc0sk commented May 5, 2026

@copilot review

@dc0sk dc0sk merged commit a3fd4ab into main May 5, 2026
8 of 10 checks passed
@dc0sk dc0sk deleted the cpal-audio-backend branch May 5, 2026 16:41
Copilot stopped work on behalf of dc0sk due to an error May 5, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants