Class: Musicality::SuperCollider::Performer

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

Constant Summary collapse

MASTER_AUDIO_BUS =
0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(part) ⇒ Performer

Returns a new instance of Performer.



8
9
10
11
12
13
14
15
16
# File 'lib/musicality/performance/supercollider/performer.rb', line 8

def initialize part
  @settings = part.synthdef_settings || SynthDefs::DEFAULT.settings
  @part = part
  unless @settings.synthdef.params.has_key?(:out)
    raise ArgumentError "SynthDef #{@settings.synthdef} does not have :out param" 
  end
  @takes_freq = @settings.synthdef.params.has_key? :freq
  @takes_gate = @settings.synthdef.params.has_key? :gate
end

Instance Attribute Details

#partObject (readonly)

Returns the value of attribute part.



7
8
9
# File 'lib/musicality/performance/supercollider/performer.rb', line 7

def part
  @part
end

#settingsObject (readonly)

Returns the value of attribute settings.



7
8
9
# File 'lib/musicality/performance/supercollider/performer.rb', line 7

def settings
  @settings
end

Instance Method Details

#bundles(parent_group: nil, aux_audio_bus: 16, volume_control_bus: 0, lead_time: 0.1) ⇒ Object

Raises:

  • (ArgumentError)


18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/musicality/performance/supercollider/performer.rb', line 18

def bundles parent_group: nil, aux_audio_bus: 16, volume_control_bus: 0, lead_time: 0.1
  raise ArgumentError, "Lead time #{lead_time} is not positive" unless lead_time > 0.0
  bundles = []
  
  group = create_part_group parent_group, bundles
  set_start_volume volume_control_bus, bundles
  add_volume_control group, aux_audio_bus, volume_control_bus, lead_time, bundles
  add_volume_changes group, volume_control_bus, lead_time, bundles
  add_part_notes group, aux_audio_bus, lead_time, bundles

  bundles
end