#!/bin/sh
# For playing Sopwith, the classic aerial combat shoot em up.
# https://fragglet.github.io/sdl-sopwith
# Write sounds to $HICCUP_SOUNDLOG if set.
exec 3> "${HICCUP_SOUNDLOG:=/dev/null}"
# Write actions to $HICCUP_ACTIONLOG if set.
exec 4> "${HICCUP_ACTIONLOG:=/dev/null}"
. /etc/hiccup/scripting.sh
arecord -q -D sysdefault:CARD=Microphone -f S16_LE -c 1 -r 16000 |
hiccup aaa,blow,ooo,shh,sss,thh,tongueclop | tee /dev/fd/3 | {
echo keydelay 0
echo keyhold 0
while IFS= read -r sound; do
hic_process "$sound"
case "$sound" in
blow) hic_hold x;; # accelerate
thh) hic_hold z;; # decelerate
sss) hic_hold comma;; # pull up
shh) hic_hold slash;; # pull down
tongueclop) hic_hit dot;; # flip plane
ooo) hic_hit b;; # drop bomb
aaa) hic_hit m;; # shoot missile (need to run sopwith with the -x flag)
esac
done
} | tee /dev/fd/4 | dotool