v0.6.11 — Native PulseAudio / PipeWire audio output

Replaced external `pw-play` / `paplay` subprocesses and temporary WAV files
with two dedicated Rust playback workers using `libpulse-simple-binding`.
The existing two-tone alarm sounds, SpO₂-dependent QRS tones, rhythms, mute
controls, alarm priorities and selective alarm-pause logic are retained.
A manual test tone remains available with audible alarms switched off.
Flatpak requires the PulseAudio socket and `libpulse-simple` in its SDK/runtime.
This commit is contained in:
GABRIEL Sebastian 2026-11-13 20:09:25 +01:00
commit 56f9f2e932
12 changed files with 2071 additions and 247 deletions

View file

@ -1,4 +1,4 @@
# SimPaM — Patient Monitor Simulation v0.6.10
# SimPaM — Patient Monitor Simulation v0.6.11
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
@ -38,7 +38,7 @@ monitoring.
### Build and run on Fedora
```bash
sudo dnf install rust cargo gcc pkgconf-pkg-config gtk4-devel pipewire-utils
sudo dnf install rust cargo gcc pkgconf-pkg-config gtk4-devel pulseaudio-libs-devel
cargo test
cargo run --release
```
@ -553,9 +553,9 @@ scenarios do not unexpectedly flash.
Numerical threshold alarms only evaluate actual displayed measurements:
`--`, `NO SENSOR`, and other unavailable readings do not trigger low-value
alarms. ECG-derived PR and signal visibility continue to work as in v0.3.2.
Alarms are presentation-only: there is **no audible alarm, alarm latching,
priority classification or clinical alarm validation**. Instructor settings
are held in memory and reset on restart.
Audible alarms with two priorities are supported, but there is **no alarm
latching or clinical alarm validation**. Instructor settings are held in
memory and reset on restart.
### Audible alarms and QRS tone (updated v0.6.7)
@ -614,12 +614,16 @@ Saturation tone pitches are deliberately simplified teaching tones, not
calibrated clinical pulse-oximeter sounds. The QRS beep and two-tone alarm can
sound independently; no alarm priority or visual alarm logic was changed.
On Fedora, sound is played through **`pw-play`** from `pipewire-utils`, with
**`paplay`** as a fallback. No additional Rust crates or sound files are needed:
the application creates its own short WAV tones at runtime. If neither player
is installed, Admin reports that audio is unavailable; the monitor continues
to work normally. `Test tone` helps verify the desktop audio output. The
application uses the system output device and mixer volume.
As of **v0.6.11**, audio uses the Rust `libpulse-simple-binding` backend
directly, rather than launching `pw-play` or `paplay`. SimPaM synthesizes
the same 44.1 kHz mono PCM16 tones in memory and sends them to two
independent PulseAudio streams (alarm and QRS). Each stream has a
dedicated playback thread so synchronous audio I/O never blocks GTK.
PipeWire supports this through its PulseAudio compatibility server.
The system mixer controls output volume. If connecting or writing to
the audio server fails, the worker logs an error and can retry on the
next sound. `Test tone` verifies playback independently of the mute
checkbox. No temporary WAV files or external player programs are used.
**Important:** These simple teaching tones do not comply with medical-device
alarm standards (including IEC 60601-1-8) and must never be relied on for
@ -665,6 +669,8 @@ are simulated.
```text
src/
main.rs GTK application entry point
audio_backend.rs Native PulseAudio playback workers
alarm.rs Alarm/QRS tone synthesis, scheduling and pause
model.rs Parameters, rhythm/capture settings, display flags
simulation.rs QRS-timed mechanical signals, PPV and respiratory synthesis
render.rs Cairo monitor layout, dynamic visibility, fixed ART axis
@ -672,6 +678,23 @@ src/
ui.rs Admin controls and monitor window
```
### Building audio in Flatpak
For Flatpak, keep `--socket=pulseaudio` in `finish-args` and verify the
**target SDK** provides the `libpulse-simple` development library:
```bash
flatpak run --command=sh org.gnome.Sdk//51 \
-c 'pkg-config --modversion libpulse-simple'
```
The Flatpak runtime must also ship the corresponding shared libraries.
The host's `pipewire-utils` package is no longer required. Update `Cargo.lock`
with Cargo after changing dependencies, then regenerate `cargo-sources.json`
using `flatpak-cargo-generator` before building offline. The project archive
contains application sources; an existing Flatpak manifest is maintained
separately and was not modified by this update.
## Changelog
### Changes since v0.2.2
@ -855,3 +878,12 @@ same controls are now permanently available. A high-contrast yellow one-tap
Defibrillation button with a red lightning symbol triggers only the transient
ECG shock artifact; rhythm conversion remains available as a separate action.
### v0.6.11 — Native PulseAudio / PipeWire audio output
Replaced external `pw-play` / `paplay` subprocesses and temporary WAV files
with two dedicated Rust playback workers using `libpulse-simple-binding`.
The existing two-tone alarm sounds, SpO₂-dependent QRS tones, rhythms, mute
controls, alarm priorities and selective alarm-pause logic are retained.
A manual test tone remains available with audible alarms switched off.
Flatpak requires the PulseAudio socket and `libpulse-simple` in its SDK/runtime.