diff options
author | Ted Hess <thess@kitschensync.net> | 2015-01-25 20:14:18 -0500 |
---|---|---|
committer | Ted Hess <thess@kitschensync.net> | 2015-01-25 20:14:18 -0500 |
commit | c742c5c49a3e02b37ab0c5e12d2f1e3373e1fa65 (patch) | |
tree | 4038f9ab28073be9abe875fbdb94825891b29364 /sound/shairport-sync/files | |
parent | ebcd0936eee2dc6ba9e12f4efffe3b971ed7f23f (diff) |
shairport-sync: New package from MikeBrady
Signed-off-by: Ted Hess <thess@kitschensync.net>
Diffstat (limited to 'sound/shairport-sync/files')
-rw-r--r-- | sound/shairport-sync/files/shairport-sync.config | 35 | ||||
-rwxr-xr-x | sound/shairport-sync/files/shairport-sync.init | 77 |
2 files changed, 112 insertions, 0 deletions
diff --git a/sound/shairport-sync/files/shairport-sync.config b/sound/shairport-sync/files/shairport-sync.config new file mode 100644 index 000000000..f72c78549 --- /dev/null +++ b/sound/shairport-sync/files/shairport-sync.config @@ -0,0 +1,35 @@ +# Uncomment the stanza you want, and make sure to comment out the others, especially duplicate options. + +#Arguments and defaults are as follows +config shairport-sync main +# option name 'Shairport Sync' #default name, "Shairport Sync on %d" +# option device default #default soundcard, volume control by software + #(Troubleshooting hint: make sure the soundcard's volume is turned up fully -- use alsamixer or amixer) +# option airplaylatency 88200 +# option ituneslatency 99400 +# option port 5000 +# option stuffing basic #options are 'basic' or 'soxr' if shairport-sync was compiled with soxr support +# option awaitactioncompletion false #[don't] wait until beforeaction or afteraction completes +# option beforeaction <action> #action must be a fully qualified program with no arguments. Default no action. +# option afteraction <action> #action must be a fully qualified program with no arguments. Default no action. +# option devicetype <devicetype> +# option volumecontrolname <name> + +#Here are some sample stanzas: + +#For Raspberry Pi using the built-in soundcard for the headphone jack +# option device 'hw:0' +# option devicetype hardware +# option volumecontrolname Master + +#For Raspberry Pi with the "3D Sound" USB Soundcard +# option name 'Pi' +# option device 'hw:1' +# option devicetype hardware +# option volumecontrolname Speaker + +#For Raspberry Pi with the first generation iMic or the Topping TP30 Class T Digital Mini Amplifier +# option name 'Kitchen' +# option device 'hw:1' +# option devicetype hardware +# option volumecontrolname PCM diff --git a/sound/shairport-sync/files/shairport-sync.init b/sound/shairport-sync/files/shairport-sync.init new file mode 100755 index 000000000..f49e1e3cd --- /dev/null +++ b/sound/shairport-sync/files/shairport-sync.init @@ -0,0 +1,77 @@ +#!/bin/sh /etc/rc.common + +NAME='shairport-sync' +START=99 + +USE_PROCD=1 + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + +start_shairport_service() { + local cfg=$1 + local stuffing + local device + + procd_open_instance + + procd_set_param command /usr/bin/$NAME + + append_arg "$cfg" name "-a" + append_arg "$cfg" port "-p" + append_arg "$cfg" airplaylatency "-A" + append_arg "$cfg" ituneslatency "-i" + + config_get stuffing "$cfg" stuffing "" + + if [ -n "$stuffing" ] ; then + case "x$stuffing" in + ( "xbasic" ) procd_append_param command -S basic ;; + ( "xsoxr" ) procd_append_param command -S soxr ;; + ( * ) logger "bad argument for -S option -- should be \"basic\" or \"soxr\"" ;; + esac + fi + + append_arg "$cfg" beforeaction "-B" + append_arg "$cfg" afteraction "-E" + append_bool "$cfg" awaitactioncompletion "-w" + + config_get device "$cfg" device "" + if [ -n "$device" ] ; then + procd_append_param command "--" + append_arg "$cfg" device "-d" + append_arg "$cfg" devicetype "-t" + append_arg "$cfg" volumecontrolname "-c" + fi + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger $NAME +} + +start_service() { + config_load $NAME + # Just a single instance + start_shairport_service "main" +} |