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
Next Next commit
Fix bugs with per-context busmaps
  • Loading branch information
mindofmatthew committed Nov 29, 2023
commit 753142e179171d4894f809804ba4031815e3a2f2
8 changes: 4 additions & 4 deletions src/Sound/Tidal/Stream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ startStream config oscmap
remote_busses <- sequence (oBusPort target >> (Just $ newMVar []))
let broadcast = if cCtrlBroadcast config then 1 else 0
u <- O.udp_socket (\sock sockaddr -> do N.setSocketOption sock N.Broadcast broadcast
N.connect sock sockaddr
-- N.connect sock sockaddr
) (oAddress target) (oPort target)
let cx = Cx {cxUDP = u, cxAddr = remote_addr, cxBusAddr = remote_bus_addr, cxBusses = remote_busses, cxTarget = target, cxOSCs = os}
handshake cx config
_ <- forkIO $ handshake cx config
return cx
) oscmap
let bpm = (coerce defaultCps) * 60 * (cBeatsPerCycle config)
Expand All @@ -243,10 +243,10 @@ startStream config oscmap
return stream

handshake :: Cx -> Config -> IO ()
handshake Cx { cxUDP = udp, cxBusses = Just bussesMV } c = sendHandshake >> listen 0
handshake Cx { cxUDP = udp, cxBusses = Just bussesMV, cxAddr = addr } c = sendHandshake >> listen 0
where
sendHandshake :: IO ()
sendHandshake = O.sendMessage udp (O.Message "/dirt/handshake" [])
sendHandshake = O.sendTo udp (O.Packet_Message $ O.Message "/dirt/handshake" []) (N.addrAddress addr)
listen :: Int -> IO ()
listen waits = do ms <- recvMessagesTimeout 2 udp
if (null ms)
Expand Down