From 8a9665f68ef6e9b4f5823633d904756583b7577c Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Thu, 15 Sep 2016 17:43:13 +0100 Subject: [PATCH] Get different playback modes working and update the configuration sample --- scripts/shairport-sync.conf | 2 +- shairport.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf index cd7688bb..dea8ba6f 100644 --- a/scripts/shairport-sync.conf +++ b/scripts/shairport-sync.conf @@ -25,7 +25,7 @@ general = // ignore_volume_control = "no"; // set this to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to. // volume_range_db = 60 ; // use this to set the range, in dB, you want between the maximum volume and the minimum volume. Range is 30 to 150 dB. Leave it commented out to use mixer's native range. // regtype = "_raop._tcp"; // Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp". -// playback_mode = "stereo"; // This can be "stereo" or "mono". Default is "stereo". +// playback_mode = "stereo"; // This can be "stereo", "mono", "reverse stereo", "both left" or "both right". Default is "stereo". // alac_decoder = "hammerton"; // This can be "hammerton" or "apple". This advanced setting allows you to choose // the original Shairport decoder by David Hammerton or the Apple Lossless Audio Codec (ALAC) decoder written by Apple. }; diff --git a/shairport.c b/shairport.c index 4fec3541..9356ff8c 100644 --- a/shairport.c +++ b/shairport.c @@ -431,8 +431,14 @@ int parse_options(int argc, char **argv) { config.playback_mode = ST_stereo; else if (strcasecmp(str, "mono") == 0) config.playback_mode = ST_mono; + else if (strcasecmp(str, "reverse stereo") == 0) + config.playback_mode = ST_reverse_stereo; + else if (strcasecmp(str, "both left") == 0) + config.playback_mode = ST_left_only; + else if (strcasecmp(str, "both right") == 0) + config.playback_mode = ST_right_only; else - die("Invalid playback_mode choice \"%s\". It should be \"stereo\" (default) or \"mono\""); + die("Invalid playback_mode choice \"%s\". It should be \"stereo\" (default), \"mono\", \"reverse stereo\", \"both left\", \"both right\""); } /* Get the regtype -- the service type and protocol, separated by a dot. Default is @@ -1070,11 +1076,11 @@ int main(int argc, char **argv) { debug(1, "drift tolerance is %f seconds.", config.tolerance); debug(1, "password is \"%s\".", config.password); debug(1, "ignore_volume_control is %d.", config.ignore_volume_control); - debug(1, "playback_mode is %d (0-stereo, 1-mono).", config.playback_mode); + debug(1, "playback_mode is %d (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).", config.playback_mode); debug(1, "disable_synchronization is %d.", config.no_sync); debug(1, "use_mmap_if_available is %d.", config.no_mmap ? 0 : 1); - debug(1, "output_rate is %d (0 means 44,100).", config.output_rate); - debug(1, "output_format is %d (3 is the default SPS_FORMAT_S16).", config.output_format); + debug(1, "output_rate is %d.", config.output_rate); + debug(1, "output_format is %d (0-unknown, 1-S8, 2-U8, 3-S16, 4-S24, 5-S32).", config.output_format); debug(1, "audio backend desired buffer length is %f seconds.", config.audio_backend_buffer_desired_length); debug(1, "audio backend latency offset is %f seconds.", config.audio_backend_latency_offset);