Skip to content

Commit 1c91f5f

Browse files
authored
Feat/version 1.8 - Add real-time audio monitoring with PipeWire API #45 from Peter-L-SVK/stage
Implemented complete monitoring tab with real-time audio level meters using native PipeWire integration. Replaces simulated audio levels with actual system audio monitoring by capturing output from monitor sources. **Key Features:** - Real-time audio level monitoring via PipeWire monitor streams - Stereo channel visualization with peak/RMS calculations - Thread-safe communication between audio capture and UI threads - Configurable update intervals for smooth meter animation - CSS-styled visual feedback with safe/warning/danger levels **Implementation Details:** - PipeWire integration using `pipewire` and `libspa` crates - Automatic connection to system monitor sources via `MEDIA_CATEGORY: "Monitor"` - Proper error handling and graceful shutdown - Support for F32LE audio format with configurable sample rates - Non-blocking UI updates via GTK idle callbacks **UI Components:** - Status section with real-time monitoring indicators - Configuration display for current audio settings - Device information for input/output devices - Dual-channel audio meters with dB display - Visual level indicators with color-coded safety zones **Note:** Requires PipeWire >= 1.4.0 and appropriate permissions for audio monitor access.
2 parents 804c366 + ad9e19d commit 1c91f5f

File tree

15 files changed

+1469
-35
lines changed

15 files changed

+1469
-35
lines changed

Cargo.toml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,43 @@
11
[package]
22
name = "pro_audio_config"
3-
version = "1.7.0"
3+
version = "1.8.0"
44
authors = ["Peter Leukanič"]
55
edition = "2024"
66
description = "A professional audio configuration tool for Linux systems"
77
license = "MIT"
8-
repository = "https://github.com/Peter-L-SVK/pro-audio-config"
8+
repository = "https://github.com/Peter-L-SVK/pro_audio_config"
99
readme = "README.md"
1010

1111
[dependencies]
12+
anyhow = "1.0"
1213
gtk = { version = "0.18.2", features = ["v3_24"] }
1314
gio = "0.21"
1415
glib = { version = "0.21", features = ["v2_80"] }
1516
glob = "0.3"
17+
libspa = "0.8"
1618
dirs = "6.0"
1719
chrono = "0.4.42"
1820
directories = "6.0"
1921
whoami = "1.6"
2022
shellexpand = "3.1"
2123
toml = "0.9.8"
2224
serde = { version = "1.0", features = ["derive"] }
25+
serde_json = "1.0"
26+
pipewire = { version = "0.8", optional = true }
27+
lazy_static = "1.4.0"
28+
bytemuck = "1.14"
29+
libc = "0.2"
30+
regex = "1.10"
31+
32+
[features]
33+
default = ["pipewire-monitoring"] # Default includes pipewire monitoring
34+
pipewire-monitoring = ["pipewire"] # Enable the optional pipewire dependency
35+
simulation = [] # Simulation only mode (no pipewire dependency)
36+
37+
[profile.release]
38+
lto = true
39+
codegen-units = 1
40+
opt-level = 3
2341

2442
[dev-dependencies]
2543
mockall = "0.14"
@@ -35,7 +53,7 @@ copyright = "2025, Peter Leukanič"
3553
depends = "$auto, pipewire-alsa, wireplumber, policykit-1"
3654
section = "sound"
3755
assets = [
38-
["target/release/pro-audio-config", "usr/bin/", "755"],
56+
["target/release/pro_audio_config", "usr/bin/", "755"],
3957
["icons/48x48/icon.png", "usr/share/icons/hicolor/48x48/apps/pro-audio-config.png", "644"],
4058
["pro-audio-config.desktop", "usr/share/applications/", "644"],
4159
]

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@ After 10 years of using Fedora and other Linux distributions, I realized we're s
1313

1414
## Features
1515

