summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-05-15 21:24:01 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-05-15 21:24:01 +0200
commit67ecbcfc95a8d2c214fac546fc7d2e83d4c4fc10 (patch)
treec012ecc71f2995aae3bb4f15c144c563e7fa8aec
parent879e0c7218298349b9c92e9d3362830c371ec78e (diff)
downloadtrivmix-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.yaml2
-rw-r--r--trivmix.cabal2
-rw-r--r--trivmix.nix2
-rw-r--r--trivmix/Trivmix.hs4
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 @@
1name: trivmix 1name: trivmix
2version: 4.0.0 2version: 4.0.1
3license: PublicDomain 3license: PublicDomain
4license-file: LICENSE 4license-file: LICENSE
5author: Gregor Kleen <aethoago@141.li> 5author: 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 @@
1name: trivmix 1name: trivmix
2version: 4.0.0 2version: 4.0.1
3category: Sound 3category: Sound
4author: Gregor Kleen <aethoago@141.li> 4author: Gregor Kleen <aethoago@141.li>
5license: PublicDomain 5license: 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}:
6mkDerivation { 6mkDerivation {
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