Class: Musicality::SuperCollider::Synth

Inherits:
Node
  • Object
show all
Defined in:
lib/musicality/performance/supercollider/synth.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#after, #before, #bundle_queue, #fill, #free, next_id, reset_id_counter, #send_msg, #set, #setn, #start, #stop, #trace

Constructor Details

#initialize(server, group, synthdef_name, add_action, target_id, args) ⇒ Synth

Returns a new instance of Synth.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/musicality/performance/supercollider/synth.rb', line 8

def initialize server, group, synthdef_name, add_action, target_id, args
  raise ArgumentError unless ADD_ACTIONS.include?(add_action)
  super server, group
  send_msg(Message.new('/s_new', synthdef_name, id, 
    add_action, target_id, *args.to_a.flatten))
end

Instance Attribute Details

#freedObject (readonly)

Returns the value of attribute freed.



5
6
7
# File 'lib/musicality/performance/supercollider/synth.rb', line 5

def freed
  @freed
end

#groupObject (readonly)

Returns the value of attribute group.



5
6
7
# File 'lib/musicality/performance/supercollider/synth.rb', line 5

def group
  @group
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/musicality/performance/supercollider/synth.rb', line 5

def id
  @id
end

#runningObject (readonly)

Returns the value of attribute running.



5
6
7
# File 'lib/musicality/performance/supercollider/synth.rb', line 5

def running
  @running
end

#serverObject (readonly)

Returns the value of attribute server.



5
6
7
# File 'lib/musicality/performance/supercollider/synth.rb', line 5

def server
  @server
end

Class Method Details

.after(target, synthdef_name, args = {}) ⇒ Object

Raises:

  • (ArgumentError)


15
16
17
18
# File 'lib/musicality/performance/supercollider/synth.rb', line 15

def self.after target, synthdef_name, args = {}
  raise ArgumentError unless target.is_a?(Node)
  new target.server, target.group, synthdef_name, ADD_AFTER, target.id, args
end

.before(target, synthdef_name, args = {}) ⇒ Object

Raises:

  • (ArgumentError)


20
21
22
23
# File 'lib/musicality/performance/supercollider/synth.rb', line 20

def self.before target, synthdef_name, args = {}
  raise ArgumentError unless target.is_a?(Node)
  new target.server, target.group, synthdef_name, ADD_BEFORE, target.id, args
end

.head(target, synthdef_name, args = {}) ⇒ Object

Raises:

  • (ArgumentError)


25
26
27
28
# File 'lib/musicality/performance/supercollider/synth.rb', line 25

def self.head target, synthdef_name, args = {}
  raise ArgumentError unless target.is_a?(Group)
  new target.server, target, synthdef_name, ADD_HEAD, target.id, args
end

.replace(target, synthdef_name, args = {}) ⇒ Object

Raises:

  • (ArgumentError)


35
36
37
38
# File 'lib/musicality/performance/supercollider/synth.rb', line 35

def self.replace target, synthdef_name, args = {}
  raise ArgumentError unless target.is_a?(Node)
  new target.server, target.group, synthdef_name, ADD_REPLACE, target.id, args
end

.tail(target, synthdef_name, args = {}) ⇒ Object

Raises:

  • (ArgumentError)


30
31
32
33
# File 'lib/musicality/performance/supercollider/synth.rb', line 30

def self.tail target, synthdef_name, args = {}
  raise ArgumentError unless target.is_a?(Group)
  new target.server, target, synthdef_name, ADD_TAIL, target.id, args
end