From: Mike Brady Date: Tue, 9 Apr 2019 10:06:52 +0000 (+0100) Subject: hook up the alsa "use_precision_timing" option and update the sample conf file. X-Git-Tag: 3.3rc4~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=986f2fb4bdba5a79c14a930c44d3376e3549821c;p=thirdparty%2Fshairport-sync.git hook up the alsa "use_precision_timing" option and update the sample conf file. --- diff --git a/audio_alsa.c b/audio_alsa.c index 4987ee12..86016a37 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -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)); } } } diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf index e24f1e84..a979431c 100644 --- a/scripts/shairport-sync.conf +++ b/scripts/shairport-sync.conf @@ -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.