diff options
Diffstat (limited to 'trivmix/Trivmix.hs')
-rw-r--r-- | trivmix/Trivmix.hs | 3 |
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 | ||
193 | mix :: MVar Level -> CFloat -> IO CFloat | 194 | mix :: MVar Level -> CFloat -> IO CFloat |
194 | mix level input = do | 195 | mix level input = do |