Class: Scruby::Synth

Inherits:
Node show all
Defined in:
lib/scruby/synth.rb

Constant Summary

Constant Summary

Constants inherited from Node

Node::ACTIONS

Instance Attribute Summary (collapse)

Attributes inherited from Node

#group, #id, #servers

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Node

#free, #map, #move_after, #move_before, #playing?, reset!, #run, #send, #send_bundle, #set, #trace

Constructor Details

- (Synth) initialize(name, servers)



5
6
7
8
# File 'lib/scruby/synth.rb', line 5

def initialize name, servers
  super servers
  @name = name.to_s
end

Instance Attribute Details

- (Object) name (readonly)

Returns the value of attribute name



3
4
5
# File 'lib/scruby/synth.rb', line 3

def name
  @name
end

Class Method Details

+ (Object) after(target, name, args = {})



28
29
30
# File 'lib/scruby/synth.rb', line 28

def after target, name, args = {}
  new name, args, target, :after
end

+ (Object) before(target, name, args = {})



32
33
34
# File 'lib/scruby/synth.rb', line 32

def before target, name, args = {}
  new name, args, target, :before
end

+ (Object) head(target, name, args = {})



36
37
38
# File 'lib/scruby/synth.rb', line 36

def head target, name, args = {}
  new name, args, target, :head
end

+ (Object) new(name, args = {}, target = nil, action = :head)



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/scruby/synth.rb', line 11

def new name, args = {}, target = nil, action = :head
  case target
  when nil
    target_id, servers = 1, nil
  when Group
    target_id, servers = group.id, target.servers
  when Node
    target_id, servers = 1, target.servers
  else
    raise TypeError.new("expected #{ target } to kind of Node or nil")
  end

  synth = super name, servers
  synth.send '/s_new', synth.name, synth.id, Node::ACTIONS.index(action), target_id, args
  synth
end

+ (Object) replace(target, name, args = {})



44
45
46
# File 'lib/scruby/synth.rb', line 44

def replace target, name, args = {}
  new name, args, target, :replace
end

+ (Object) tail(target, name, args = {})



40
41
42
# File 'lib/scruby/synth.rb', line 40

def tail target, name, args = {}
  new name, args, target, :tail
end