From 6ba1660f1c28a94542151dc41348d6a39bf4d89c Mon Sep 17 00:00:00 2001 From: Niels Janssen Date: Wed, 3 Nov 2021 20:54:22 +0100 Subject: [PATCH] Added OSC playback control for silencing individual patterns --- src/Sound/Tidal/Stream.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Sound/Tidal/Stream.hs b/src/Sound/Tidal/Stream.hs index 7fd8fefc0..70471a4a9 100644 --- a/src/Sound/Tidal/Stream.hs +++ b/src/Sound/Tidal/Stream.hs @@ -558,7 +558,6 @@ streamReplace s k !pat updatePS Nothing = PlayState pat' False False [pat'] pat' = pat # pS "_id_" (pure $ fromID k) - streamMute :: Stream -> ID -> IO () streamMute s k = withPatIds s [k] (\x -> x {mute = True}) @@ -594,6 +593,9 @@ streamUnmuteAll s = modifyMVar_ (sPMapMV s) $ return . fmap (\x -> x {mute = Fal streamUnsoloAll :: Stream -> IO () streamUnsoloAll s = modifyMVar_ (sPMapMV s) $ return . fmap (\x -> x {solo = False}) +streamSilence :: Stream -> ID -> IO () +streamSilence s k = withPatIds s [k] (\x -> x {pattern = silence, history = silence:history x}) + streamAll :: Stream -> (ControlPattern -> ControlPattern) -> IO () streamAll s f = do _ <- swapMVar (sGlobalFMV s) f return () @@ -682,6 +684,8 @@ ctrlResponder waits c (stream@(Stream {sListen = Just sock})) = streamUnsoloAll stream act (O.Message "/hush" []) = streamHush stream + act (O.Message "/silence" (k:[])) + = withID k $ streamSilence stream act m = hPutStrLn stderr $ "Unhandled OSC: " ++ show m add :: String -> Value -> IO () add k v = do sMap <- takeMVar (sStateMV stream)