#!/bin/sh

# Test AF routines
#
# $Id: tAFroutines,v 1.14 1996/08/20 libtsp-V2R7a $

PATH=${PATH}:bin
export PATH

echo ""
echo "========== tAFopenRead"
RAWAUDIOFILE=""
export RAWAUDIOFILE
tAFopenRead audiofiles/addf8.nh			2>&1	# Error
RAWAUDIOFILE=integer16
tAFopenRead audiofiles/addf8.afsp
tAFopenRead audiofiles/addf8.aiff
tAFopenRead audiofiles/addf8.aifc
tAFopenRead audiofiles/addf8.au
tAFopenRead audiofiles/addf8.aud
tAFopenRead audiofiles/addf8.d
tAFopenRead audiofiles/addf8.nh
tAFopenRead audiofiles/addf8.sd
tAFopenRead audiofiles/addf8.sf_mipseb
tAFopenRead audiofiles/addf8.sf_sun
tAFopenRead audiofiles/addf8.sf_vax_b
tAFopenRead audiofiles/addf8.wav
tAFopenRead audiofiles/jg00b1ss.wav
tAFopenRead audiofiles/sw1038t_short.wav
tAFopenRead audiofiles/aiff-8.snd
tAFopenRead audiofiles/bab.dat
tAFopenRead audiofiles/digit0v0.aiff		2>&1	# Invalid COMM chunk
tAFopenRead audiofiles/jg00b1ss.wav
tAFopenRead audiofiles/next-8.snd
tAFopenRead audiofiles/riff-8-u.snd		2>&1	# Invalid chunk size
tAFopenRead audiofiles/sw1038t_short.wav


echo ""
echo "========== tAFsetNH"
tAFsetNH ""					# default
tAFsetNH "mu-law, 512, 10000, little, 2, 32"
tAFsetNH "A-law, 0, 9000, big, 1, 8"
tAFsetNH "UNSIGNED8"
tAFsetNH "integer8"
tAFsetNH "integer"
tAFsetNH "float"
tAFsetNH "text"
tAFsetNH "text, 25, 10000, big, , , ,"		2>&1
tAFsetNH "whatever"				2>&1	# Error

echo ""
echo "========== tAFwriteXX"
#               Format, Nchan, Sfreq
tAFwriteXX temp.aud 1 2 8000.6	    # AFsp file
rm -f temp.aud
tAFwriteXX temp.aud 2 2 10000.6
rm -f temp.aud
tAFwriteXX temp.aud 3 2 12000.6		2>&1	# uint8, invalid data format
tAFwriteXX temp.aud 4 2 16000.6
rm -f temp.aud
tAFwriteXX temp.aud 5 2 24000.6
rm -f temp.aud
tAFwriteXX temp.aud 6 2 10000.6
rm -f temp.aud
tAFwriteXX temp.aud 7 2 10000.6		2>&1	# text, invalid data format
tAFwriteXX temp.aud 257 4 8000.4    # WAVE file
rm -f temp.aud
tAFwriteXX temp.aud 258 4 10000.4
rm -f temp.aud
tAFwriteXX temp.aud 259 4 12000.4
rm -f temp.aud
tAFwriteXX temp.aud 260 4 16000.6	2>&1	# int8, invalid data format
tAFwriteXX temp.aud 261 4 16000.4
rm -f temp.aud
tAFwriteXX temp.aud 262 4 16000.4	2>&1	# float, invalid data format
tAFwriteXX temp.aud 263 4 16000.4	2>&1	# text, invalid data format
tAFwriteXX temp.aud 513 1 8000.7    # AIFF-C file
rm -f temp.aud
tAFwriteXX temp.aud 514 1 10000.7
rm -f temp.aud
tAFwriteXX temp.aud 515 1 16000.7	2>&1	# uint8, invalid data format
tAFwriteXX temp.aud 516 1 12000.7
rm -f temp.aud
tAFwriteXX temp.aud 517 1 14000.7
rm -f temp.aud
tAFwriteXX temp.aud 518 1 12000.7	2>&1	# float, invalid data format
tAFwriteXX temp.aud 519 1 12000.7	2>&1	# text, invalid data format

echo ""
echo "========== tAFgetAUrec"
tAFgetAUrec abc: abc:123 def:456 ghi:789
tAFgetAUrec def: abc:123 def:456 ghi:789
tAFgetAUrec ghi: abc:123 def:456 ghi:789
tAFgetAUrec dxx abc:123 def:456 ghi:789
tAFgetAUrec "" abc:123 def:456 ghi:789

echo ""
echo "========== tAFgetSPrec"
head="speaker_id -s2 jg
speaking_mode -s11 spontaneous
recording_date -s11 13-May-1992
recording_time -s11 11:18:05.00
microphone -s18 Sennheiser HMD-414
utterance_id -s8 jg00b1ss
database_id -s5 atis2
database_version -s3 1.0
channel_count -i 1
speaker_session_number -s1 1
speaker_sentence_number -s3 00b
session_utterance_number -i 11
sample_count -i 16384
sample_max -i 3131
sample_min -i -2817
sample_rate -r 16000.3
sample_n_bytes -i 2
sample_byte_format -s2 10
sample_sig_bits -i 16
end_head
"
tAFgetSPrec sample_count 0 2 "$head"
tAFgetSPrec sample_rate 1 2 "$head"
tAFgetSPrec recording_date 2 2 "$head"
tAFgetSPrec sample_counx 0 2 "$head"		2>&1	# Error

exit 0
