Class: Deftones::Component::Channel

Inherits:
Deftones::Core::AudioNode show all
Defined in:
lib/deftones/component/channel.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Attributes inherited from Deftones::Core::AudioNode

#context

Instance Method Summary collapse

Methods inherited from Deftones::Core::AudioNode

#>>, #attach_destination, #attach_source, #block_time, #chain, #channel_count, #channel_count_mode, #channel_interpretation, #connect, #connected?, #default_input_channels, #default_output_channels, #destination_for_connection, #detach_all_destinations, #detach_destination, #detach_source, #disconnect, #disposed?, #fan, #get, #immediate, #input_for_index, #inputs, #mix_source_blocks, #multichannel_process?, #name, #normalize_connection_index, #normalize_output_block, #now, #number_of_inputs, #number_of_outputs, #output_for_connection, #output_for_index, #outputs, #process, #raise_connection_index_error!, #reaches_node?, #sample_time, #set, #to_destination, #to_frequency, #to_master, #to_midi, #to_output, #to_s, #to_seconds, #to_ticks, #uses_legacy_render_for_block?, #validate_connectable!, #validate_connection_index!

Constructor Details

#initialize(pan: 0.0, volume: 0.0, solo: false, muted: false, mute: nil, context: Deftones.context) ⇒ Channel

Returns a new instance of Channel.



14
15
16
17
18
19
20
21
22
23
# File 'lib/deftones/component/channel.rb', line 14

def initialize(pan: 0.0, volume: 0.0, solo: false, muted: false, mute: nil, context: Deftones.context)
  super(context: context)
  muted = mute unless mute.nil?
  @pan_vol = PanVol.new(pan: pan, volume: volume, context: context)
  @solo = Solo.new(solo: solo, muted: muted, context: context)
  @input = @pan_vol.input
  @output = @solo
  @sends = []
  @pan_vol.output >> @solo
end

Class Attribute Details

.busesObject (readonly)

Returns the value of attribute buses.



9
10
11
# File 'lib/deftones/component/channel.rb', line 9

def buses
  @buses
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



12
13
14
# File 'lib/deftones/component/channel.rb', line 12

def input
  @input
end

#outputObject (readonly)

Returns the value of attribute output.



12
13
14
# File 'lib/deftones/component/channel.rb', line 12

def output
  @output
end

#pan_volObject (readonly) Also known as: panVol

Returns the value of attribute pan_vol.



12
13
14
# File 'lib/deftones/component/channel.rb', line 12

def pan_vol
  @pan_vol
end

Instance Method Details

#bus(name) ⇒ Object (private)



103
104
105
106
# File 'lib/deftones/component/channel.rb', line 103

def bus(name)
  registry = self.class.buses[context.object_id]
  registry[name.to_sym] ||= Core::Gain.new(gain: 1.0, context: context)
end

#disposeObject



89
90
91
92
93
94
95
# File 'lib/deftones/component/channel.rb', line 89

def dispose
  @sends.each(&:dispose)
  @sends.clear
  @pan_vol.dispose
  @solo.dispose
  super
end

#muteObject



49
50
51
# File 'lib/deftones/component/channel.rb', line 49

def mute
  @solo.mute
end

#mute=(value) ⇒ Object



53
54
55
# File 'lib/deftones/component/channel.rb', line 53

def mute=(value)
  @solo.mute = value
end

#mute?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/deftones/component/channel.rb', line 57

def mute?
  @solo.mute?
end

#mutedObject Also known as: muted?



61
62
63
# File 'lib/deftones/component/channel.rb', line 61

def muted
  mute
end

#muted=(value) ⇒ Object



65
66
67
# File 'lib/deftones/component/channel.rb', line 65

def muted=(value)
  self.mute = value
end

#panObject



33
34
35
# File 'lib/deftones/component/channel.rb', line 33

def pan
  @pan_vol.panner.pan
end

#pan=(value) ⇒ Object



37
38
39
# File 'lib/deftones/component/channel.rb', line 37

def pan=(value)
  @pan_vol.panner.pan = value
end

#receive(name) ⇒ Object



84
85
86
87
# File 'lib/deftones/component/channel.rb', line 84

def receive(name)
  bus(name) >> @input
  self
end

#render(num_frames, start_frame = 0, cache = {}) ⇒ Object



25
26
27
# File 'lib/deftones/component/channel.rb', line 25

def render(num_frames, start_frame = 0, cache = {})
  @output.render(num_frames, start_frame, cache)
end

#render_block(num_frames, start_frame = 0, cache = {}) ⇒ Object



29
30
31
# File 'lib/deftones/component/channel.rb', line 29

def render_block(num_frames, start_frame = 0, cache = {})
  @output.send(:render_block, num_frames, start_frame, cache)
end

#send(name, volume = 0.0) ⇒ Object



77
78
79
80
81
82
# File 'lib/deftones/component/channel.rb', line 77

def send(name, volume = 0.0)
  send_gain = Core::Gain.new(gain: Deftones.db_to_gain(volume), context: context)
  @output >> send_gain >> bus(name)
  @sends << send_gain
  send_gain
end

#solo=(value) ⇒ Object



73
74
75
# File 'lib/deftones/component/channel.rb', line 73

def solo=(value)
  @solo.solo = value
end

#solo?Boolean Also known as: solo

Returns:

  • (Boolean)


69
70
71
# File 'lib/deftones/component/channel.rb', line 69

def solo?
  @solo.solo?
end

#volumeObject



41
42
43
# File 'lib/deftones/component/channel.rb', line 41

def volume
  @pan_vol.volume.volume
end

#volume=(value) ⇒ Object



45
46
47
# File 'lib/deftones/component/channel.rb', line 45

def volume=(value)
  @pan_vol.volume.volume = value
end