Add code to do calculations involving the audio_backend_latency_offset_in_seconds and audio_backend_silent_lead_in_time settings correctly. Clean up the audio_backend_silent_lead_in_time setting by adding an "auto" setting.
This commit is contained in:
@@ -126,6 +126,7 @@ void parse_general_audio_options(void) {
|
||||
* are set before any options are chosen */
|
||||
int value;
|
||||
double dvalue;
|
||||
const char *str = 0;
|
||||
if (config.cfg != NULL) {
|
||||
|
||||
/* Get the desired buffer size setting (deprecated). */
|
||||
@@ -193,14 +194,37 @@ void parse_general_audio_options(void) {
|
||||
config.audio_backend_latency_offset = dvalue;
|
||||
}
|
||||
|
||||
|
||||
/* Check if the length of the silent lead-in ia set to \"auto\". */
|
||||
if (config_lookup_string(config.cfg, "general.audio_backend_silent_lead_in_time", &str)) {
|
||||
if (strcasecmp(str, "auto") == 0) {
|
||||
config.audio_backend_silent_lead_in_time_auto = 1;
|
||||
} else {
|
||||
if (config.audio_backend_silent_lead_in_time_auto == 1)
|
||||
warn("Invalid audio_backend_silent_lead_in_time \"%s\". It should be \"auto\" or the lead-in time in seconds. "
|
||||
"It remains set to \"auto\". Note: numbers should not be placed in quotes.",
|
||||
str);
|
||||
else
|
||||
warn("Invalid output rate \"%s\". It should be \"auto\" or the lead-in time in seconds. "
|
||||
"It remains set to %f. Note: numbers should not be placed in quotes.",
|
||||
str, config.audio_backend_silent_lead_in_time);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the desired length of the silent lead-in. */
|
||||
if (config_lookup_float(config.cfg, "general.audio_backend_silent_lead_in_time", &dvalue)) {
|
||||
if ((dvalue < 0.0) || (dvalue > 4)) {
|
||||
die("Invalid audio_backend_silent_lead_in_time \"%f\". It "
|
||||
"must be between 0.0 and 4.0 seconds. Omit setting to use the default value",
|
||||
if (config.audio_backend_silent_lead_in_time_auto == 1)
|
||||
warn("Invalid audio_backend_silent_lead_in_time \"%f\". It "
|
||||
"must be between 0.0 and 4.0 seconds. Omit the setting to use the automatic value. The setting remains at \"auto\".",
|
||||
dvalue);
|
||||
else
|
||||
warn("Invalid audio_backend_silent_lead_in_time \"%f\". It "
|
||||
"must be between 0.0 and 4.0 seconds. Omit the setting to use the automatic value. It remains set to %f.",
|
||||
dvalue, config.audio_backend_silent_lead_in_time);
|
||||
} else {
|
||||
config.audio_backend_silent_lead_in_time = dvalue;
|
||||
config.audio_backend_silent_lead_in_time_auto = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user