Sha256: 8102b0d461a629ced966b4ae24d2bdf8a011e592c84842cd94c187777a66353c
Contents?: true
Size: 1.29 KB
Versions: 9
Compression:
Stored size: 1.29 KB
Contents
require 'qcmd' require 'rubygems' require 'json' # try it out qlab = OSC::TCPClient.new 'localhost', 53000 def receive(rcv) if rcv rcv.each do |osc_message| begin response = JSON.parse(osc_message.to_a.first) address = response['address'] data = response['data'] status = response['status'] puts address if status puts "status -> #{ status }" end if data puts JSON.pretty_generate(data) end rescue => ex puts "parsing response failed: #{ ex.message }" end end else puts 'no response...' end end msg = OSC::Message.new '/workspaces' qlab.send(msg) do |response| receive(response) end # don't always expect a reply msg = OSC::Message.new '/alwaysReply', 0 qlab.send(msg) do |response| receive(response) end # non-responsive command msg = OSC::Message.new '/workspace/65E9D86D-87DD-4CB1-A659-6584BAE57AB2/go' qlab.send(msg) do |response| receive(response) end # always expect a reply msg = OSC::Message.new '/alwaysReply', 1 qlab.send(msg) do |response| receive(response) end # non-responsive command is now a responsive command msg = OSC::Message.new '/workspace/65E9D86D-87DD-4CB1-A659-6584BAE57AB2/go' qlab.send(msg) do |response| receive(response) end
Version data entries
9 entries across 9 versions & 1 rubygems