]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add, untested, stuff to capture and remember a volume_range_db setting.
authorMke Brady <mikebrady@eircom.net>
Wed, 7 Oct 2015 07:40:10 +0000 (08:40 +0100)
committerMke Brady <mikebrady@eircom.net>
Wed, 7 Oct 2015 07:40:10 +0000 (08:40 +0100)
common.h
configure.ac
scripts/shairport-sync.conf
scripts/shairport-sync.conf~ [new file with mode: 0644]
shairport.c

index 0f51a4b35845b0abf1857ffd40f5321837752abf..ef3f84b3dea703029a07f49b21c8e52458c3bfbf 100644 (file)
--- a/common.h
+++ b/common.h
@@ -81,6 +81,7 @@ typedef struct {
   int32_t audio_backend_buffer_desired_length; // this will be the desired number of frames in the
                                             // audio backend buffer -- the DAC buffer for ALSA
   int32_t audio_backend_latency_offset; // this will be the offset to compensate for any fixed latency
+  uint32_t volume_range_db; // the range, in dB, from max dB to min dB. Zero means use the mixer's native range.
                                      // there might be in the audio
 } shairport_cfg;
 
index f6f0f70f421f5f82af76a84c2feaaf7c83d44ef1..6b15fef91138dec62963de13d472d1d9c0fc4286 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.50])
-AC_INIT([shairport-sync], [2.5.0.8], [mikebrady@eircom.net])
+AC_INIT([shairport-sync], [2.5.0.9], [mikebrady@eircom.net])
 AM_INIT_AUTOMAKE
 AC_CONFIG_SRCDIR([shairport.c])
 AC_CONFIG_HEADERS([config.h])
index 8a4dbf728f20eedf7c1d920dce021337eef11e20..0a9be12aed671683bdf86b0941fbc64e1786ee17 100644 (file)
@@ -17,6 +17,7 @@ general =
 //     resync_threshold = 2205; // a synchronisation error greater than this will cause resynchronisation; 0 disables it
 //     log_verbosity = 0; // "0" means no debug verbosity, "3" is most verbose.
 //  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 = 0; // set this to the range, in dB, you want between the maximum volume and the minimum volume. Zero means use the mixer's native range. Default is 0.
 };
 
 // How to deal with metadata, including artwork
