mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Warn the user if the try to set interpolation-quality with 44.1kHz
This commit is contained in:
parent
46b8f84d6a
commit
340bac5eb0
1 changed files with 26 additions and 18 deletions
44
src/main.rs
44
src/main.rs
|
@ -782,24 +782,6 @@ fn get_setup() -> Setup {
|
|||
exit(1);
|
||||
});
|
||||
|
||||
let interpolation_quality = opt_str(INTERPOLATION_QUALITY)
|
||||
.as_deref()
|
||||
.map(|interpolation_quality| {
|
||||
InterpolationQuality::from_str(interpolation_quality).unwrap_or_else(|_| {
|
||||
let default_value = &format!("{}", InterpolationQuality::default());
|
||||
invalid_error_msg(
|
||||
INTERPOLATION_QUALITY,
|
||||
"",
|
||||
interpolation_quality,
|
||||
"Low, Medium, High",
|
||||
default_value,
|
||||
);
|
||||
|
||||
exit(1);
|
||||
})
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let sample_rate = opt_str(SAMPLE_RATE)
|
||||
.as_deref()
|
||||
.map(|sample_rate| {
|
||||
|
@ -818,6 +800,32 @@ fn get_setup() -> Setup {
|
|||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let interpolation_quality = opt_str(INTERPOLATION_QUALITY)
|
||||
.as_deref()
|
||||
.map(|interpolation_quality| match sample_rate {
|
||||
SampleRate::Hz44100 => {
|
||||
warn!(
|
||||
"--{} has no effect with a sample rate of {sample_rate}.",
|
||||
INTERPOLATION_QUALITY
|
||||
);
|
||||
|
||||
InterpolationQuality::default()
|
||||
}
|
||||
_ => InterpolationQuality::from_str(interpolation_quality).unwrap_or_else(|_| {
|
||||
let default_value = &format!("{}", InterpolationQuality::default());
|
||||
invalid_error_msg(
|
||||
INTERPOLATION_QUALITY,
|
||||
"",
|
||||
interpolation_quality,
|
||||
"Low, Medium, High",
|
||||
default_value,
|
||||
);
|
||||
|
||||
exit(1);
|
||||
}),
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let format = opt_str(FORMAT)
|
||||
.as_deref()
|
||||
.map(|format| {
|
||||
|
|
Loading…
Reference in a new issue