]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Change mono setting to playback_mode setting and add to config file.
authorMike Brady <mikebrady@eircom.net>
Mon, 2 May 2016 08:07:39 +0000 (09:07 +0100)
committerMike Brady <mikebrady@eircom.net>
Mon, 2 May 2016 08:07:39 +0000 (09:07 +0100)
common.h
player.c
scripts/shairport-sync.conf
shairport.c

index 1b0cf639e4b78070c4f5600e503dcc6419b98dd5..6e5331d50789cde4e26f34c34249285499b9110f 100644 (file)
--- a/common.h
+++ b/common.h
@@ -43,6 +43,11 @@ enum stuffing_type {
   ST_soxr,
 } type;
 
+enum playback_mode_type {
+  ST_stereo = 0,
+  ST_mono,
+} playback_mode_type;
+
 typedef struct {
   config_t *cfg;
   char *password;
@@ -80,7 +85,7 @@ typedef struct {
   int32_t ForkedDaapdLatency; // supplied with --ForkedDaapdLatency option
   int daemonise;
   int statistics_requested,use_negotiated_latencies;
-  int mono;
+  enum playback_mode_type playback_mode;
   char *cmd_start, *cmd_stop;
   int cmd_blocking;
   int tolerance; // allow this much drift before attempting to correct it
index 041b02d65b72f3dacdbcd09499c88ab1ca36a867..1a2cf1a62de3653a7402f2e62c976bc16fc08708 100644 (file)
--- a/player.c
+++ b/player.c
@@ -379,7 +379,7 @@ void player_put_packet(seq_t seqno, uint32_t timestamp, uint8_t *data, int len)
                                        abuf->timestamp = timestamp;
                                        abuf->sequence_number = seqno;
 
-          if (config.mono) {
+          if (config.playback_mode==ST_mono) {
             signed short *v = abuf->data;
             int i;
             int both;
index a75298b6d57f9be55ebb4c7f9e04af8f72b8d966..2f185669f8be21e47dc3755314f0c08cceb6835e 100644 (file)
@@ -19,6 +19,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".
 };
 
 // How to deal with metadata, including artwork
index 041986c53746723f32324b936a061191a593d90b..8be3a35e49824ed43785627243d0ea29a00517ce 100644 (file)
@@ -207,7 +207,6 @@ void usage(char *progname) {
   printf("                            Executable scripts work, but must have #!/bin/sh (or "
          "whatever) in the headline.\n");
   printf("    -w, --wait-cmd          wait until the -B or -E programs finish before continuing.\n");
-  printf("    --mono                   convert all outgoing audio to mono.\n");
   printf("    -o, --output=BACKEND    select audio output method.\n");
   printf("    -m, --mdns=BACKEND      force the use of BACKEND to advertize the service.\n");
   printf("                            if no mdns provider is specified,\n");
@@ -254,7 +253,6 @@ int parse_options(int argc, char **argv) {
       {"on-start", 'B', POPT_ARG_STRING, &config.cmd_start, 0, NULL},
       {"on-stop", 'E', POPT_ARG_STRING, &config.cmd_stop, 0, NULL},
       {"wait-cmd", 'w', POPT_ARG_NONE, &config.cmd_blocking, 0, NULL},
-      {"mono", 0, POPT_ARG_NONE, &config.mono, 0, NULL},
       {"mdns", 'm', POPT_ARG_STRING, &config.mdns_name, 0, NULL},
       {"latency", 'L', POPT_ARG_INT, &config.userSuppliedLatency, 0, NULL},
       {"AirPlayLatency", 'A', POPT_ARG_INT, &config.AirPlayLatency, 0, NULL},
@@ -413,14 +411,14 @@ int parse_options(int argc, char **argv) {
           die("Invalid ignore_volume_control option choice \"%s\". It should be \"yes\" or \"no\"");
       }
 
-      /* Get the mono setting */
-      if (config_lookup_string(config.cfg, "general.mono", &str)) {
-        if (strcasecmp(str, "no") == 0)
-          config.mono = 0;
-        else if (strcasecmp(str, "yes") == 0)
-          config.mono = 1;
+      /* Get the playback_mode setting */
+       if (config_lookup_string(config.cfg, "general.playback_mode", &str)) {
+        if (strcasecmp(str, "stereo") == 0)
+          config.playback_mode = ST_stereo;
+        else if (strcasecmp(str, "mono") == 0)
+          config.playback_mode = ST_mono;
         else
-          die("Invalid mono option choice \"%s\". It should be \"yes\" or \"no\"");
+          die("Invalid playback_mode choice \"%s\". It should be \"stereo\" (default) or \"mono\"");
       }
 
       /* Get the regtype -- the service type and protocol, separated by a dot. Default is "_raop._tcp" */
@@ -977,14 +975,14 @@ int main(int argc, char **argv) {
   debug(2, "AirPlayLatency is %d.", config.AirPlayLatency);
   debug(2, "iTunesLatency is %d.", config.iTunesLatency);
   debug(2, "forkedDaapdLatency is %d.", config.ForkedDaapdLatency);
-  debug(1, "stuffing option is \"%d\".", config.packet_stuffing);
+  debug(1, "stuffing option is \"%d\" (0-basic, 1-soxr).", config.packet_stuffing);
   debug(1, "resync time is %d.", config.resyncthreshold);
   debug(1, "allow a session to be interrupted: %d.", config.allow_session_interruption);
   debug(1, "busy timeout time is %d.", config.timeout);
   debug(1, "drift tolerance is %d frames.", config.tolerance);
   debug(1, "password is \"%s\".", config.password);
   debug(1, "ignore_volume_control is %d.", config.ignore_volume_control);
-  debug(1, "mono is %d.", config.mono);
+  debug(1, "playback_mode is %d (0-stereo, 1-mono).", config.playback_mode);
   debug(1, "disable_synchronization is %d.", config.no_sync);
   debug(1, "audio backend desired buffer length is %d.",
         config.audio_backend_buffer_desired_length);