#!/bin/bash
#
# alsadecode.sh v1.0 2004/11
#
# Copyright (C) 2004 by Pedro Venda pjvenda at arrakis dhis org
#
# Distributed under the terms of the GNU Public License Agreement (GPLv2)
# http://www.fsf.org/licensing/licenses/gpl.html or
# http://www.fsf.org/licensing/licenses/gpl.txt
#
# script for decoding and playing audio files with different programs
# chosen according to the file's extension.
#
# requires ogg123, mpg321 and aplay.
#

case `echo ${1} | sed -re "s/.*\.(.*)$/\1/"` in
	ogg)
		echo "playing ogg ${1}"
		/usr/bin/ogg123 ${1}
	;;
	mp3|mpg|mpeg)
		echo "playing mp3 ${1}"
		/usr/bin/mpg321 ${1}
	;;
	wav|au)
		echo "playing wav ${1}"
		/usr/bin/aplay ${1}
	;;
esac