diff --git a/scripts/shairport-sync.conf~ b/scripts/shairport-sync.conf~
new file mode 100644 (file)
index 0000000..8a4dbf7
--- /dev/null
@@ -0,0 +1,81 @@
+// Sample Configuration File for Shairport Sync
+// Commented out settings are generally the defaults, except where noted.
+
+// General Settings
+general =
+{
+//     name = "Shairport Sync Player"; // This is the name the service will advertise to iTunes. The default is "Shairport Sync on <hostname>"
+//     password = "secret"; // comment out this line if you want to have no password
+//     interpolation = "basic"; // aka "stuffing". Default is "basic", alternative is "soxr". Use "soxr" only if you have a reasonably fast processor.
+//     output_backend = "alsa"; // Run "shairport-sync -h" to get a list of all output_backends, e.g. "alsa", "pipe", "stdout". The default is the first one.
+//     mdns_backend = "avahi"; // Run "shairport-sync -h" to get a list of all mdns_backends. The default is the first one.
+//     port = 5000; // Listen for service requests on this port
+//     udp_port_base = 6001; // start allocating UDP ports from this port number when needed
+//     udp_port_range = 100; // look for free ports in this number of places, starting at the UDP port base (only three are needed).
+//     statistics = "no"; // set to "yes" to print statistics in the log
+//     drift = 88; // allow this number of frames of drift away from exact synchronisation before attempting to correct it
+//     resync_threshold = 2205; // a synchronisation error greater than this will cause resynchronisation; 0 disables it
+//     log_verbosity = 0; // "0" means no debug verbosity, "3" is most verbose.
+//  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.
+};
+
+// How to deal with metadata, including artwork
+metadata =
+{
+//     enabled = "no"; // et to yes to get Shairport Sync to solicit metadata from the source and to pass it on via a pipe
+//     include_cover_art = "no"; // set to "yes" to get Shairport Sync to solicit cover art from the source and pass it via the pipe. You must also set "enabled" to "yes".
+//     pipe_name = "/tmp/shairport-sync-metadata";
+};
+
+// Advanced parameters for controlling how a Shairport Sync runs
+sessioncontrol = 
+{
+//     run_this_before_play_begins = "/full/path/to/application and args"; // make sure the application has executable permission. It it's a script, include the #!... stuff on the first line
+//     run_this_after_play_ends = "/full/path/to/application and args"; // make sure the application has executable permission. It it's a script, include the #!... stuff on the first line
+//     wait_for_completion = "no"; // set to "yes" to get Shairport Sync to wait until the "run_this..." applications have terminated before continuing
+//     allow_session_interruption = "no"; // set to "yes" to allow another device to interrupt Shairport Sync while it's playing from an existing audio source
+//     session_timeout = 120; // wait for this number of seconds after a source disappears before terminating the session and becoming available again.
+};
+
+//
+// Back End Settings
+//
+
+// These are parameters for the "alsa" audio back end, the only back end that supports synchronised audio.
+alsa =
+{
+//  output_device = "default"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
+//  mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
+//  mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
+//  audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+//  audio_backend_buffer_desired_length = 6615; // If set too small, buffer underflow occurs on low-powered machines. Too long and the response times with software mixer become annoying.
+};
+
+// These are parameters for the "pipe" audio back end, a back end that directs raw CD-style audio output to a pipe. No interpolation is done.
+pipe =
+{
+//  name = "/path/to/pipe"; // there is no default pipe name for the output
+//  audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+//  audio_backend_buffer_desired_length = 44100; // Having started to send audio at the right time, send all subsequent audio this many frames ahead of time, creating a buffer this size.
+};
+
+// These are parameters for the "stdout" audio back end, a back end that directs raw CD-style audio output to stdout. No interpolation is done.
+stdout =
+{
+//  audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+//  audio_backend_buffer_desired_length = 44100; // Having started to send audio at the right time, send all subsequent audio this many frames ahead of time, creating a buffer this size.
+};
+
+// The following static latency settings are deprecated -- do not use them for new installations. Shairport Sync now sets latencies automatically.
+// To compensate for a delay in the output device using the alsa/stdio/pipe "audio_backend_latency_offset" setting.
+
+// Static latencies for different sources. These have been estimated from listening tests.
+latencies =
+{
+//     default = 88200; // used for unrecognised sources and for iTunes up to and including iTunes 9.X.
+//     itunes = 99400; // used for iTunes 10 or later
+//     airplay = 88200;
+//     forkedDaapd = 99400;
+};
+
+
index beb8d21bc3f4adf8738a310c64c71736123ea506..a17fa86bbfaa1d4bd83b3f6125651f480661dc7f 100644 (file)
@@ -399,7 +399,16 @@ int parse_options(int argc, char **argv) {
           die("Invalid ignore_volume_control option choice \"%s\". It should be \"yes\" or \"no\"");
       }
 
-      /* Get the default latency. Deprecated! */
+      /* Get the volume range, in dB, that should be used If not set, it means you just use the range set by the mixer. */
+      if (config_lookup_int(config.cfg, "general.volume_range", &value)) {
+        if ((value < 0) || (value > 200))
+          die("Invalid volume range  \"%sd\". It should be between 0 and 200. Zero means use the mixer's native range",
+              value);
+        else
+          config.volume_range_db = value;
+      }
+
+/* Get the default latency. Deprecated! */
       if (config_lookup_int(config.cfg, "latencies.default", &value))
         config.userSuppliedLatency = value;
 
@@ -893,7 +902,7 @@ int main(int argc, char **argv) {
   debug(2, "audio backend desired buffer length is %d.",
         config.audio_backend_buffer_desired_length);
   debug(2, "audio backend latency offset is %d.", config.audio_backend_latency_offset);
-  debug(2, "use_negotiated_latencies %d.", config.use_negotiated_latencies);
+  debug(2, "volume range in dB (zero means use the range specified by the mixer): %u.", config.volume_range_db);
   
   char *realConfigPath = realpath(config.configfile,NULL);
   if (realConfigPath) {