diff options
Diffstat (limited to 'src/parsing')
-rw-r--r-- | src/parsing/equalizer_apo.lalrpop | 8 | ||||
-rw-r--r-- | src/parsing/equalizer_apo.rs | 9 |
2 files changed, 4 insertions, 13 deletions
diff --git a/src/parsing/equalizer_apo.lalrpop b/src/parsing/equalizer_apo.lalrpop index 39dda67..752aee4 100644 --- a/src/parsing/equalizer_apo.lalrpop +++ b/src/parsing/equalizer_apo.lalrpop | |||
@@ -5,12 +5,8 @@ use std::str::FromStr; | |||
5 | grammar; | 5 | grammar; |
6 | 6 | ||
7 | pub Main: Filter = { | 7 | pub Main: Filter = { |
8 | <preamp: Preamp> <eq: Eq> => { | 8 | <preamp: Preamp> <eq: Eq> => Filter { preamp, frequencies: eq.0, coefficients: eq.1 } |
9 | let coefficients: Vec<_> = eq.1.iter().map(|decibel| 10f64.powf(decibel / 10f64).sqrt()).collect(); | 9 | |
10 | // TODO: add decibel_to_ratio conversion function | ||
11 | let preamp = 10f64.powf(preamp / 10f64); | ||
12 | Filter { preamp, frequencies: eq.0, coefficients } | ||
13 | } | ||
14 | } | 10 | } |
15 | 11 | ||
16 | Preamp: f64 = { | 12 | Preamp: f64 = { |
diff --git a/src/parsing/equalizer_apo.rs b/src/parsing/equalizer_apo.rs index a24cf99..b0aa8f8 100644 --- a/src/parsing/equalizer_apo.rs +++ b/src/parsing/equalizer_apo.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | // auto-generated: "lalrpop 0.15.2" | 1 | // auto-generated: "lalrpop 0.15.2" |
2 | // sha256: a735e8f9bd5cf5f3aac915d12b24752d366481c3952258e22871eef395f44 | 2 | // sha256: 3981cad2c0ee5c1d80c3b7278bb1bc9926ee7b273c2b68423accdd84e43c494 |
3 | use ::Filter; | 3 | use ::Filter; |
4 | use std::str::FromStr; | 4 | use std::str::FromStr; |
5 | #[allow(unused_extern_crates)] | 5 | #[allow(unused_extern_crates)] |
@@ -879,12 +879,7 @@ fn __action1< | |||
879 | (_, eq, _): (usize, (Vec<u32>, Vec<f64>), usize), | 879 | (_, eq, _): (usize, (Vec<u32>, Vec<f64>), usize), |
880 | ) -> Filter | 880 | ) -> Filter |
881 | { | 881 | { |
882 | { | 882 | Filter { preamp, frequencies: eq.0, coefficients: eq.1 } |
883 | let coefficients: Vec<_> = eq.1.iter().map(|decibel| 10f64.powf(decibel / 10f64).sqrt()).collect(); | ||
884 | // TODO: add decibel_to_ratio conversion function | ||
885 | let preamp = 10f64.powf(preamp / 10f64); | ||
886 | Filter { preamp, frequencies: eq.0, coefficients } | ||
887 | } | ||
888 | } | 883 | } |
889 | 884 | ||
890 | #[allow(unused_variables)] | 885 | #[allow(unused_variables)] |