From c93c5acc41c53da4ff12086ebd48a030cea9e78a Mon Sep 17 00:00:00 2001 From: Dejvino Date: Mon, 14 Dec 2020 14:14:43 +0100 Subject: [PATCH] Add volume control and more announcement templates. --- bin/announce-freeform | 14 ++++++++++++++ bin/announce-midnight | 15 +++++++++++++++ bin/emergency-freeform | 23 +++++++++++++++++++++++ bin/emergency-test | 3 +++ bin/pa-lib | 18 ++++++++++++++++++ 5 files changed, 73 insertions(+) create mode 100755 bin/announce-freeform create mode 100755 bin/announce-midnight create mode 100755 bin/emergency-freeform diff --git a/bin/announce-freeform b/bin/announce-freeform new file mode 100755 index 0000000..7f7a136 --- /dev/null +++ b/bin/announce-freeform @@ -0,0 +1,14 @@ +#!/bin/bash + +source pa-lib + +pa-preheat + +pa-announcement + +pa-say "$@" + +pa-announcement-quick + +pa-shutdown + diff --git a/bin/announce-midnight b/bin/announce-midnight new file mode 100755 index 0000000..adf00a6 --- /dev/null +++ b/bin/announce-midnight @@ -0,0 +1,15 @@ +#!/bin/bash + +source pa-lib + +pa-preheat + +pa-volume-quiet +pa-announcement + +pa-say "It is midnight." + +pa-announcement-quick + +pa-shutdown + diff --git a/bin/emergency-freeform b/bin/emergency-freeform new file mode 100755 index 0000000..5411f74 --- /dev/null +++ b/bin/emergency-freeform @@ -0,0 +1,23 @@ +#!/bin/bash + +source pa-lib + +pa-preheat + +pa-volume-loud +pa-announcement-quickest + +emergency-light on + +sleep 1 + +pa-say "$@" + +sleep 1 + +emergency-light off + +pa-announcement-quick + +pa-shutdown + diff --git a/bin/emergency-test b/bin/emergency-test index 55c8835..e443d2b 100755 --- a/bin/emergency-test +++ b/bin/emergency-test @@ -6,11 +6,13 @@ pa-preheat pa-announcement-quickest +pa-volume-normal pa-say "Test of emergency warning system will begin." sleep 1 emergency-light on +pa-volume-loud pa-say "This is only a test. In the event of an emergency, this emergency warning light would be used to declare an emergency." pa-say "This is only a test." @@ -18,6 +20,7 @@ sleep 1 emergency-light off +pa-volume-normal pa-say "This was a test of the emergency warning light system. Thank you for your cooperation." pa-announcement-quick diff --git a/bin/pa-lib b/bin/pa-lib index 5844f60..4cf622c 100644 --- a/bin/pa-lib +++ b/bin/pa-lib @@ -15,9 +15,26 @@ function play() { $PLAYER $@ > /dev/null 2>&1 } +function pa-volume() { + amixer cset numid=3,iface=MIXER,name='Line Out Playback Volume' $1 > /dev/null +} + +function pa-volume-normal() { + pa-volume 15 +} + +function pa-volume-loud() { + pa-volume 25 +} + +function pa-volume-quiet() { + pa-volume 8 +} + function pa-preheat() { info "PA Preheating" pa-power off + pa-volume-normal play $SOUNDS/announcement_4-tone_up_quickest.ogg pa-power on info "PA Ready" @@ -26,6 +43,7 @@ function pa-preheat() { function pa-shutdown() { info "PA Shutdown" pa-power off + pa-volume-normal } function pa-announcement() {