# pulseaudio
# - there is an autospawning mechanism in pulseaudio but it is flaky for some
#   reason. let upstart run it until we figure out what's going on.
description "pulseaudio"
start on stopped finish

# set hardware volumes when running in emulator
pre-start script
  if grep -qs "qemux86" /etc/hostname ; then
    amixer -q set "Master" 100% unmute
    amixer -q set "PCM" 100% unmute
    amixer -q set "Mic" 100% unmute
  fi 
  mkdir -p /home/root/.pulse
end script

# Stop when the Software Update tool is about to install an update.
# upstart restarts the job when installation is complete.
stop on started start_update

exec ionice -c1 /usr/bin/pulseaudio --log-target=syslog
respawn
