Skip to content

maca/ruby-osc

Repository files navigation

ruby-osc

github.com/maca/ruby-osc

Concise OSC implementation for Ruby

* 1.9.1 and jRuby compatible
* Complies with OSC 1.0 specification
* Uses EventMachine for networking and lightweight soft-real-time bundle scheduling

SYNOPSIS:

require 'rubygems'
require 'ruby-osc'

include OSC

OSC.run do
  server = Server.new 9090
  client = Client.new 9090

  server.add_pattern /.*/ do |*args|       # this will match any address
    p "/.*/:       #{ args.join(', ') }"
  end

  server.add_pattern %r{foo/.*} do |*args| # this will match any /foo node
    p "%r{foo/.*}: #{ args.join(', ') }"
  end

  server.add_pattern "/foo/bar" do |*args| # this will just match /foo/bar address
    p "'/foo/bar': #{ args.join(', ') }"
  end

  server.add_pattern "/exit" do |*args|    # this will just match /exit address
    exit
  end

  client.send Message.new('/foo/bar', 1, 1.2, 'a string')
  client.send Message.new('/foo/bar/zar', 1, 1.2, 'a string')
  client.send Bundle.new(Time.now + 2, Message.new('/exit'))
end

REQUIREMENTS:

eventmachine

INSTALL:

[sudo] gem install ruby-osc

TODO:

  • OSC 1.1 compatibility mode

  • Full documentation

LICENSE:

(The MIT License)

Copyright © 2009 Macario Ortega

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Concise OSC Ruby implementation

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages