1
0
Fork 0

Don't treat invalid inputs as center panning

This commit is contained in:
Robbert van der Helm 2022-03-21 14:56:50 +01:00
parent c2b530af36
commit 2911efaa79

View file

@ -64,8 +64,9 @@ pub fn from_f32_panning() -> Arc<dyn Fn(&str) -> Option<f32> + Send + Sync> {
let cleaned_string = string.trim_end_matches(&[' ', 'l', 'L']).parse().ok(); let cleaned_string = string.trim_end_matches(&[' ', 'l', 'L']).parse().ok();
match string.chars().last()?.to_uppercase().next()? { match string.chars().last()?.to_uppercase().next()? {
'L' => cleaned_string.map(|x: f32| x / -100.0), 'L' => cleaned_string.map(|x: f32| x / -100.0),
'C' => Some(0.0),
'R' => cleaned_string.map(|x: f32| x / 100.0), 'R' => cleaned_string.map(|x: f32| x / 100.0),
_ => Some(0.0), _ => None,
} }
}) })
} }