From dddd66c3f827ef38ed27ef12e22806b7aee880b4 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 21 Jun 2015 20:45:31 +0200 Subject: Fixed db/lin conversion --- src/Trivmix/Types.hs | 8 ++++---- trivmix.cabal | 2 +- trivmix.nix | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Trivmix/Types.hs b/src/Trivmix/Types.hs index 9822449..874eb42 100644 --- a/src/Trivmix/Types.hs +++ b/src/Trivmix/Types.hs @@ -44,23 +44,23 @@ withResolution :: (HasResolution a) => (Integer -> f a) -> f a withResolution f = withType (f . resolution) linToDb :: Float -> Float -linToDb x = 10 ** (0.05 * x) +linToDb x = 20 * (logBase 10 x) dBToLin :: Float -> Float -dBToLin x = 20 * (logBase 10 x) +dBToLin x = 10 ** (0.05 * x) instance Show Level where show (Lin x) = show x show (DB x) = (show $ (withPrec x' :: Milli)) ++ "dB" where - x' = dBToLin x + x' = linToDb x instance Read Level where readsPrec i = map toL . readsPrec i where toL :: (Float, String) -> (Level, String) toL (f, str) - | ((==) `on` CI.mk) prec unit = (DB $ linToDb f, rest) + | ((==) `on` CI.mk) prec unit = (DB $ dBToLin f, rest) | otherwise = (Lin f, str) where prec = take lU str diff --git a/trivmix.cabal b/trivmix.cabal index 3f3da68..9b2d723 100644 --- a/trivmix.cabal +++ b/trivmix.cabal @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: trivmix -version: 2.5.4 +version: 2.5.5 -- synopsis: -- description: license: PublicDomain diff --git a/trivmix.nix b/trivmix.nix index 35aa4f1..1e329ab 100644 --- a/trivmix.nix +++ b/trivmix.nix @@ -6,7 +6,7 @@ cabal.mkDerivation (self: { pname = "trivmix"; - version = "2.5.4"; + version = "2.5.5"; src = ./.; isLibrary = true; isExecutable = true; -- cgit v1.2.3