16-
All current features are showcased in the  [Gallery](https://github.com/Peter-L-SVK/pro_audio_config/blob/main/scrshots/README.md) 
17-
16+
All current features are showcased in the [Gallery](https://github.com/Peter-L-SVK/pro_audio_config/blob/main/scrshots/README.md)
17+
18+
### 🎚️ **Real-time Audio Monitoring Tab**
19+
- **Live Audio Level Meters**: Visual monitoring of stereo channel output levels with real-time PipeWire integration
20+
- **Color-coded Visual Feedback**: Safe (green), warning (yellow), and clipping (red) zones with blinking indicators
21+
- **Real System Audio Monitoring**: Taps into PipeWire monitor sources for accurate system-wide audio level measurement
22+
- **Smooth Meter Animation**: 10 FPS updates with proper threading for responsive UI performance
23+
- **DB Scale Display**: Accurate decibel readings with peak and RMS calculations
24+
- **Auto-detection Fallback**: Intelligent fallback to simulation mode when PipeWire isn't available
25+
- **Professional Metering**: Studio-grade level monitoring with proper threshold matching industry standards
26+
27+
### 🔧 **Device and Configuration Management**
1828
- **Device Detection**: Automatically detects and displays current audio devices (PipeWire, ALSA, PulseAudio)
1929
- **Sample Rate Configuration**: Support for rates from 44.1 kHz to 384 kHz
2030
- **Bit Depth Settings**: 16-bit, 24-bit, and 32-bit audio formats
@@ -24,12 +34,13 @@ All current features are showcased in the  [Gallery](https://github.com/Peter-L
2434
- **No Terminal Required**: Graphical interface that anyone can use
2535
- **Privilege Escalation**: Secure privilege escalation for system-level audio configuration
2636

27-
### Multi-Tab Interface
37+
### 🗂️ **Multi-Tab Interface**
2838
- **Separate Input/Output Configuration**: Dedicated tabs for playback (output) and recording (input) devices
39+
- **Real-time Monitoring Tab**: Dedicated monitoring interface with live audio meters
2940
- **Independent Settings Management**: Configure input and output devices with different sample rates, bit depths, and buffer sizes
30-
- **Clear Visual Separation**: Intuitive tabbed interface that clearly distinguishes between recording and playback settings
41+
- **Clear Visual Separation**: Intuitive tabbed interface that clearly distinguishes between recording, playback, and monitoring functions
3142

32-
### Advanced Tab Features
43+
### **Advanced Tab Features**
3344
- **Configuration Modes**: Switch between Global System Settings and Exclusive Mode
3445
- **Professional Audio Settings**: Fine-tune buffer size ranges, thread priorities, and memory locking
3546
- **Exclusive Mode**: Direct hardware access for single applications (similar to ASIO/WASAPI exclusive mode)
@@ -38,12 +49,12 @@ All current features are showcased in the  [Gallery](https://github.com/Peter-L
3849
- **Resampling Control**: Adjust resampler quality or disable automatic resampling entirely
3950
- **Channel Management**: Option to disable automatic channel remixing for professional workflows
4051

41-
### Configuration Scope
52+
### 🔍 **Configuration Scope**
4253
- **User-Specific Configuration**: Apply settings only for the current user (default)
4354
- **System-Wide Configuration**: Apply settings for all users on the system (requires admin privileges)
4455
- **Flexible Deployment**: Choose between user-specific or system-wide configuration based on your needs
4556

46-
### Advanced Configuration
57+
### 🛠️ **Advanced Configuration**
4758
- **Dedicated WirePlumber Configs**: Separate configuration generators for input vs output devices
4859
- **Independent Signal Handlers**: Each tab manages its own settings and apply operations
4960
- **Comprehensive Testing**: Extensive test suite covering new input/output separation features
@@ -69,18 +80,16 @@ This tool is designed to grow with PipeWire and Linux audio:
6980

7081
As audio companies improve their Linux driver support and PipeWire continues to evolve, this tool will be ready to leverage those advancements immediately.
7182

72-
7383
## Roadmap
7484

75-
- [ ] Package manager support (RPM/DEB/Flatpak)
85+
- [x] **Real-time Audio Monitoring** - Live level meters with PipeWire integration
7686
- [x] Setting all available devices in one session
7787
- [x] Separate input/output configuration tabs
7888
- [x] User vs system-wide configuration scope
89+
- [ ] Package manager support (RPM/DEB/Flatpak)
7990
- [ ] Additional audio backends (JACK)
8091
- [ ] Preset configurations
8192
- [x] Advanced audio routing
82-
- [ ] Real-time audio monitoring
83-
8493

8594
## Installation
8695

@@ -101,7 +110,7 @@ cd pro_audio_config
101110

102111
2. Build and install:
103112
```bash
104-
cargo build --release
113+
cargo build --release --features pipewire-monitoring
105114
sudo cp target/release/pro_audio_config /usr/local/bin/
106115
```
107116

data/styles.css

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
.level-safe progressbar trough,
2+
.level-safe progressbar progress {
3+
background-color: #26A269; /* Green */
4+
}
5+
6+
.level-warning progressbar trough,
7+
.level-warning progressbar progress {
8+
background-color: #E5A50A; /* Yellow */
9+
}
10+
11+
.level-danger progressbar trough,
12+
.level-danger progressbar progress {
13+
background-color: #C01C28; /* Red */
14+
}
15+
16+
progressbar.clipping progress {
17+
background-color: #FF0000; /* Bright red for clipping */
18+
animation: blink 1s infinite;
19+
}
20+
21+
@keyframes blink {
22+
0% { opacity: 1; }
23+
50% { opacity: 0.5; }
24+
100% { opacity: 1; }
25+
}
26+
27+
/* NEW: Audio meter indicator styles */
28+
.level-safe {
29+
background-color: #26A269; /* Green */
30+
}
31+
32+
.level-warning {
33+
background-color: #E5A50A; /* Yellow */
34+
}
35+
36+
.level-danger {
37+
background-color: #C01C28; /* Red */
38+
}
39+
40+
/* Style for the small indicators in the key */
41+
.level-indicator {
42+
min-width: 16px;
43+
min-height: 16px;
44+
border-radius: 2px;
45+
}
46+
47+
/* Progress bar text styling */
48+
progressbar {
49+
color: #FFFFFF;
50+
font-weight: bold;
51+
}
52+
53+
/* Make the progress bars look nicer */
54+
progressbar trough {
55+
background-color: rgba(255, 255, 255, 0.1);
56+
border-radius: 3px;
57+
}
58+
59+
progressbar progress {
60+
border-radius: 3px;
61+
}

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ echo "=== Installing Pro Audio Config ==="
77

88
# Build the release binary
99
echo "Building the application..."
10-
cargo build --release
10+
cargo build --release --features pipewire-monitoring
1111

1212
# Create directories if they don't exist
1313
echo "Creating installation directories..."

scrshots/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
![Running the program](scr9.png)
2222
*(In the task manager)*
2323

24+
![Running the program](scr10.png)
25+
*(Monitoring)*
26+
2427
![About](scr7.png)
2528
*(Help -> About)*
2629

scrshots/scr10.png

132 KB
Loading

scrshots/scr7.png

2.83 KB
Loading

0 commit comments

Comments
 (0)