Skip to content

Commit

Permalink
hook up the alsa "use_precision_timing" option and update the sample …
Browse files Browse the repository at this point in the history
…conf file.
  • Loading branch information
mikebrady committed Apr 9, 2019
1 parent aac57c9 commit 986f2fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 12 additions & 1 deletion audio_alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/shairport-sync.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 986f2fb

Please sign in to comment.