Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split controller OSC off from SuperDirt handshake OSC (Redux for 1.9) #1051

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Prev Previous commit
Merge remote-tracking branch 'upstream/dev' into split-osc-code
  • Loading branch information
mindofmatthew committed Apr 19, 2024
commit 36ea2ec5e1e64932a3b05160c0961f995f90cb3d
18 changes: 10 additions & 8 deletions src/Sound/Tidal/Stream/Process.hs
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,13 @@ toOSC maybeBusses pe osc@(OSC _ _)
toBus n | Just busses <- maybeBusses, (not . null) busses = busses !!! n
| otherwise = n
busmsgs = map
(\(('^':k), (VI b)) -> do v <- Map.lookup k playmap
return $ (tsPart,
True, -- bus message ?
O.Message "/c_set" [O.int32 (toBus b), toDatum v]
)
(\(k, b) -> do k' <- if (not $ null k) && head k == '^' then Just (tail k) else Nothing
v <- Map.lookup k' playmap
bi <- getI b
return $ (tsPart,
True, -- bus message ?
O.Message "/c_set" [O.int32 (toBus bi), toDatum v]
)
)
(Map.toList busmap)
where
Expand Down Expand Up @@ -316,7 +318,7 @@ updatePattern stream k !t pat = do
setPreviousPatternOrSilence :: MVar PlayMap -> IO ()
setPreviousPatternOrSilence playMV =
modifyMVar_ playMV $ return
. Map.map ( \ pMap -> case history pMap of
_:p:ps -> pMap { pattern = p, history = p:ps }
_ -> pMap { pattern = silence, history = [silence] }
. Map.map ( \ pMap -> case psHistory pMap of
_:p:ps -> pMap { psPattern = p, psHistory = p:ps }
_ -> pMap { psPattern = silence, psHistory = [silence] }
)
8 changes: 4 additions & 4 deletions src/Sound/Tidal/Stream/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ data OSC = OSC {path :: String,
| OSCContext {path :: String}
deriving Show

data PlayState = PlayState {pattern :: ControlPattern,
mute :: Bool,
solo :: Bool,
history :: [ControlPattern]
data PlayState = PlayState {psPattern :: ControlPattern,
psMute :: Bool,
psSolo :: Bool,
psHistory :: [ControlPattern]
}
deriving Show

Expand Down
8 changes: 4 additions & 4 deletions src/Sound/Tidal/Stream/UI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ streamList s = do pMap <- readMVar (sPMapMV s)
let hs = hasSolo pMap
putStrLn $ concatMap (showKV hs) $ Map.toList pMap
where showKV :: Bool -> (PatId, PlayState) -> String
showKV True (k, (PlayState {solo = True})) = k ++ " - solo\n"
showKV True (k, _) = "(" ++ k ++ ")\n"
showKV False (k, (PlayState {solo = False})) = k ++ "\n"
showKV False (k, _) = "(" ++ k ++ ") - muted\n"
showKV True (k, (PlayState {psSolo = True})) = k ++ " - solo\n"
showKV True (k, _) = "(" ++ k ++ ")\n"
showKV False (k, (PlayState {psSolo = False})) = k ++ "\n"
showKV False (k, _) = "(" ++ k ++ ") - muted\n"

streamReplace :: Stream -> ID -> ControlPattern -> IO ()
streamReplace stream k !pat = do
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.