announcement-box/bin/pa-lib
2020-12-14 17:23:50 +01:00

83 lines
1.4 KiB
Bash

#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export ROOT=`dirname "$DIR"`
export SOUNDS=$ROOT/sounds
export PLAYER=mplayer
export SPEAK=espeak-ng
function info() {
echo "[INFO]" $@
}
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() {
info "Volume set to Normal"
pa-volume 15
}
function pa-volume-loud() {
info "Volume set to HIGH!"
pa-volume 25
}
function pa-volume-quiet() {
info "Volume set to low"
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"
}
function pa-shutdown() {
info "PA Shutdown"
pa-power off
pa-volume-normal
}
function pa-announcement() {
info " DING DONG "
play $SOUNDS/announcement_4-tone_up_smooth.ogg
}
function pa-announcement-quick() {
info " Ding Dong "
play $SOUNDS/announcement_4-tone_up_smooth_quick.ogg
}
function pa-announcement-quickest() {
info " ding-dong "
play $SOUNDS/announcement_4-tone_up_quickest.ogg
}
function pa-alarm-start() {
info "Alarm started"
play -loop 0 $SOUNDS/alarm_simple.ogg &
}
function pa-alarm-stop() {
info "Alarm stopped"
killall $PLAYER
}
function pa-say() {
info "Say: $@"
$SPEAK "$@"
}