]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
hook up the alsa "use_precision_timing" option and update the sample conf file.
authorMike Brady <mikebrady@eircom.net>
Tue, 9 Apr 2019 10:06:52 +0000 (11:06 +0100)
committerMike Brady <mikebrady@eircom.net>
Tue, 9 Apr 2019 10:06:52 +0000 (11:06 +0100)
audio_alsa.c
scripts/shairport-sync.conf

index 4987ee125ffb64c129f6d62ad158bc347eca0797..86016a3759062e6c90315a2f70a2622339c9eca9 100644 (file)
@@ -533,6 +533,17 @@ int actual_open_alsa_device(void) {
              "length (%ld) you have chosen.",
           actual_buffer_length, config.audio_backend_buffer_desired_length);
   }
+  
+  
+  if (config.use_precision_timing == YNA_YES) 
+    delay_and_status = precision_delay_and_status;
+  else if (config.use_precision_timing == YNA_AUTO) {
+    const char *output_device_name = snd_pcm_name(alsa_handle);
+    if (strstr(output_device_name,"hw:") == output_device_name) {
+      delay_and_status = precision_delay_and_status;
+      debug(1,"alsa: using precision timing");
+    }
+  }
 
   if (alsa_characteristics_already_listed == 0) {
     alsa_characteristics_already_listed = 1;
@@ -1702,7 +1713,7 @@ int precision_delay_available() {
           precision_delay_available_status = YNDK_NO;
           debug(2,"alsa: precision delay timing not available.");
           if (config.disable_standby_mode != disable_standby_off)
-            inform("Note: disable_standby_mode has been turned off because the output device \"%s\" does not support precision delay timing.", snd_pcm_name(alsa_handle));
+            inform("Note: disable_standby_mode has been turned off because precision timing is not available.", snd_pcm_name(alsa_handle));
         }
       }
     }
index e24f1e84980db022b2d3352975f62148e510c3d8..a979431ce5ad3ac3cdf758f2ab99dadcb04188a3 100644 (file)
@@ -92,7 +92,8 @@ alsa =
 //     use_mmap_if_available = "yes"; // Use this optional advanced setting to control whether MMAP-based output is used to communicate  with the DAC. Default is "yes"
 //     use_hardware_mute_if_available = "no"; // Use this optional advanced setting to control whether the hardware in the DAC is used for muting. Default is "no", for compatibility with other audio players.
 //     maximum_stall_time = 0.200; // Use this optional advanced setting to control how long to wait for data to be consumed by the output device before considering it an error. It should never approach 200 ms.
-//     disable_standby_mode = "never"; // Some DACs make small "popping" noises when they go in and out of standby mode. This prevents entry to standby mode. Settings can be: "always", "while_active" or "never". Default is "never", but only for backwards compatibility. You can use "yes" instead of "always" and "no instead of "never".
+//     use_precision_timing = "auto"; // If the output device is a real hardware device, precision timing will be used, which is needed for "disable_standby_mode" below. Choose "no" for more compatible standard timing, choose yes to force the use of precision timing, which may cause problems.
+//     disable_standby_mode = "never"; // Some DACs make small "popping" noises when they go in and out of standby mode. This prevents entry to standby mode. Settings can be: "always", "while_active" or "never". Default is "never", but only for backwards compatibility. You can use "yes" instead of "always" and "no instead of "never". Needs precision timing to be available.
 };
 
 // Parameters for the "sndio" audio back end. All are optional.