|
- #!/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-loud-if-inactive() {
- LAST_ACTIVE=`human-activity-ago`
- if [[ $LAST_ACTIVE > 200 ]]; then
- info "Human is inactive. Last activity: $LAST_ACTIVE seconds ago."
- pa-volume-loud
- else
- info "Human is active. Setting only normal volume."
- pa-volume-normal
- fi
- }
-
- 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
- killall $PLAYER
- }
-
- 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 "$@"
- }
-
|