diff options
author | Joe Rayhawk <jrayhawk@fairlystable.org> | 2022-11-19 22:28:49 -0800 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@fairlystable.org> | 2022-11-19 22:28:49 -0800 |
commit | 01a7c7f34d11cbeef0b201533bef9ad3d0b640cc (patch) | |
tree | d65ac6a525f75db00f0e136fd6d64677db177c52 /src | |
parent | f9dd3cd0932ab4f2f19e8b8c62c4f646486c1e66 (diff) | |
download | crystal-obs-websocket-01a7c7f34d11cbeef0b201533bef9ad3d0b640cc.tar.gz crystal-obs-websocket-01a7c7f34d11cbeef0b201533bef9ad3d0b640cc.zip |
SceneItem.enable and .disable! should probably block.
AFAIK we don't especially care about latency on these.
Diffstat (limited to 'src')
-rw-r--r-- | src/obswebsocket.cr | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/obswebsocket.cr b/src/obswebsocket.cr index 88b66b6..6f623a0 100644 --- a/src/obswebsocket.cr +++ b/src/obswebsocket.cr @@ -831,10 +831,14 @@ module OBS end end def enable! - @reqchan.send( { nil, OBS.req( "SetSceneItemEnabled", UUID.random.to_s, JSON.parse( { "sceneName" => @scenename, "sceneItemId" => @id, "sceneItemEnabled" => true }.to_json ) ) } ) + reschan = Channel( JSON::Any ).new + @reqchan.send( { reschan, OBS.req( "SetSceneItemEnabled", UUID.random.to_s, JSON.parse( { "sceneName" => @scenename, "sceneItemId" => @id, "sceneItemEnabled" => true }.to_json ) ) } ) + d = reschan.receive # block until response end def disable! - @reqchan.send( { nil, OBS.req( "SetSceneItemEnabled", UUID.random.to_s, JSON.parse( { "sceneName" => @scenename, "sceneItemId" => @id, "sceneItemEnabled" => false }.to_json ) ) } ) + reschan = Channel( JSON::Any ).new + @reqchan.send( { reschan, OBS.req( "SetSceneItemEnabled", UUID.random.to_s, JSON.parse( { "sceneName" => @scenename, "sceneItemId" => @id, "sceneItemEnabled" => false }.to_json ) ) } ) + d = reschan.receive # block until response end def transform( newtransform : OBS::SceneItemTransform | Hash( String, String | Bool | Int64 | Float64 ) ) reqdata = ( Hash( String, String | Bool | Int64 | Float64 | Hash( String, String | Bool | Int64 | Float64 ) ) ).new |