RubyCocoaでQuartzComposer プラグインをつくれるようになった ので、さっそくつくってみました。 みんな大好きGainer の入力を QuartzComposer からとれるようにしました。
              ソースコード
              github:qc_gainer に。MITライセンスです。 , osc を使っています。
              短かいので、コードをはっておきます。ごさんこうに。
              
              
#
              qc_gainer.rb
              
#
              Created by mootoh on 6/6/08.
              
              Copyright (c) 2008 deadbeaf.org. All rights reserved.
              
#
require 'osx/cocoa'
OSX.require_framework 'QuartzComposer'
require 'funnel'
class QCGainer < OSX::QCPlugIn
  def self.executionMode
    2
  end
def self.timeMode
    1
  end
def initialize
     = false
     = Funnel::Gainer.new(Funnel::Gainer::MODE1)
               = [0,0,0,0]
 = [0,0,0,0]
 = [0,0,0,0]
 = [0,0,0,0]
              
end
def startExecution(context)
    Thread.new do
      sleep 0.1
      4.times { |i| addInputPortWithType_forKey_withAttributes(OSX::QCPortTypeNumber, "aot_" + i.to_s, nil)  }
      4.times { |i| addInputPortWithType_forKey_withAttributes(OSX::QCPortTypeNumber, "dot_" + i.to_s, nil)  }
      4.times { |i| addOutputPortWithType_forKey_withAttributes(OSX::QCPortTypeNumber, "ain_" + i.to_s, nil) }
      4.times { |i| addOutputPortWithType_forKey_withAttributes(OSX::QCPortTypeNumber, "din_" + i.to_s, nil) }
    end
    true
  end
def execute_atTime_withArguments(context, time, args)
    unless 
      4.times do |i|
        (i).on Funnel::PortEvent::CHANGE do |event|
          [i] = event.target.value
        end
        (i).on Funnel::PortEvent::CHANGE do |event|
          [i] = event.target.value
        end
      end
       = false
    end
              4.times do |i|
  setValue_forOutputKey([i], "ain_" + i.to_s)
  setValue_forOutputKey([i], "din_" + i.to_s)
end
true
              
end
def stopExecution(context)
    true
  end
end
              
              使い方
              
                - Gainer I/O をMacとつなげる
 
                - Funnelサーバを起動
 
                - Quartz Composerを起動
 
                - Pluginを配置
 
              
              デモ
              ビデオに撮るのがめんどうなので、Ruby会議 に持っていきます。
              まとめ
              こんなふうに、ありものをくっつけてささっと何かをつくるというとき、glue言語としてRubyはグッドですね。
              Happy Physical Hacking !