#!/sbin/openrc-run
# Copyright 2019 Hyperbola Project
# Distributed under the terms of the GNU General Public License v2

depend() {
	after alsasound esound sndiod
}

start() {
	ebegin "Starting TiMidity++ Virtual Midi Sequencer"
	test -n "$TIMIDITY_PCM_NAME" && export TIMIDITY_PCM_NAME
	start-stop-daemon --start --background --chdir /var/lib/timidity \
	--user timidity --group audio --make-pidfile --pidfile /run/timidity.pid \
	--exec /usr/bin/timidity -- -iA ${TIMIDITY_OPTS}
	eend $?
}

stop() {
	ebegin "Stopping TiMidity++"
	start-stop-daemon --stop --quiet --pidfile /run/timidity.pid
	eend $?
}
