diff --git a/client/src/Estuary/Render/Renderer.hs b/client/src/Estuary/Render/Renderer.hs index d8479c9c..1b4fe8a4 100644 --- a/client/src/Estuary/Render/Renderer.hs +++ b/client/src/Estuary/Render/Renderer.hs @@ -273,13 +273,12 @@ maybeClearZone :: Int -> (TextNotation,Text,UTCTime) -> R () maybeClearZone z (newNotation,newTxt,_) = do mOldDef <- gets (IntMap.lookup z . baseDefinitions) case mOldDef of - Nothing -> liftIO $ putStrLn "maybeClearZone - no previous definition" -- pure () -- no previous definition so nothing to clear + Nothing -> pure () -- no previous definition so nothing to clear Just oldDef -> do x <- defsSameRenderer z oldDef newNotation newTxt case x of - True -> liftIO $ putStrLn $ "maybeClearZone - defs have same renderer, " ++ show oldDef ++ ", " ++ show newNotation -- pure () -- definitions have same renderer so nothing to clear + True -> pure () -- definitions have same renderer so nothing to clear False -> do - liftIO $ putStrLn $ "maybeClearZone - clearing zone: " ++ show oldDef clearZone z oldDef clearBaseDefinition z clearBaseNotation z @@ -325,14 +324,11 @@ clearZone z (Sequence _) = clearParamPattern z clearZone _ _ = return () clearTextProgram :: Int -> TextNotation -> R () -clearTextProgram z (TidalTextNotation MiniTidal) = do - liftIO $ putStrLn "clearTextProgram MiniTidal..." - (clearZone' miniTidal) z +clearTextProgram z (TidalTextNotation MiniTidal) = (clearZone' miniTidal) z clearTextProgram z Punctual = (clearZone' punctual) z clearTextProgram z CineCer0 = (clearZone' cineCer0) z clearTextProgram z Hydra = modify' $ \x -> x { hydras = IntMap.delete z $ hydras x } clearTextProgram z LocoMotion = do - liftIO $ putStrLn "clearTextProgram LocoMotion..." s <- get (clearZone' $ exoLangToRenderer LocoMotion $ locoMotion s) z clearTextProgram z TransMit = do diff --git a/client/src/Estuary/Render/TextNotationRenderer.hs b/client/src/Estuary/Render/TextNotationRenderer.hs index dcdc07d8..03b1f814 100644 --- a/client/src/Estuary/Render/TextNotationRenderer.hs +++ b/client/src/Estuary/Render/TextNotationRenderer.hs @@ -11,6 +11,7 @@ import Data.Text import Data.Time import Data.Time.Clock.POSIX import Control.Monad.State.Strict +import Control.Exception hiding (evaluate) import Estuary.Types.NoteEvent import Estuary.Render.R @@ -77,7 +78,15 @@ scheduleWebDirtEvents' exoLang z = do liftIO $ render exoLang z wStart wEnd clearZone'' :: ExoLang -> Int -> R () -clearZone'' exoLang z = liftIO $ clearZone exoLang z +clearZone'' exoLang z = do + x <- liftIO $ try $ clearZone exoLang z + case x of + Right () -> pure () + Left exception -> do + let msg = "Estuary: exception in clearZone'': " ++ show (exception :: SomeException) + liftIO $ putStrLn msg + pure () + preAnimationFrame' :: ExoLang -> R () preAnimationFrame' exoLang = liftIO $ preAnimate exoLang