Class: FMOD::Effects::MultibandEq

Inherits:
Dsp
  • Object
show all
Defined in:
lib/fmod/effects/multiband_eq.rb

Overview

This unit is a flexible five band parametric equalizer.

See detailed description of each parameter to determine its effect with each type of filter.

Constant Summary collapse

BANDS =

Valid bands used for the equalizer.

[:a, :b, :c, :d, :e].freeze

Instance Attribute Summary

Attributes inherited from Dsp

#active, #bypass, #channel_format, #input_count, #output_count, #parameter_count, #parent, #type, #wet_dry_mix

Attributes inherited from Handle

#user_data

Instance Method Summary collapse

Methods inherited from Dsp

#[], #[]=, #add_input, bool_param, data_param, #disconnect, #disconnect_from, #enable_metering, float_param, from_handle, #get_bool, #get_data, #get_float, #get_integer, #idle?, #info, #input, #input_connection, #input_metering?, integer_param, #name, #output, #output_connection, #output_format, #output_metering?, #param_info, #play, #reset, #set_bool, #set_data, #set_float, #set_integer, #set_wet_dry_mix, #show_dialog, #to_s, type_map, #version

Methods inherited from Handle

#initialize, #int_ptr, #release, #to_s

Constructor Details

This class inherits a constructor from FMOD::Handle

Instance Method Details

#get_filter(band) ⇒ Integer

Retrieves the filter used for the specified band. The filter determines the behavior of the other parameters.

Parameters:

  • band (Symbol)

    The band.

Returns:

  • (Integer)

    The current filter.

See Also:



23
24
25
26
# File 'lib/fmod/effects/multiband_eq.rb', line 23

def get_filter(band)
  index = BANDS.index(band) * 4
  get_integer(index)
end

#get_frequency(band) ⇒ Float

Retrieves the frequency for the specified band. This value has different effects determined by the current filter.

  • Low-pass/High-pass/Low-shelf/High-shelf: Significant frequency in Hz, cutoff

  • Notch/Peaking/Band-pass: Center

  • All-pass: Phase transition point

Parameters:

  • band (Symbol)

    The band.

Returns:

  • (Float)

See Also:



40
41
42
43
# File 'lib/fmod/effects/multiband_eq.rb', line 40

def get_frequency(band)
  index = (BANDS.index(band) * 4) + 1
  get_float(index)
end

#get_gain(band) ⇒ Float

Note:

Peaking/Low-shelf/High-shelf only.

Retrieves the gain for the specified band.

Parameters:

  • band (Symbol)

    The band.

Returns:

  • (Float)

See Also:



70
71
72
73
# File 'lib/fmod/effects/multiband_eq.rb', line 70

def get_gain(band)
  index = (BANDS.index(band) * 4) + 3
  get_float(index)
end

#get_quality(band) ⇒ Float

Retrieves the quality factor for the specified band. This value has different effects determined by the current filter.

  • Low-pass/High-pass: Quality factor, resonance

  • Notch/Peaking/Band-pass: Bandwidth

  • All-pass: Phase transition sharpness

  • Low-shelf/High-shelf: Unused

Parameters:

  • band (Symbol)

    The band.

Returns:

  • (Float)

See Also:



57
58
59
60
# File 'lib/fmod/effects/multiband_eq.rb', line 57

def get_quality(band)
  index = (BANDS.index(band) * 4) + 2
  get_float(index)
end

#set_filter(band, filter) ⇒ self

Sets the filter used for the specified band.

The filter determines the behavior of the other parameters.

Parameters:

  • band (Symbol)

    The band.

  • filter (Integer)

    The filter to set, a Core::FilterType value.

Returns:

  • (self)

See Also:



84
85
86
87
88
# File 'lib/fmod/effects/multiband_eq.rb', line 84

def set_filter(band, filter)
  index = BANDS.index(band) * 4
  set_integer(index, filter.clamp(0, 12))
  self
end

#set_frequency(band, frequency) ⇒ self

Sets the frequency for the specified band. This value has different effects determined by the current filter.

  • Low-pass/High-pass/Low-shelf/High-shelf: Significant frequency in Hz, cutoff

  • Notch/Peaking/Band-pass: Center

  • All-pass: Phase transition point

Parameters:

  • band (Symbol)

    The band.

  • frequency (Float)

    The frequency to set.

    • Minimum: 20.0

    • Maximum: 22000.0

    • Default: 8000.0

Returns:

  • (self)

See Also:



106
107
108
109
110
# File 'lib/fmod/effects/multiband_eq.rb', line 106

def set_frequency(band, frequency)
  index = (BANDS.index(band) * 4) + 1
  set_float(index, frequency.clamp(20.0, 22000.0))
  self
end

#set_gain(band, gain) ⇒ self

Note:

Peaking/Low-shelf/High-shelf only.

Sets the gain for the specified band.

Parameters:

  • band (Symbol)

    The band.

  • gain (Float)

    The boost or attenuation in dB.

    • Minimum: -30.0

    • Maximum: 30.0

    • Default: 0.0

Returns:

  • (self)

See Also:



146
147
148
149
150
# File 'lib/fmod/effects/multiband_eq.rb', line 146

def set_gain(band, gain)
  index = (BANDS.index(band) * 4) + 3
  set_float(index, gain.clamp(-30.0, 30.0))
  self
end

#set_quality(band, quality) ⇒ self

Set the quality factor for the specified band. This value has different effects determined by the current filter.

  • Low-pass/High-pass: Quality factor, resonance

  • Notch/Peaking/Band-pass: Bandwidth

  • All-pass: Phase transition sharpness

  • Low-shelf/High-shelf: Unused

Parameters:

  • band (Symbol)

    The band.

  • quality (Float)

    The quality factor.

    • Minimum: 0.1

    • Maximum: 10.0

    • Default: 0.707

Returns:

  • (self)

See Also:



128
129
130
131
132
# File 'lib/fmod/effects/multiband_eq.rb', line 128

def set_quality(band, quality)
  index = (BANDS.index(band) * 4) + 2
  set_float(index, quality.clamp(0.1, 10.0))
  self
end