scruby 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/.gitignore +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +53 -0
  5. data/README.rdoc +65 -0
  6. data/Rakefile +10 -0
  7. data/TODO.markdown +3 -0
  8. data/examples/example.rb +73 -0
  9. data/lib/scruby/buffer.rb +153 -0
  10. data/lib/scruby/bus.rb +67 -0
  11. data/lib/scruby/control_name.rb +29 -0
  12. data/lib/scruby/core_ext/array.rb +44 -0
  13. data/lib/scruby/core_ext/delegator_array.rb +44 -0
  14. data/lib/scruby/core_ext/fixnum.rb +8 -0
  15. data/lib/scruby/core_ext/numeric.rb +25 -0
  16. data/lib/scruby/core_ext/object.rb +23 -0
  17. data/lib/scruby/core_ext/proc.rb +11 -0
  18. data/lib/scruby/core_ext/string.rb +5 -0
  19. data/lib/scruby/core_ext/symbol.rb +5 -0
  20. data/lib/scruby/core_ext/typed_array.rb +54 -0
  21. data/lib/scruby/env.rb +93 -0
  22. data/lib/scruby/group.rb +24 -0
  23. data/lib/scruby/node.rb +102 -0
  24. data/lib/scruby/server.rb +182 -0
  25. data/lib/scruby/synth.rb +50 -0
  26. data/lib/scruby/synthdef.rb +109 -0
  27. data/lib/scruby/ticker.rb +92 -0
  28. data/lib/scruby/ugens/buffer_read_write.rb +98 -0
  29. data/lib/scruby/ugens/demand.rb +9 -0
  30. data/lib/scruby/ugens/disk_in_out.rb +33 -0
  31. data/lib/scruby/ugens/env_gen.rb +38 -0
  32. data/lib/scruby/ugens/in_out.rb +46 -0
  33. data/lib/scruby/ugens/multi_out.rb +53 -0
  34. data/lib/scruby/ugens/operation_indices.yaml +92 -0
  35. data/lib/scruby/ugens/operation_ugens.rb +63 -0
  36. data/lib/scruby/ugens/panner.rb +137 -0
  37. data/lib/scruby/ugens/ugen.rb +173 -0
  38. data/lib/scruby/ugens/ugen_defs.yaml +3123 -0
  39. data/lib/scruby/ugens/ugen_operations.rb +57 -0
  40. data/lib/scruby/ugens/ugens.rb +95 -0
  41. data/lib/scruby/version.rb +3 -0
  42. data/lib/scruby.rb +65 -0
  43. data/scruby.gemspec +27 -0
  44. data/spec/buffer_read_write_spec.rb +333 -0
  45. data/spec/buffer_spec.rb +199 -0
  46. data/spec/bus_spec.rb +184 -0
  47. data/spec/core_ext/core_ext_spec.rb +120 -0
  48. data/spec/core_ext/delegator_array_spec.rb +144 -0
  49. data/spec/core_ext/typed_array_spec.rb +95 -0
  50. data/spec/demand_spec.rb +81 -0
  51. data/spec/disk_in_out_spec.rb +138 -0
  52. data/spec/env_gen_spec.rb +23 -0
  53. data/spec/env_spec.rb +73 -0
  54. data/spec/group_spec.rb +71 -0
  55. data/spec/helper.rb +20 -0
  56. data/spec/in_out_spec.rb +127 -0
  57. data/spec/integration_spec.rb +88 -0
  58. data/spec/multiout_ugen_spec.rb +86 -0
  59. data/spec/node_spec.rb +112 -0
  60. data/spec/operation_ugens_spec.rb +196 -0
  61. data/spec/panner_spec.rb +271 -0
  62. data/spec/server.rb +12 -0
  63. data/spec/server_spec.rb +198 -0
  64. data/spec/synth_spec.rb +103 -0
  65. data/spec/synthdef_spec.rb +267 -0
  66. data/spec/ugen_operations_spec.rb +100 -0
  67. data/spec/ugen_spec.rb +356 -0
  68. data/spec/ugens_spec.rb +65 -0
  69. metadata +207 -0
