Class: Deftones::Component::Volume
- Inherits:
-
Deftones::Core::AudioNode
- Object
- Deftones::Core::AudioNode
- Deftones::Component::Volume
- Defined in:
- lib/deftones/component/volume.rb
Instance Attribute Summary collapse
-
#volume ⇒ Object
Returns the value of attribute volume.
Attributes inherited from Deftones::Core::AudioNode
Instance Method Summary collapse
-
#initialize(volume: 0.0, context: Deftones.context) ⇒ Volume
constructor
A new instance of Volume.
- #multichannel_process? ⇒ Boolean
- #process(input_block, num_frames, start_frame, _cache) ⇒ Object
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, #dispose, #disposed?, #fan, #get, #immediate, #input_for_index, #inputs, #mix_source_blocks, #name, #normalize_connection_index, #normalize_output_block, #now, #number_of_inputs, #number_of_outputs, #output, #output_for_connection, #output_for_index, #outputs, #raise_connection_index_error!, #reaches_node?, #render, #render_block, #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(volume: 0.0, context: Deftones.context) ⇒ Volume
Returns a new instance of Volume.
8 9 10 11 |
# File 'lib/deftones/component/volume.rb', line 8 def initialize(volume: 0.0, context: Deftones.context) super(context: context) @volume = Core::Signal.new(value: volume, units: :decibels, context: context) end |
Instance Attribute Details
#volume ⇒ Object
Returns the value of attribute volume.
6 7 8 |
# File 'lib/deftones/component/volume.rb', line 6 def volume @volume end |
Instance Method Details
#multichannel_process? ⇒ Boolean
17 18 19 |
# File 'lib/deftones/component/volume.rb', line 17 def multichannel_process? true end |
#process(input_block, num_frames, start_frame, _cache) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/deftones/component/volume.rb', line 21 def process(input_block, num_frames, start_frame, _cache) gains = @volume.process(num_frames, start_frame) Core::AudioBlock.from_channel_data( input_block.channel_data.map do |channel| Array.new(num_frames) { |index| channel[index] * gains[index] } end ) end |