Class: Deftones::Component::MidSideCompressor
- Inherits:
-
Deftones::Core::AudioNode
- Object
- Deftones::Core::AudioNode
- Deftones::Component::MidSideCompressor
- Defined in:
- lib/deftones/component/mid_side_compressor.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#merge ⇒ Object
readonly
Returns the value of attribute merge.
-
#mid ⇒ Object
readonly
Returns the value of attribute mid.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#side ⇒ Object
readonly
Returns the value of attribute side.
-
#split ⇒ Object
readonly
Returns the value of attribute split.
Attributes inherited from Deftones::Core::AudioNode
Instance Method Summary collapse
- #build_compressor(definition, context) ⇒ Object private
-
#initialize(mid: {}, side: {}, context: Deftones.context) ⇒ MidSideCompressor
constructor
A new instance of MidSideCompressor.
- #render(num_frames, start_frame = 0, cache = {}) ⇒ Object
- #render_block(num_frames, start_frame = 0, 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, #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(mid: {}, side: {}, context: Deftones.context) ⇒ MidSideCompressor
Returns a new instance of MidSideCompressor.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/deftones/component/mid_side_compressor.rb', line 8 def initialize(mid: {}, side: {}, context: Deftones.context) super(context: context) @split = MidSideSplit.new(context: context) @merge = MidSideMerge.new(context: context) @input = @split @output = @merge @mid = build_compressor(mid, context) @side = build_compressor(side, context) @split.mid >> @mid >> @merge.mid @split.side >> @side >> @merge.side end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
6 7 8 |
# File 'lib/deftones/component/mid_side_compressor.rb', line 6 def input @input end |
#merge ⇒ Object (readonly)
Returns the value of attribute merge.
6 7 8 |
# File 'lib/deftones/component/mid_side_compressor.rb', line 6 def merge @merge end |
#mid ⇒ Object (readonly)
Returns the value of attribute mid.
6 7 8 |
# File 'lib/deftones/component/mid_side_compressor.rb', line 6 def mid @mid end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
6 7 8 |
# File 'lib/deftones/component/mid_side_compressor.rb', line 6 def output @output end |
#side ⇒ Object (readonly)
Returns the value of attribute side.
6 7 8 |
# File 'lib/deftones/component/mid_side_compressor.rb', line 6 def side @side end |
#split ⇒ Object (readonly)
Returns the value of attribute split.
6 7 8 |
# File 'lib/deftones/component/mid_side_compressor.rb', line 6 def split @split end |
Instance Method Details
#build_compressor(definition, context) ⇒ Object (private)
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/deftones/component/mid_side_compressor.rb', line 30 def build_compressor(definition, context) return definition if definition.is_a?(Compressor) Compressor.new( threshold: definition.fetch(:threshold, -24.0), ratio: definition.fetch(:ratio, 3.0), attack: definition.fetch(:attack, 0.01), release: definition.fetch(:release, 0.1), context: context ) end |
#render(num_frames, start_frame = 0, cache = {}) ⇒ Object
20 21 22 |
# File 'lib/deftones/component/mid_side_compressor.rb', line 20 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
24 25 26 |
# File 'lib/deftones/component/mid_side_compressor.rb', line 24 def render_block(num_frames, start_frame = 0, cache = {}) @output.send(:render_block, num_frames, start_frame, cache) end |