Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ugen with multichannel inputs returns a DelegatorArray @SHDH mx

  • Loading branch information...
commit 48242a9c29fb0c078c70e5824e6d83c40fbcce1b 1 parent af0fe0c
@maca authored
View
1  lib/scruby.rb
@@ -38,6 +38,7 @@ module Scruby
require "scruby/core_ext/string"
require "scruby/core_ext/symbol"
require "scruby/core_ext/typed_array"
+require "scruby/core_ext/delegator_array"
require "scruby/audio/ugens/ugen"
require "scruby/audio/ugens/ugen_operations"
View
3  lib/scruby/audio/ugens/ugen.rb
@@ -120,7 +120,7 @@ def new rate, *inputs
return instantiate( rate, *inputs ) unless size > 1 #return an Ugen if no array was passed as an input
inputs = inputs.map{ |input| input.instance_of?( Array ) ? input.wrap_to( size ) : Array.new( size, input ) }.transpose
- inputs.map{ |new_inputs| new rate, *new_inputs }
+ DelegatorArray.new inputs.map{ |new_inputs| new rate, *new_inputs }
end
@@ -142,7 +142,6 @@ def params
{}
end
- private
def instantiate *args
obj = allocate
obj.__send__ :initialize, *args
View
6 spec/audio/ugen_spec.rb
@@ -10,6 +10,8 @@
require "scruby/core_ext/string"
require "scruby/core_ext/fixnum"
require "scruby/core_ext/array"
+require "scruby/core_ext/delegator_array"
+
include Scruby
include Audio
@@ -208,7 +210,7 @@ def as_ugen_input; 0; end
end
it "should return an array of Ugens if an array as one arg is passed on instantiation" do
- Ugen.new( :audio, 1, [2, 3] ).should be_instance_of(Array)
+ Ugen.new( :audio, 1, [2, 3] ).should be_instance_of(DelegatorArray)
end
it do
@@ -252,7 +254,7 @@ def as_ugen_input; 0; end
ugens.should have(4).ugens
end
- it "should return an array of ugens with correct inputs" do
+ it "should return an delegator array of ugens with correct inputs" do
ugens = Ugen.new( :audio, 100, [210, 220, 230, 240] )
ugens.zip( [@i_1, @i_2, @i_3, @i_4] ).each do |e|
e.first.inputs.should eql( e.last )
Please sign in to comment.
Something went wrong with that request. Please try again.