Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

synthdef fixed, next to fix: synth_spec

  • Loading branch information...
commit 25bcea6a6110ce1c90bf2b5f3cad2c69e23992de 1 parent 5481170
Macario Ortega authored
Showing with 9 additions and 9 deletions.
  1. +5 −5 lib/scruby/audio/synthdef.rb
  2. +4 −4 spec/audio/synthdef_spec.rb
10 lib/scruby/audio/synthdef.rb
View
@@ -50,11 +50,11 @@ def initialize name, options = {}, &block
# but the results will be interpreted in the same way
def encode
controls = @control_names.reject { |cn| cn.non_control? }
- encoded_controls = [controls.size].pack('n') + controls.collect{ |c| c.name.encode + [c.index].pack('n') }.to_s
+ encoded_controls = [controls.size].pack('n') + controls.collect{ |c| c.name.encode + [c.index].pack('n') }.join
init_stream + name.encode + constants.encode_floats + values.flatten.encode_floats + encoded_controls +
- [children.size].pack('n') + children.collect{ |u| u.encode }.join('') +
- [@variants.size].pack('n') #stub!!!
+ [children.size].pack('n') + children.collect{ |u| u.encode }.join('') +
+ [@variants.size].pack('n') #stub!!!
end
def init_stream file_version = 1, number_of_synths = 1 #:nodoc:
@@ -80,8 +80,8 @@ def values #:nodoc:
# # this synthdef is sent to both s and r
#
def send *servers
- servers = *servers
- (servers ? servers.to_array : Server.all).each{ |s| s.send_synth_def( self ) }
+ servers = servers.first if servers.first.kind_of? Array if servers.size == 1
+ (servers.empty? ? Server.all : servers.to_array ).each{ |s| s.send_synth_def( self ) }
self
end
8 spec/audio/synthdef_spec.rb
View
@@ -236,8 +236,8 @@ def self.ar( freq=440.0, phase=0.0 ) #not interested in muladd
describe "sending" do
before :all do
- @server = mock('server', :instance_of? => true, :send_synth_def => nil)
- ::Server = mock('Server', :all => [@server])
+ @server = mock('server', :instance_of? => true, :send_synth_def => nil)
+ ::Server = mock('Server', :all => [@server])
end
before do
@@ -246,8 +246,8 @@ def self.ar( freq=440.0, phase=0.0 ) #not interested in muladd
end
it "should accept an array or several Servers" do
- @sdef.send( @servers )
- @sdef.send( *@servers )
+ @sdef.send @servers
+ @sdef.send *@servers
end
it "should not accept non servers" do
Please sign in to comment.
Something went wrong with that request. Please try again.