SimPaM/patches/patient-monitor-simulation-v0.6.4-to-v0.6.5.patch
2026-11-13 10:59:24 +01:00

180 lines
8.5 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

diff --git a/Cargo.toml b/Cargo.toml
index 46b979b..8087e1c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "patient-monitor-simulation"
-version = "0.6.4"
+version = "0.6.5"
edition = "2021"
license = "MIT"
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
diff --git a/README.de.md b/README.de.md
index d9f1101..3a42b91 100644
--- a/README.de.md
+++ b/README.de.md
@@ -1,4 +1,4 @@
-# Patient Monitor Simulation (PaMSim) — v0.6.4
+# Patient Monitor Simulation (PaMSim) — v0.6.5
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
@@ -175,7 +175,7 @@ Mit **F11** wird der Vollbildmodus aktiviert bzw. umgeschaltet, mit **Esc** wird
Unter Wayland sollte das Fenster vor dem Wechsel in den Vollbildmodus auf den gewünschten Präsentationsbildschirm verschoben werden.
Der Vollbildmodus sperrt den Computer nicht gegen andere Eingaben.
-## Akustische Alarme (v0.5.3)
+## Akustische Alarme (aktualisiert v0.6.5)
Die akustische Alarmierung ist **standardmäßig eingeschaltet**. Im
Admin-Fenster lässt sie sich mit **Audible alarms** aktivieren bzw. stummschalten.
@@ -183,11 +183,14 @@ Mit **Test tone** kann die Tonausgabe unabhängig von der Stummschaltung geprüf
werden. Die optischen Alarme blinken bei stummgeschalteter Tonausgabe weiterhin.
- **Kritische Rhythmusalarme:** VT, PVT, Kammerflimmern und Asystolie lösen
- einen Doppelton aus (zweimal kurz 880 Hz), der ungefähr alle 1,5 Sekunden
- wiederholt wird.
+ einen **Zweiklang aus aufeinanderfolgenden, unterschiedlichen Tönen** aus
+ (880 Hz gefolgt von 1160 Hz), der ungefähr alle 1,5 Sekunden wiederholt wird.
- **Numerische und technische Alarme:** Grenzwertüberschreitungen sowie
- **NO SENSOR** und **NO READING** lösen einen kurzen Ton mit 700 Hz aus,
- der ungefähr alle 2,5 Sekunden wiederholt wird.
+ **NO SENSOR** und **NO READING** lösen ebenfalls einen **Zweitonalarm** aus
+ (700 Hz gefolgt von 950 Hz), der ungefähr alle 2,5 Sekunden wiederholt wird.
+- Zwischen beiden Tönen liegt jeweils eine kurze Pause. Ein einzelner
+ **QRS-Piepton** ist für eine spätere Version vorgesehen und wird derzeit
+ noch nicht ausgegeben.
- Kritische Alarme haben Vorrang. Auch bei mehreren gleichzeitig aktiven
Alarmen wird nur eine Tonfolge ausgegeben. Bei behobenem Alarm oder
Stummschaltung verstummt die Ausgabe. Ausgeblendete Monitorbereiche
@@ -619,3 +622,13 @@ mit **Apply** gespeichert; **Measure now** startet unmittelbar einen Messzyklus,
auch wenn die Automatik ausgeschaltet ist. Die Admin-Oberfläche wird
synchronisiert. Die anderen Parametermenüs bleiben auf Alarmgrenzen beschränkt.
Manschettenzuordnung und simulierter Messausfall verbleiben im Admin-Fenster.
+
+
+### v0.6.5 – Zweitonige akustische Alarme
+
+Sowohl Standard- und technische Alarme als auch kritische Rhythmusalarme
+bestehen nun aus zwei aufeinanderfolgenden Tönen unterschiedlicher Frequenz.
+Die Priorisierung und die Wiederholungsintervalle bleiben unverändert.
+**Test tone** spielt den Standard-Zweitonalarm. Ein einzelner QRS-Piepton
+ist für eine spätere Erweiterung reserviert. Optische Alarme und
+Simulationsverhalten wurden nicht verändert.
diff --git a/README.md b/README.md
index faab37e..f413723 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Patient Monitor Simulation (PaMSim) — v0.6.4
+# Patient Monitor Simulation (PaMSim) — v0.6.5
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
@@ -166,17 +166,21 @@ The monitor can be resized and toggled fullscreen with **F11**; **Esc** exits
fullscreen. On Wayland, move the monitor to the presentation screen before
activating fullscreen. Fullscreen does not lock down the computer.
-## Audible alarms (v0.5.3)
+## Audible alarms (updated v0.6.5)
Sound is **enabled by default**. The Admin window has an **Audible alarms**
checkbox for muting and a **Test tone** button (works even while muted).
Visual alarms keep blinking normally when sound is off.
-- **Critical rhythm alarm:** VT, PVT, VF and asystole produce a double beep
- (two short 880 Hz tones), repeated approximately every 1.5 seconds.
+- **Critical rhythm alarm:** VT, PVT, VF and asystole produce a higher-pitched
+ **two-tone** alert (880 Hz followed by 1160 Hz), repeated approximately
+ every 1.5 seconds.
- **Numerical and SpO₂ technical alarms:** out-of-range values, **NO SENSOR**
- and **NO READING** produce a single 700 Hz beep, repeated approximately
- every 2.5 seconds.
+ and **NO READING** produce a lower-pitched **two-tone** alert
+ (700 Hz followed by 950 Hz), repeated approximately every 2.5 seconds.
+- Both alarm signals use two **different successive pitches**, separated by
+ a brief silence. A distinct **single QRS beep is reserved for future work**;
+ QRS-related audio is not yet implemented.
- Critical alarms have priority: only one tone pattern is played even if
multiple alarms are active. The sound stops when all alarms clear or when
the checkbox is unchecked. Alarms on hidden monitor channels are excluded.
@@ -634,3 +638,12 @@ are saved with Apply; Measure now starts a cuff cycle immediately regardless
of Auto. Both monitor and Admin display the selected settings. Other monitor
menus remain limited to alarm thresholds; NIBP cuff placement, the simulated
failed-reading option and non-NIBP signal settings remain Admin-only.
+
+
+### v0.6.5 — Two-tone audible alarms
+
+Both standard/technical and critical alarm sounds now consist of two distinct
+successive pitches. Critical alarms retain their priority and faster repeat
+interval; standard alarms retain their slower cadence. The Admin test button
+plays the standard two-tone alert. A single QRS beep is reserved for a later
+release and is not generated yet. No visual alarm or simulation logic changed.
diff --git a/src/alarm.rs b/src/alarm.rs
index 116b7f4..6e0b1af 100644
--- a/src/alarm.rs
+++ b/src/alarm.rs
@@ -84,14 +84,21 @@ pub fn level(p: &Parameters, sim: &Simulator) -> AlarmLevel {
result
}
-/// Very short, original synthesized sine beeps; mono PCM16 WAV.
+/// Both alarm priorities sound as two successive, different pitches.
+/// A future QRS beep will be a separate, single-tone signal.
+/// Zero-frequency segments are short silences between the notes.
+fn tone_segments(critical: bool) -> &'static [(f64, f64)] {
+ if critical {
+ &[(880.0, 0.16), (0.0, 0.08), (1160.0, 0.16)]
+ } else {
+ &[(700.0, 0.14), (0.0, 0.06), (950.0, 0.14)]
+ }
+}
+
+/// Very short, original synthesized two-tone alerts; mono PCM16 WAV.
fn wav(critical: bool) -> Vec<u8> {
const SAMPLE_RATE: u32 = 44_100;
- let segments: &[(f64, f64)] = if critical {
- &[(880.0, 0.16), (0.0, 0.09), (880.0, 0.16)]
- } else {
- &[(700.0, 0.18)]
- };
+ let segments = tone_segments(critical);
let samples: usize = segments.iter()
.map(|(_, seconds)| (seconds * f64::from(SAMPLE_RATE)).round() as usize)
.sum();
@@ -267,8 +274,9 @@ impl AlarmAudio {
}
/// Called from a 100-ms GLib timer, not the 250-Hz waveform simulator.
- /// Critical rhythms: double tone every 1.5 s; other alarms: single tone
- /// every 2.5 s. Stop promptly when muted or all alarm states clear.
+ /// Critical rhythms: higher-pitched two-tone alert every 1.5 s;
+ /// other alarms: lower-pitched two-tone alert every 2.5 s.
+ /// Stop promptly when muted or all alarm states clear.
pub fn update(&mut self, level: AlarmLevel, enabled: bool) {
self.reap();
if !enabled || level == AlarmLevel::None {
@@ -322,6 +330,21 @@ mod tests {
assert!(wav(true).len() > wav(false).len());
}
+ #[test]
+ fn both_alarm_priorities_have_two_distinct_audible_pitches() {
+ for critical in [false, true] {
+ let segments = tone_segments(critical);
+ let notes: Vec<f64> = segments.iter()
+ .filter_map(|(hz, _seconds)| (*hz > 0.0).then_some(*hz))
+ .collect();
+ assert_eq!(notes.len(), 2, "each alarm pattern must contain two notes");
+ assert_ne!(notes[0], notes[1], "a two-tone alert needs distinct pitches");
+ assert!(segments.iter().any(|(hz, _)| *hz == 0.0), "notes must be separated");
+ assert!(segments.iter().all(|(_, seconds)| *seconds > 0.0));
+ }
+ assert_ne!(wav(false), wav(true));
+ }
+
#[test]
fn normal_signals_are_silent_and_numeric_limit_alarms_beep() {
let mut p = Parameters::default();