diff options
-rw-r--r-- | trivmix/Trivmix.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/trivmix/Trivmix.hs b/trivmix/Trivmix.hs index db3246a..ea8bad3 100644 --- a/trivmix/Trivmix.hs +++ b/trivmix/Trivmix.hs | |||
@@ -185,7 +185,7 @@ trivmix Options{..} = do | |||
185 | Audio.withProcessMono client' input' (mix level') output' $ | 185 | Audio.withProcessMono client' input' (mix level') output' $ |
186 | Jack.withActivation client' . Trans.lift $ do | 186 | Jack.withActivation client' . Trans.lift $ do |
187 | forM_ run $ \script -> | 187 | forM_ run $ \script -> |
188 | (callProcess script [client ++ ":" ++ input, client ++ ":" ++ output]) `catch` (\code -> errorConcurrent $ script ++ " failed: " ++ show (code :: ExitCode)) | 188 | (callProcess script [client ++ ":" ++ input, client ++ ":" ++ output]) `catch` (\code -> errorConcurrent $ script ++ " failed: " ++ show (code :: ExitCode) ++ "\n") |
189 | forkIO . forever $ do -- Smooth out discontinuity | 189 | forkIO . forever $ do -- Smooth out discontinuity |
190 | let | 190 | let |
191 | frames = interval * fps | 191 | frames = interval * fps |
@@ -199,7 +199,7 @@ trivmix Options{..} = do | |||
199 | EQ -> threadDelay . round $ interval * 1e6 | 199 | EQ -> threadDelay . round $ interval * 1e6 |
200 | _ -> do | 200 | _ -> do |
201 | mapM_ (\x -> (swapMVar level' $! toRealFloat . unrefine . toLin $ linInt' x currentLevel newLevel) >> threadDelay delay) (takeWhile (<= 1) $ iterate (+ recip frames) 0) | 201 | mapM_ (\x -> (swapMVar level' $! toRealFloat . unrefine . toLin $ linInt' x currentLevel newLevel) >> threadDelay delay) (takeWhile (<= 1) $ iterate (+ recip frames) 0) |
202 | errorConcurrent $ "Finished smooth transition from ‘" ++ show currentLevel ++ "’ to ‘" ++ show newLevel ++ "’." | 202 | errorConcurrent $ "Finished smooth transition from ‘" ++ show currentLevel ++ "’ to ‘" ++ show newLevel ++ "’.\n" |
203 | notifyReady | 203 | notifyReady |
204 | forever $ threadDelay (round $ watchdogInterval * 1e6) >> notifyWatchdog | 204 | forever $ threadDelay (round $ watchdogInterval * 1e6) >> notifyWatchdog |
205 | 205 | ||
@@ -230,19 +230,19 @@ onStateFile file initial action = do | |||
230 | let acquireFile = case exists of | 230 | let acquireFile = case exists of |
231 | True -> return () | 231 | True -> return () |
232 | False -> do | 232 | False -> do |
233 | errorConcurrent $ "Creating ‘" ++ file ++ "’ (file)" | 233 | errorConcurrent $ "Creating ‘" ++ file ++ "’ (file)\n" |
234 | createFile file defFileMode >>= closeFd >> writeFile file initial | 234 | createFile file defFileMode >>= closeFd >> writeFile file initial |
235 | releaseFile = case exists of | 235 | releaseFile = case exists of |
236 | True -> return () | 236 | True -> return () |
237 | False -> do | 237 | False -> do |
238 | errorConcurrent $ "Removing ‘" ++ file ++ "’ (file)" | 238 | errorConcurrent $ "Removing ‘" ++ file ++ "’ (file)\n" |
239 | removeFile file | 239 | removeFile file |
240 | acquireDir = (flip mapM) (reverse createDirs) $ \directory -> do | 240 | acquireDir = (flip mapM) (reverse createDirs) $ \directory -> do |
241 | errorConcurrent $ "Creating ‘" ++ directory ++ "’ (dir)" | 241 | errorConcurrent $ "Creating ‘" ++ directory ++ "’ (dir)\n" |
242 | createDirectory directory | 242 | createDirectory directory |
243 | setFileMode directory defDirectoryMode | 243 | setFileMode directory defDirectoryMode |
244 | releaseDir = (flip mapM) createDirs $ \directory -> do | 244 | releaseDir = (flip mapM) createDirs $ \directory -> do |
245 | errorConcurrent $ "Removing ‘" ++ directory ++ "’ (dir)" | 245 | errorConcurrent $ "Removing ‘" ++ directory ++ "’ (dir)\n" |
246 | removeDirectory directory | 246 | removeDirectory directory |
247 | acquire = acquireDir >> acquireFile | 247 | acquire = acquireDir >> acquireFile |
248 | release = releaseFile >> releaseDir | 248 | release = releaseFile >> releaseDir |
@@ -267,10 +267,10 @@ readLevel levelChan current file = catch action handler | |||
267 | oldLevel <- readMVar current | 267 | oldLevel <- readMVar current |
268 | when (oldLevel /= level) $ do | 268 | when (oldLevel /= level) $ do |
269 | writeChan levelChan level | 269 | writeChan levelChan level |
270 | errorConcurrent $ "Detected new level: " ++ show level | 270 | errorConcurrent $ "Detected new level ‘" ++ show level ++ "’.\n" |
271 | handler e = if isUserError e | 271 | handler e = if isUserError e |
272 | then do | 272 | then do |
273 | errorConcurrent $ "Could not parse new level from ‘" ++ file ++ "’ - overwriting." | 273 | errorConcurrent $ "Could not parse new level from ‘" ++ file ++ "’ - overwriting.\n" |
274 | readMVar current >>= writeLevel file | 274 | readMVar current >>= writeLevel file |
275 | else throw e | 275 | else throw e |
276 | stripSpace = reverse . stripSpace' . reverse . stripSpace' | 276 | stripSpace = reverse . stripSpace' . reverse . stripSpace' |
@@ -281,5 +281,5 @@ readLevel levelChan current file = catch action handler | |||
281 | 281 | ||
282 | writeLevel :: Show l => FilePath -> l -> IO () | 282 | writeLevel :: Show l => FilePath -> l -> IO () |
283 | writeLevel file level = withFileLock file Exclusive $ const $ do | 283 | writeLevel file level = withFileLock file Exclusive $ const $ do |
284 | errorConcurrent $ "Writing out level ‘" ++ (show level) ++ "’ to ‘" ++ file ++ "’" | 284 | errorConcurrent $ "Writing out level ‘" ++ (show level) ++ "’ to ‘" ++ file ++ "’.\n" |
285 | writeFile file (show level ++ "\n") | 285 | writeFile file (show level ++ "\n") |