diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-05-15 21:24:01 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-05-15 21:24:01 +0200 |
commit | 67ecbcfc95a8d2c214fac546fc7d2e83d4c4fc10 (patch) | |
tree | c012ecc71f2995aae3bb4f15c144c563e7fa8aec | |
parent | 879e0c7218298349b9c92e9d3362830c371ec78e (diff) | |
download | trivmix-67ecbcfc95a8d2c214fac546fc7d2e83d4c4fc10.tar trivmix-67ecbcfc95a8d2c214fac546fc7d2e83d4c4fc10.tar.gz trivmix-67ecbcfc95a8d2c214fac546fc7d2e83d4c4fc10.tar.bz2 trivmix-67ecbcfc95a8d2c214fac546fc7d2e83d4c4fc10.tar.xz trivmix-67ecbcfc95a8d2c214fac546fc7d2e83d4c4fc10.zip |
Don't update level when unneccessary
-rw-r--r-- | package.yaml | 2 | ||||
-rw-r--r-- | trivmix.cabal | 2 | ||||
-rw-r--r-- | trivmix.nix | 2 | ||||
-rw-r--r-- | trivmix/Trivmix.hs | 4 |
4 files changed, 6 insertions, 4 deletions
diff --git a/package.yaml b/package.yaml index 123fe83..44132e5 100644 --- a/package.yaml +++ b/package.yaml | |||
@@ -1,5 +1,5 @@ | |||
1 | name: trivmix | 1 | name: trivmix |
2 | version: 4.0.0 | 2 | version: 4.0.1 |
3 | license: PublicDomain | 3 | license: PublicDomain |
4 | license-file: LICENSE | 4 | license-file: LICENSE |
5 | author: Gregor Kleen <aethoago@141.li> | 5 | author: Gregor Kleen <aethoago@141.li> |
diff --git a/trivmix.cabal b/trivmix.cabal index 962edd6..44b9ea0 100644 --- a/trivmix.cabal +++ b/trivmix.cabal | |||
@@ -1,5 +1,5 @@ | |||
1 | name: trivmix | 1 | name: trivmix |
2 | version: 4.0.0 | 2 | version: 4.0.1 |
3 | category: Sound | 3 | category: Sound |
4 | author: Gregor Kleen <aethoago@141.li> | 4 | author: Gregor Kleen <aethoago@141.li> |
5 | license: PublicDomain | 5 | license: PublicDomain |
diff --git a/trivmix.nix b/trivmix.nix index bcc7037..da38e26 100644 --- a/trivmix.nix +++ b/trivmix.nix | |||
@@ -5,7 +5,7 @@ | |||
5 | }: | 5 | }: |
6 | mkDerivation { | 6 | mkDerivation { |
7 | pname = "trivmix"; | 7 | pname = "trivmix"; |
8 | version = "4.0.0"; | 8 | version = "4.0.1"; |
9 | src = ./.; | 9 | src = ./.; |
10 | isLibrary = true; | 10 | isLibrary = true; |
11 | isExecutable = true; | 11 | isExecutable = true; |
diff --git a/trivmix/Trivmix.hs b/trivmix/Trivmix.hs index 5cddf6f..7c18965 100644 --- a/trivmix/Trivmix.hs +++ b/trivmix/Trivmix.hs | |||
@@ -194,7 +194,9 @@ trivmix Options{..} = do | |||
194 | mulBalance (bToScientific -> b) x = either error id $ asScientific (*) (Lin . either error id $ refine b) x | 194 | mulBalance (bToScientific -> b) x = either error id $ asScientific (*) (Lin . either error id $ refine b) x |
195 | newLevel <- mulBalance <$> readMVar balance <*> readMVar level | 195 | newLevel <- mulBalance <$> readMVar balance <*> readMVar level |
196 | currentLevel <- (\(CFloat f) -> Lin . either error id . refine $ realToFrac f) <$> readMVar level' | 196 | currentLevel <- (\(CFloat f) -> Lin . either error id . refine $ realToFrac f) <$> readMVar level' |
197 | mapM_ (\x -> (swapMVar level' $! toRealFloat . unrefine . toLin $ linInt' x currentLevel newLevel) >> threadDelay delay) (takeWhile (<= 1) $ iterate (+ recip frames) 0) | 197 | case compare currentLevel newLevel of |
198 | EQ -> threadDelay . round $ interval * 1e6 | ||
199 | _ -> mapM_ (\x -> (swapMVar level' $! toRealFloat . unrefine . toLin $ linInt' x currentLevel newLevel) >> threadDelay delay) (takeWhile (<= 1) $ iterate (+ recip frames) 0) | ||
198 | notifyReady | 200 | notifyReady |
199 | forever $ threadDelay (round $ watchdogInterval * 1e6) >> notifyWatchdog | 201 | forever $ threadDelay (round $ watchdogInterval * 1e6) >> notifyWatchdog |
200 | 202 | ||