]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Clean up audio help texts, add in the volume_range_hw_priority setting.
authorMike Brady <mikebrady@eircom.net>
Tue, 5 Feb 2019 11:26:54 +0000 (11:26 +0000)
committerMike Brady <mikebrady@eircom.net>
Tue, 5 Feb 2019 11:26:54 +0000 (11:26 +0000)
audio.c
audio_alsa.c
audio_dummy.c
audio_pa.c
audio_pipe.c
audio_stdout.c
common.h
player.c
scripts/shairport-sync.conf
shairport.c

diff --git a/audio.c b/audio.c
index a2c2128789477be7eae45356282e71ee1d4e2842..786863768b329b941866fcc60ae7b066842f5ea2 100644 (file)
--- a/audio.c
+++ b/audio.c
@@ -106,17 +106,17 @@ audio_output *audio_get_output(char *name) {
 void audio_ls_outputs(void) {
   audio_output **out;
 
-  printf("Available audio outputs:\n");
+  printf("Available audio backends:\n");
   for (out = outputs; *out; out++)
     printf("    %s%s\n", (*out)->name, out == outputs ? " (default)" : "");
 
   for (out = outputs; *out; out++) {
     printf("\n");
     if ((*out)->help) {
-      printf("Options for output %s:\n", (*out)->name);
+      printf("Settings and options for the audio backend \"%s\":\n", (*out)->name);
       (*out)->help();
     } else {
-      printf("No options for output %s:\n", (*out)->name);    
+      printf("There are no settings or options for the audio backend \"%s\".\n", (*out)->name);    
     }
   }
 }
index e54230da1261eb82003d8c0bc1486c524e9cc350..2fd4497d557111322906562021e21f01eab9d223 100644 (file)
@@ -162,11 +162,10 @@ static uint64_t frame_index;
 static int measurement_data_is_valid;
 
 static void help(void) {
-  printf("    -d output-device    set the output device [default*|...]\n"
-         "    -m mixer-device     set the mixer device ['output-device'*|...]\n"
-         "    -c mixer-control    set the mixer control [Master*|...]\n"
-         "    -i mixer-index      set the mixer index [0*|...]\n"
-         "    *) default option\n");
+  printf("    -d output-device    set the output device, default is \"default\".\n"
+         "    -c mixer-control    set the mixer control name, default is to use no mixer.\n"
+         "    -m mixer-device     set the mixer device, default is the output device.\n"
+         "    -i mixer-index      set the mixer index, default is 0.\n");
 }
 
 void set_alsa_out_dev(char *dev) { alsa_out_dev = dev; }
@@ -202,7 +201,7 @@ int open_mixer() {
             debug(3, "Mixer Control name is \"%s\".", alsa_mix_ctrl);
             alsa_mix_elem = snd_mixer_find_selem(alsa_mix_handle, alsa_mix_sid);
             if (!alsa_mix_elem) {
-              debug(1, "Failed to find mixer element");
+              warn("failed to find mixer control \"%s\".", alsa_mix_ctrl);
               response = -5;
             } else {
               response = 1; // we found a hardware mixer and successfully opened it
index d8dea87f2a0e16a6cdd2562052954095df23d812..88c63c943f9a8622d5bcc367f544eb82db078b35 100644 (file)
@@ -54,10 +54,9 @@ static int play(__attribute__((unused)) void *buf, __attribute__((unused)) int s
 
 static void stop(void) { debug(1, "dummy audio stopped\n"); }
 
-static void help(void) { printf("    There are no options for dummy audio.\n"); }
 
 audio_output audio_dummy = {.name = "dummy",
-                            .help = &help,
+                            .help = NULL,
                             .init = &init,
                             .deinit = &deinit,
                             .start = &start,
index cd321bd9f4d681023374f60f5b3110ff12d012bc..8dd38b8b0838e3dc07e12e0e6af22e4ccb2b0efa 100644 (file)
@@ -300,10 +300,8 @@ static void stop(void) {
   pa_stream_disconnect(stream);
 }
 
-static void help(void) { printf(" no settings.\n"); }
-
 audio_output audio_pa = {.name = "pa",
-                         .help = &help,
+                         .help = NULL,
                          .init = &init,
                          .deinit = &deinit,
                          .start = &start,
index 89a09a0c656fb7c0c5c806b7d4a55d9dd7a9abd5..e97f60344b473339b796b92c0ff123abef97c2e1 100644 (file)
@@ -127,7 +127,7 @@ static void deinit(void) {
     close(fd);
 }
 
-static void help(void) { printf("    pipe takes 1 argument: the name of the FIFO to write to.\n"); }
+static void help(void) { printf("    specify the pathname of the pipe to write to.\n"); }
 
 audio_output audio_pipe = {.name = "pipe",
                            .help = &help,
index 0438b1afad88c067cb6886a75ac4d78db752d9bd..ea48e73d1e85fc320cd6c1d3380adc15579a7be8 100644 (file)
@@ -74,10 +74,8 @@ static void deinit(void) {
   // don't close stdout
 }
 
-static void help(void) { printf("    stdout takes no arguments\n"); }
-
 audio_output audio_stdout = {.name = "stdout",
-                             .help = &help,
+                             .help = NULL,
                              .init = &init,
                              .deinit = &deinit,
                              .start = &start,
index 463e49b472180c44d21d785e15444b2463bb0d8f..59fa72cec8ef9d3beacfec1341ec7ec2a981cc43 100644 (file)
--- a/common.h
+++ b/common.h
@@ -182,7 +182,7 @@ typedef struct {
                               // into the "active" mode.
   uint32_t volume_range_db;   // the range, in dB, from max dB to min dB. Zero means use the mixer's
                               // native range.
-  int volume_range_hw_priority; // when lowering the volume, use all the hw attenuation before using
+  int volume_range_hw_priority; // when extending the volume range by combining sw and hw attenuators, lowering the volume, use all the hw attenuation before using
                                 // sw attenuation
   enum sps_format_t output_format;
   enum volume_control_profile_type volume_control_profile;
index e94e249b344bdb2aeebbf9471b06dd14c075fc6d..8cf3df90b0ff110a424a60da068a4259686095ea 100644 (file)
--- a/player.c
+++ b/player.c
@@ -2673,7 +2673,7 @@ void player_volume_without_notification(double airplay_volume, rtsp_conn_info *c
         // before using the hw attenuation.
         // one imagines that hw priority is likely to be much better
         // if (config.volume_range_hw_priority) {
-        if (1) {
+        if (config.volume_range_hw_priority != 0) {
           // hw priority
           if ((sw_max_db - sw_min_db) > scaled_attenuation) {
             software_attenuation = sw_min_db + scaled_attenuation;
index 031ce57248dc2792473bd06e50326beabcff6c70..4a6ebe29770365f70a2db8ccb96d7c3011e9528b 100644 (file)
@@ -29,6 +29,7 @@ general =
 //     volume_control_profile = "standard" ; // use this advanced setting to specify how the airplay volume is transferred to the mixer volume.
 //             "standard" makes the volume change more quickly at lower volumes and slower at higher volumes.
 //             "flat" makes the volume change at the same rate at all volumes.
+//     volume_range_hw_priority = "yes"; // when extending the volume range by combining the built-in software attenuator with the hardware mixer attenuator, set this to "yes" to reduce volume by using the hardware attenuator first, then the software attenuator.
 //     run_this_when_volume_is_set = "/full/path/to/application/and/args"; //  Run the specified application whenever the volume control is set or changed.
 //             The desired AirPlay volume is appended to the end of the command line – leave a space if you want it treated as an extra argument.
 //             AirPlay volume goes from 0 to -30 and -144 means "mute".
index 9ef40521a7b8abe4c8954ba8556550975ebc5d0e..e2e7b3c49e59686fb6aa075dd80b56d50247dd2a 100644 (file)
@@ -62,7 +62,6 @@
 
 #include "activity_monitor.h"
 #include "common.h"
-#include "mdns.h"
 #include "rtp.h"
 #include "rtsp.h"
 
@@ -96,7 +95,7 @@
 #include <FFTConvolver/convolver.h>
 #endif
 
-static int shutting_down = 0;
+// static int shutting_down = 0;
 char configuration_file_path[4096 + 1];
 char actual_configuration_file_path[4096 + 1];
 
@@ -113,11 +112,9 @@ static void sig_shutdown(__attribute__((unused)) int foo, __attribute__((unused)
 
 static void sig_child(__attribute__((unused)) int foo, __attribute__((unused)) siginfo_t *bar,
                       __attribute__((unused)) void *baz) {
+  // wait for child processes to exit
   pid_t pid;
   while ((pid = waitpid((pid_t)-1, 0, WNOHANG)) > 0) {
-    if (pid == mdns_pid && !shutting_down) {
-      die("MDNS child process died unexpectedly!");
-    }
   }
 }
 
@@ -333,6 +330,8 @@ int parse_options(int argc, char **argv) {
   config.fixedLatencyOffset = 11025; // this sounds like it works properly.
   config.diagnostic_drop_packet_fraction = 0.0;
   config.active_mode_timeout = 10.0;
+  config.volume_range_hw_priority = 1; // if combining software and hardware volume control, give the hardware priority
+  // i.e. when reducing volume, reduce the hw first before reducing the software.
 
 #ifdef CONFIG_METADATA_HUB
   config.cover_art_cache_dir = "/tmp/shairport-sync/.cache/coverart";
@@ -608,6 +607,9 @@ int parse_options(int argc, char **argv) {
           die("Invalid volume_control_profile choice \"%s\". It should be \"standard\" (default) "
               "or \"flat\"");
       }
+      
+      config_set_lookup_bool(config.cfg, "general.volume_control_combined_hardware_priority", &config.volume_range_hw_priority);
+
 
       /* Get the interface to listen on, if specified Default is all interfaces */
       /* we keep the interface name and the index */