@@ -0,0 +1,57 @@
1
+ module Scruby
2
+ module Ugens
3
+ # This module enables Ugen operations for Ugens, Numeric and Arrays, when any instance of this classes executes an operation with an Ugen a BinaryUgenOp
4
+ # is instantiated where both objects are the inputs of the operation, an UnaryUgenOp is instantiated for unary operations
5
+ # This are the permited operations:
6
+ #
7
+ # Binary:
8
+ # +, -, *, div, /, mod, <=, >=, minimum, maximum, lcm, gcd, round, roundUp, trunc, atan2, hypot, hypotApx, pow, leftShift, rightShift, unsignedRightShift, ring1, ring2, ring3, ring4, difsqr, sumsqr, sqrsum, sqrdif, absdif, thresh, amclip, scaleneg, clip2, excess, fold2, wrap2, rrand and exprand
9
+ #
10
+ # Unary:
11
+ # neg, bitNot, abs, asFloat, ceil, floor, frac, sign, squared, cubed, sqrt, exp, reciprocal, midicps, cpsmidi, midiratio, ratiomidi, dbamp, ampdb, octcps, cpsoct, log, log2, log10, sin, cos, tam, asin, acos, atan, sinh, cosh, tanh, rand, rand2, linrand, bilinrand, sum3rand, distort, softclip, coin, rectWindow, hanWindow, welWindow, triWindow, ramp and scurve
12
+ #
13
+ module UgenOperations
14
+ operation_indices = YAML::load File.open( File.dirname(__FILE__) + "/operation_indices.yaml" )
15
+ UNARY = operation_indices['unary']
16
+ BINARY = operation_indices['binary']
17
+ SAFE_NAMES = { :+ => :plus, :- => :minus, :* => :mult, :/ => :div2, :<= => :less_than_or_eql, :>= => :more_than_or_eql }
18
+
19
+ def self.included klass
20
+ # Define unary operations
21
+ UNARY.each_key do |op|
22
+ define_method(op){ UnaryOpUGen.new op, self } unless klass.instance_methods.include? op
23
+ end
24
+
25
+ # Define binary operations
26
+ ugen_subclass = klass.ancestors.include? Ugen
27
+ meth_def =
28
+ if ugen_subclass
29
+ proc do |safe, op|
30
+ proc{ |input| BinaryOpUGen.new op, self, input }
31
+ end
32
+ else
33
+ proc do |safe, op|
34
+ proc do |input|
35
+ if input.kind_of? Ugen
36
+ BinaryOpUGen.new op, self, input
37
+ else
38
+ __send__ "__original_#{ safe }", input
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ BINARY.each_key do |op|
45
+ safe = SAFE_NAMES[op]
46
+ define_method "__ugenop_#{ safe || op }", &meth_def.call(safe || op, op)
47
+ klass.send :alias_method, "__original_#{ safe || op }", op if safe unless ugen_subclass
48
+ klass.send :alias_method, op, "__ugenop_#{ safe || op }"
49
+ end
50
+ end
51
+ end
52
+
53
+ [Ugen, Fixnum, Float].each{ |k| k.send :include, UgenOperations }
54
+ end
55
+ end
56
+
57
+
@@ -0,0 +1,95 @@
1
+ module Scruby
2
+ module Ugens
3
+
4
+ #
5
+ # Default SuperCollider Ugens definitions are stored in the ugen_defs.yml file and are defined as Ruby classes on the fly, the yml format is:
6
+ #
7
+ # NewUgen:
8
+ # :control:
9
+ # - - :input
10
+ # -
11
+ # - - :freq
12
+ # - 440
13
+ # :audio:
14
+ # - - :input
15
+ # -
16
+ # - - :freq
17
+ # - 440
18
+ #
19
+ # To define a Ruby class corresponding to an Ugen +name+ should be passed and a hash of +rates+, inputs and default values, default values can be nil
20
+ #
21
+ # Ugens.define_ugen( 'NewUgen', {:control => [[:input, nil], [:freq, 440]], :audio => [[:input, nil], [:freq, 440]]} )
22
+ #
23
+ # The previous is equivalent as the following ruby code:
24
+ #
25
+ # class NewUgen < Ugen
26
+ # class << self
27
+ # def kr( input, freq = 440 )
28
+ # new :control, input, freq
29
+ # end
30
+ #
31
+ # def ar( input, freq = 440)
32
+ # new :audio, input, freq
33
+ # end
34
+ # # Makes possible passing args either in order or as argument hash
35
+ # named_arguments_for :ar, :kr
36
+ # end
37
+ # end
38
+ #
39
+ # In future versions Ugen definitions will be loaded from ~/Ugens or ~/.Ugens directories either as yml files or rb files
40
+ #
41
+ def self.define_ugen name, rates
42
+ rate_name = {:audio => :ar, :control => :kr, :scalar => :ir, :demand => :new}
43
+
44
+ methods = rates.collect do |rate, args|
45
+ if rate == :demand or rate == :scalar
46
+ <<-RUBY_EVAL
47
+ def new #{ args.collect{ |a, v| "#{ a } = #{ v.inspect }" }.join(', ') }
48
+ super #{ args.unshift([rate.inspect]).collect{ |a| a.first }.join(', ') }
49
+ end
50
+ RUBY_EVAL
51
+ else
52
+ args ||= []
53
+ args.push [:mul, 1], [:add, 0]
54
+ args.uniq!
55
+ assigns = []
56
+ args.each_with_index do |arg, index|
57
+ key, val = arg
58
+ assigns << %{
59
+ #{ key } = opts[:#{ key }] || args[#{ index }] || #{ val }
60
+ raise( ArgumentError.new("`#{ key }` value must be provided") ) unless #{ key }
61
+ }
62
+ end
63
+
64
+ new_args = [":#{ rate }"] + args[0...-2].collect{ |a| a.first }
65
+ <<-RUBY_EVAL
66
+ def #{ rate_name[rate] } *args
67
+ raise ArgumentError.new("wrong number of arguments (\#{ args } for #{ args.size })") if args.size > #{args.size}
68
+ opts = args.last.kind_of?( Hash ) ? args.pop : {}
69
+ #{ assigns.join("\n") }
70
+ new( #{ new_args.join(', ') } ).muladd( mul, add )
71
+ end
72
+
73
+ def params
74
+ @params
75
+ end
76
+ RUBY_EVAL
77
+ end
78
+ end.join("\n")
79
+
80
+ self.class_eval <<-RUBY_EVAL
81
+ class #{ name } < Ugen
82
+ @params = #{ rates.inspect }
83
+ class << self
84
+ #{ methods }
85
+ end
86
+ end
87
+ RUBY_EVAL
88
+ # # TODO: Load from ~/Ugens directory
89
+ end
90
+
91
+ YAML::load( File.open( File.dirname(__FILE__) + "/ugen_defs.yaml" ) ).each_pair do |key, value|
92
+ self.define_ugen key, value
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,3 @@
1
+ module Scruby
2
+ VERSION = "0.2.7"
3
+ end
data/lib/scruby.rb ADDED
@@ -0,0 +1,65 @@
1
+ #--
2
+ # Copyright (c) 2008 Macario Ortega
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ #++
17
+
18
+ require 'date'
19
+ require 'rubygems'
20
+ require 'arguments'
21
+ require 'ruby-osc'
22
+ require 'eventmachine'
23
+ require 'yaml'
24
+
25
+ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
26
+
27
+ require "scruby/version"
28
+
29
+ require "scruby/core_ext/object"
30
+ require "scruby/core_ext/array"
31
+ require "scruby/core_ext/fixnum"
32
+ require "scruby/core_ext/numeric"
33
+ require "scruby/core_ext/proc"
34
+ require "scruby/core_ext/string"
35
+ require "scruby/core_ext/symbol"
36
+ require "scruby/core_ext/typed_array"
37
+ require "scruby/core_ext/delegator_array"
38
+ require "scruby/env"
39
+ require "scruby/control_name"
40
+
41
+ require "scruby/ugens/ugen"
42
+ require "scruby/ugens/ugen_operations"
43
+ require "scruby/ugens/multi_out"
44
+ require "scruby/ugens/panner"
45
+ require "scruby/ugens/buffer_read_write"
46
+ require "scruby/ugens/disk_in_out"
47
+ require "scruby/ugens/in_out"
48
+
49
+ require "scruby/ugens/operation_ugens"
50
+
51
+ require "scruby/ugens/ugens"
52
+ require "scruby/synthdef"
53
+
54
+ require "scruby/server"
55
+ require "scruby/ugens/env_gen"
56
+
57
+ require "scruby/node"
58
+ require "scruby/synth"
59
+ require "scruby/bus"
60
+ require "scruby/buffer"
61
+
62
+ require "scruby/ticker"
63
+
64
+ include Scruby
65
+ include Ugens
data/scruby.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "scruby/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "scruby"
7
+ s.version = Scruby::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Macario Ortega"]
10
+ s.email = ["macarui@gmail.com"]
11
+ s.homepage = "http://github.com/maca/scruby"
12
+ s.summary = %q{SuperCollider client for Ruby}
13
+ s.description = %q{SuperCollider client for Ruby}
14
+
15
+ s.rubyforge_project = "scruby"
16
+
17
+ s.add_development_dependency 'rspec'
18
+ s.add_development_dependency 'bundler'
19
+ s.add_dependency 'ruby-osc', '~> 0.3'
20
+ s.add_dependency 'arguments', '~> 0.6'
21
+ s.add_dependency 'live', '~> 0.1'
22
+
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
+ s.require_paths = ["lib"]
27
+ end
@@ -0,0 +1,333 @@
1
+ require File.expand_path(File.dirname(__FILE__)) + "/helper"
2
+
3
+ require "scruby/core_ext/delegator_array"
4
+ require "scruby/control_name"
5
+ require "scruby/env"
6
+ require "scruby/ugens/ugen"
7
+ require "scruby/ugens/ugen_operations"
8
+ require "scruby/ugens/operation_ugens"
9
+ require "scruby/ugens/multi_out"
10
+ require "scruby/ugens/ugens"
11
+ require "scruby/ugens/buffer_read_write"
12
+
13
+ include Scruby
14
+ include Ugens
15
+
16
+ class MockUgen < Ugen
17
+ class << self; public :new; end
18
+ end
19
+
20
+
21
+ describe 'Buffer Read Ugens' do
22
+ shared_examples_for 'Buffer reader Ugen' do
23
+ before do
24
+ @proxies = @class.send @method, *@params
25
+ @inputs ||= @params
26
+ @instance = @proxies.first.source
27
+ end
28
+
29
+ it "should output a DelegatorArray" do
30
+ @proxies.should be_a(DelegatorArray)
31
+ end
32
+
33
+ it "should have correct rate" do
34
+ @instance.rate.should == @rate
35
+ end
36
+
37
+ it "should return an array of output proxies" do
38
+ @proxies.should be_a(Array)
39
+ @proxies.should have(@channels).proxies
40
+ @proxies.each_with_index do |proxy, i|
41
+ proxy.source.should be_a(@class)
42
+ proxy.should be_a(OutputProxy)
43
+ proxy.output_index.should == i
44
+ end
45
+ end
46
+
47
+ it "should set inputs" do
48
+ @instance.inputs.should == @inputs
49
+ end
50
+ end
51
+
52
+ shared_examples_for 'Buffer reader Ugen with control rate' do
53
+ before do
54
+ @method = :kr
55
+ @rate = :control
56
+ end
57
+ it_should_behave_like 'Buffer reader Ugen'
58
+ end
59
+
60
+ shared_examples_for 'Buffer reader Ugen with audio rate' do
61
+ before do
62
+ @method = :ar
63
+ @rate = :audio
64
+ end
65
+ it_should_behave_like 'Buffer reader Ugen'
66
+
67
+ it "should just accept audio inputs if rate is audio" # do
68
+ # lambda { @class.new( :audio, MockUgen.new(:control) ) }.should raise_error(ArgumentError)
69
+ # end
70
+ end
71
+
72
+ describe PlayBuf, 'Two channel' do
73
+ before do
74
+ @class = PlayBuf
75
+ @channels = 2
76
+ @inputs = 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
77
+ @params = @channels, *@inputs
78
+ end
79
+
80
+ it_should_behave_like 'Buffer reader Ugen with control rate'
81
+ it_should_behave_like 'Buffer reader Ugen with audio rate'
82
+ end
83
+
84
+ describe PlayBuf, 'Four channel' do
85
+ before do
86
+ @class = PlayBuf
87
+ @channels = 4
88
+ @inputs = 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
89
+ @params = @channels, *@inputs
90
+ end
91
+
92
+ it_should_behave_like 'Buffer reader Ugen with control rate'
93
+ it_should_behave_like 'Buffer reader Ugen with audio rate'
94
+ end
95
+
96
+ describe TGrains, 'Two Channel' do
97
+ before do
98
+ @class = TGrains
99
+ @channels = 2
100
+ @inputs = 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
101
+ @params = @channels, *@inputs
102
+ end
103
+
104
+ it_should_behave_like 'Buffer reader Ugen with audio rate'
105
+
106
+ it "should require at least two channels" do
107
+ lambda { @class.ar 1, *@params[1..-1] }.should raise_error(ArgumentError)
108
+ end
109
+ end
110
+
111
+ describe TGrains, 'Four Channel' do
112
+ before do
113
+ @class = TGrains
114
+ @channels = 4
115
+ @inputs = 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
116
+ @params = @channels, *@inputs
117
+ end
118
+
119
+ it_should_behave_like 'Buffer reader Ugen with audio rate'
120
+
121
+ it "should require at least two channels" do
122
+ lambda { @class.ar 1, *@params[1..-1] }.should raise_error(ArgumentError)
123
+ end
124
+ end
125
+
126
+ describe BufRd, 'Two channel' do
127
+ before do
128
+ @class = BufRd
129
+ @channels = 2
130
+ @inputs = 1.0, 1.0, 1.0, 1.0
131
+ @params = @channels, *@inputs
132
+ end
133
+
134
+ it_should_behave_like 'Buffer reader Ugen with control rate'
135
+ it_should_behave_like 'Buffer reader Ugen with audio rate'
136
+
137
+ it "should require audio rate for phase"
138
+ end
139
+
140
+ describe BufRd, 'Four channel' do
141
+ before do
142
+ @class = BufRd
143
+ @channels = 4
144
+ @inputs = 1.0, 1.0, 1.0, 1.0
145
+ @params = @channels, *@inputs
146
+ end
147
+
148
+ it_should_behave_like 'Buffer reader Ugen with control rate'
149
+ it_should_behave_like 'Buffer reader Ugen with audio rate'
150
+ end
151
+
152
+ end
153
+
154
+ describe 'Buffer write Ugens' do
155
+ shared_examples_for 'Buffer writter Ugen' do
156
+ before do
157
+ @buff_ugen = @class.send @method, *@params
158
+ end
159
+
160
+ it "should have correct rate" do
161
+ @buff_ugen.rate.should == @rate
162
+ end
163
+
164
+ it "should set inputs" do
165
+ @buff_ugen.inputs.should == @inputs
166
+ end
167
+ end
168
+
169
+ shared_examples_for 'Buffer writter Ugen with control rate' do
170
+ before do
171
+ @rate = :control
172
+ @method = :kr
173
+ end
174
+ it_should_behave_like 'Buffer writter Ugen'
175
+ end
176
+
177
+ shared_examples_for 'Buffer writter Ugen with audio rate' do
178
+ before do
179
+ @rate = :audio
180
+ @method = :ar
181
+ end
182
+ it_should_behave_like 'Buffer writter Ugen'
183
+ end
184
+
185
+ describe BufWr, 'array input' do
186
+ before do
187
+ @class = BufWr
188
+ @array = [MockUgen.new(:audio, 1, 2)]*4
189
+ @inputs = 1, 2, 3, *@array
190
+ @params = @array, 1, 2, 3
191
+ end
192
+ it_should_behave_like 'Buffer writter Ugen with audio rate'
193
+ it_should_behave_like 'Buffer writter Ugen with control rate'
194
+
195
+ it "should require phase to be audio rate"
196
+ end
197
+
198
+ describe BufWr, 'single input' do
199
+ before do
200
+ @class = BufWr
201
+ @array = MockUgen.new(:audio, 1, 2)
202
+ @inputs = 1, 2, 3, @array
203
+ @params = @array, 1, 2, 3
204
+ end
205
+ it_should_behave_like 'Buffer writter Ugen with audio rate'
206
+ it_should_behave_like 'Buffer writter Ugen with control rate'
207
+
208
+ it "should require phase to be audio rate"
209
+ end
210
+
211
+ describe RecordBuf, 'array input' do
212
+ before do
213
+ @class = RecordBuf
214
+ @array = [MockUgen.new(:audio, 1, 2)]*4
215
+ @inputs = 1, 2, 3, 4, 5, 6, 7, 8, *@array
216
+ @params = @array, 1, 2, 3, 4, 5, 6, 7, 8
217
+ end
218
+ it_should_behave_like 'Buffer writter Ugen with audio rate'
219
+ it_should_behave_like 'Buffer writter Ugen with control rate'
220
+
221
+ it "should require phase to be audio rate"
222
+ end
223
+
224
+ describe RecordBuf, 'single input' do
225
+ before do
226
+ @class = RecordBuf
227
+ @array = MockUgen.new(:audio, 1, 2)
228
+ @inputs = 1, 2, 3, 4, 5, 6, 7, 8, @array
229
+ @params = @array, 1, 2, 3, 4, 5, 6, 7, 8
230
+ end
231
+ it_should_behave_like 'Buffer writter Ugen with audio rate'
232
+ it_should_behave_like 'Buffer writter Ugen with control rate'
233
+
234
+ it "should require phase to be audio rate"
235
+ end
236
+
237
+ describe ScopeOut, 'array input' do
238
+ before do
239
+ @class = ScopeOut
240
+ @array = [MockUgen.new(:audio, 1, 2)]*4
241
+ @inputs = 1, *@array
242
+ @params = @array, 1
243
+ end
244
+ it_should_behave_like 'Buffer writter Ugen with audio rate'
245
+ it_should_behave_like 'Buffer writter Ugen with control rate'
246
+
247
+ it "should require phase to be audio rate"
248
+ end
249
+
250
+ describe ScopeOut, 'single input' do
251
+ before do
252
+ @class = ScopeOut
253
+ @array = MockUgen.new(:audio, 1, 2)
254
+ @inputs = 1, @array
255
+ @params = @array, 1
256
+ end
257
+ it_should_behave_like 'Buffer writter Ugen with audio rate'
258
+ it_should_behave_like 'Buffer writter Ugen with control rate'
259
+
260
+ it "should require phase to be audio rate"
261
+ end
262
+
263
+ describe Tap, 'single input' do
264
+ before do
265
+ @inputs = 5, 1, 0, SampleRate.ir.neg * 3, 1, 0
266
+ @buff_ugen = Tap.ar( 5, 2, 3 ).first.source
267
+ end
268
+
269
+ it "should be instance of PlayBuf" do
270
+ @buff_ugen.should be_a(PlayBuf)
271
+ end
272
+
273
+ it "should have correct rate" do
274
+ @buff_ugen.rate.should == :audio
275
+ end
276
+
277
+ it "should set inputs" do
278
+ @buff_ugen.inputs.should == @inputs
279
+ end
280
+ end
281
+
282
+ describe Tap, 'single input' do
283
+ before do
284
+ @inputs = 5, 1, 0, SampleRate.ir.neg * 3, 1, 0
285
+ @channels = 1
286
+ @proxies = Tap.ar( 5, @channels, 3 )
287
+ end
288
+
289
+ it "should have one proxy" do
290
+ @proxies.should have(@channels).proxy
291
+ end
292
+
293
+ it "should be instance of PlayBuf" do
294
+ @proxies.each{ |p| p.source.should be_a(PlayBuf) }
295
+ end
296
+
297
+ it "should have correct rate" do
298
+ @proxies.each{ |p| p.source.rate.should == :audio }
299
+ end
300
+
301
+ it "should set inputs" do
302
+ @proxies.each{ |p| p.source.inputs == @inputs }
303
+ end
304
+ end
305
+
306
+ describe Tap, 'multi input' do
307
+ before do
308
+ @inputs = 5, 1, 0, SampleRate.ir.neg * 3, 1, 0
309
+ @channels = 4
310
+ @proxies = Tap.ar( 5, @channels, 3 )
311
+ end
312
+
313
+ it "should have one proxy" do
314
+ @proxies.should have(@channels).proxy
315
+ end
316
+
317
+ it "should be instance of PlayBuf" do
318
+ @proxies.each{ |p| p.source.should be_a(PlayBuf) }
319
+ end
320
+
321
+ it "should have correct rate" do
322
+ @proxies.each{ |p| p.source.rate.should == :audio }
323
+ end
324
+
325
+ it "should set inputs" do
326
+ @proxies.each{ |p| p.source.inputs == @inputs }
327
+ end
328
+ end
329
+
330
+ #LocalBuf
331
+ #MaxLocalBufs
332
+ #ClearBuf
333
+ end