Permalink
Browse files

scalar Ugens can now be instantiated with new

  • Loading branch information...
1 parent e82decb commit 102e991c027b6932c947015d3e8ad03e20e6116a Macario committed Sep 1, 2009
Showing with 6 additions and 4 deletions.
  1. +2 −4 lib/scruby/ugens/ugens.rb
  2. +4 −0 spec/ugens_spec.rb
@@ -42,10 +42,10 @@ def self.define_ugen name, rates
rate_name = {:audio => :ar, :control => :kr, :scalar => :ir, :demand => :new}
methods = rates.collect do |rate, args|
- if rate == :demand
+ if rate == :demand or rate == :scalar
<<-RUBY_EVAL
def new #{ args.collect{ |a, v| "#{ a } = #{ v.inspect }" }.join(', ') }
- super :demand, #{ args.collect{ |a| a.first }.join(', ') }
+ super #{ args.unshift([rate.inspect]).collect{ |a| a.first }.join(', ') }
end
RUBY_EVAL
else
@@ -88,8 +88,6 @@ class << self
# # TODO: Load from ~/Ugens directory
end
-
-
YAML::load( File.open( File.dirname(__FILE__) + "/ugen_defs.yaml" ) ).each_pair do |key, value|
self.define_ugen key, value
end
View
@@ -55,6 +55,10 @@ class Klass
Dbrown.new(1,2,3,4).inputs.should == [1,2,3,4]
end
+ it "should have public new method for scalar" do
+ ExpRand.new(1,2)
+ end
+
it "should output params"
end

0 comments on commit 102e991

Please sign in to comment.