Skip to content

Instantly share code, notes, and snippets.

@natebunnyfield
Created May 14, 2011 00:40
Show Gist options
  • Save natebunnyfield/971550 to your computer and use it in GitHub Desktop.
Save natebunnyfield/971550 to your computer and use it in GitHub Desktop.
A ruby replacement for the troublesome max patch found at http://www.maxbreakwell.com/max-msp-jitter/touchosc-and-ardour/
require 'osc-ruby'
@touchosc = OSC::Server.new(3818)
@ardour = OSC::Client.new('localhost', 3819)
@touchosc.add_method(/\/ardour/) do |m|
puts "#{m.address} #{m.to_a}"
if m.address == '/ardour/transport_play' and m.to_a == [0.0]
@ardour.send(OSC::Message.new('/ardour/transport_stop'))
elsif m.address == '/ardour/set_transport_speed'
@ardour.send(OSC::Message.new(m.address, m.to_a[0]*16-8))
elsif m.address == '/ardour/routes/gainabs'
@ardour.send(OSC::Message.new(m.address, m.to_a[0]))
elsif m.address =~ /\/ardour.\//
if m.address =~ /(toggle_punch|toggle_all_rec_enables)/
@ardour.send(OSC::Message.new("/ardour/#{m.address.split("/")[2]}"))
else
@ardour.send(OSC::Message.new('/ardour/access_action', "Editor/#{m.address.split("/")[2]}"))
end
elsif m.to_a == [1.0] or
m.address == '/ardour/loop_toggle' or
m.address == '/ardour/rec_enable_toggle'
@ardour.send(OSC::Message.new(m.address))
end
end
@touchosc.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment