summaryrefslogtreecommitdiff
path: root/src/transforms.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2017-10-15 21:44:15 +0200
committerJustin Worthe <justin@worthe-it.co.za>2017-10-15 21:44:15 +0200
commit17b3c1e4231288056b794ab22771d2b3fb423984 (patch)
tree6ab29ad91fca570389c42713d2ca420a24a70a3d /src/transforms.rs
parent44e8d9cee54a24367d25410f78aa10d479eda572 (diff)
Added emscripten calls for hz interpretation
This also uncovered a weird compilation issue. Emscripten did NOT like me using the remainder operator with a floating point number.
Diffstat (limited to 'src/transforms.rs')
-rw-r--r--src/transforms.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/transforms.rs b/src/transforms.rs
index 55f81b6..aaae83b 100644
--- a/src/transforms.rs
+++ b/src/transforms.rs
@@ -169,7 +169,7 @@ fn hz_to_midi_number(hz: f32) -> f32 {
pub fn hz_to_cents_error(hz: f32) -> f32 {
let midi_number = hz_to_midi_number(hz);
- let cents = (midi_number % 1.0) * 100.0;
+ let cents = (midi_number - midi_number.floor()) * 100.0;
if cents >= 50.0 {
cents - 100.0
}