summaryrefslogtreecommitdiff
path: root/trivmix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-05-15 18:49:14 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-05-15 18:49:14 +0200
commit55cee1104651ec938b8f4412993780b766a30f33 (patch)
treed6141e6f8814d4b2656aac1f04196a554cf69574 /trivmix
parent011a884bf286ab4ed908b7b040091b92489eb653 (diff)
downloadtrivmix-55cee1104651ec938b8f4412993780b766a30f33.tar
trivmix-55cee1104651ec938b8f4412993780b766a30f33.tar.gz
trivmix-55cee1104651ec938b8f4412993780b766a30f33.tar.bz2
trivmix-55cee1104651ec938b8f4412993780b766a30f33.tar.xz
trivmix-55cee1104651ec938b8f4412993780b766a30f33.zip
Diffstat (limited to 'trivmix')
-rw-r--r--trivmix/Trivmix.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/trivmix/Trivmix.hs b/trivmix/Trivmix.hs
index 69a3b50..41370cc 100644
--- a/trivmix/Trivmix.hs
+++ b/trivmix/Trivmix.hs
@@ -184,11 +184,12 @@ trivmix Options{..} = do
184 frames = interval * fps 184 frames = interval * fps
185 delay = round $ recip fps * 1e6 185 delay = round $ recip fps * 1e6
186 linInt x a b = a * (1 - x) + b * x 186 linInt x a b = a * (1 - x) + b * x
187 linInt' x a b = either error id $ asFloat (linInt x) a b 187 linInt' x a b = either (const 0) id $ asFloat (linInt x) a b
188 mulBalance (bToFloat -> b) x = either error id $ asFloat (*) (Lin . either error id $ refine b) x 188 mulBalance (bToFloat -> b) x = either error id $ asFloat (*) (Lin . either error id $ refine b) x
189 newLevel <- mulBalance <$> readMVar balance <*> readMVar level 189 newLevel <- mulBalance <$> readMVar balance <*> readMVar level
190 currentLevel <- readMVar level' 190 currentLevel <- readMVar level'
191 mapM_ (\x -> swapMVar level' (linInt' x currentLevel newLevel) >> threadDelay delay) [0,recip frames..1] 191 mapM_ (\x -> swapMVar level' (linInt' x currentLevel newLevel) >> threadDelay delay) [0,recip frames..1]
192 notifyWatchdog
192 193
193mix :: MVar Level -> CFloat -> IO CFloat 194mix :: MVar Level -> CFloat -> IO CFloat
194mix level input = do 195mix level input = do