#!/bin/sh

# Part of the TLF contest logging program for amateur radio operators
# by Rein Coperous PA0R and Thomas Beierlein DL1JBE 2011.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# These script is responsible for playing voice key message files 
# on the command of the TLF main program.
# It gets called as 'play_vk filename' and plays the content of 
# the audio file 'filename' on the default sound device.
#
# You can adapt it to your convenience to 
# - mute or unmute your microphone
# - play different file formats or
# - use another output device
#
# An executable copy of 'play_vk' in your contest directory (containing the
# logcfg.dat file) can be adapted and has precedence over the standard install

# accept SIGTERM and SIGINT signals and kill play command as soon as possible
trap 'kill -s KILL $PID' TERM INT

# mute mic
#amixer -c 0 set Mic mute -q

# play file on the default sound device in background, so signals can be caught
# by the 'trap' instruction above

# SoX play utility syntax
play -q $1 2> /dev/null &
PID=$!
wait $PID


#unmute mic
#amixer -c 0 set Mic unmute -q
