diff options
author | thajohns <thajohns@clarkson.edu> | 2021-09-09 01:15:22 -0400 |
---|---|---|
committer | Graham Northup <grahamnorthup@yahoo.com> | 2021-09-10 04:05:55 -0400 |
commit | d6e399973e9bc6447a28b80cacffcbc6a768f1ed (patch) | |
tree | 772939eb5d49bdb6ee8e5d632f2224867f6e817d /src/types.rs | |
parent | ee11b17c0e2796bd3d843a8a516c12453af75927 (diff) |
got pre-linking steps working, removed glob includes
Diffstat (limited to 'src/types.rs')
-rw-r--r-- | src/types.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/types.rs b/src/types.rs index b54eb42..ddef51e 100644 --- a/src/types.rs +++ b/src/types.rs @@ -10,18 +10,20 @@ impl Pitch { pub fn to_midi(&self) -> f32 { match *self { Pitch::MIDI(x) => x, - Pitch::Freq(x) => - 12.0 * (x / 440.0).log2() + 69.0, + Pitch::Freq(x) => 12.0 * (x / 440.0).log2() + 69.0, } } - pub fn to_midi_pitch(&self) -> Pitch { Pitch::MIDI(self.to_midi()) } + pub fn to_midi_pitch(&self) -> Pitch { + Pitch::MIDI(self.to_midi()) + } pub fn to_freq(&self) -> f32 { match *self { - Pitch::MIDI(x) => - 440.0 * (2.0f32).powf((x - 69.0) / 12.0), + Pitch::MIDI(x) => 440.0 * (2.0f32).powf((x - 69.0) / 12.0), Pitch::Freq(x) => x, } } - pub fn to_freq_pitch(&self) -> Pitch { Pitch::Freq(self.to_freq()) } + pub fn to_freq_pitch(&self) -> Pitch { + Pitch::Freq(self.to_freq()) + } } |