Class Equalizer

java.lang.Object
uk.co.caprica.vlcj.player.base.Equalizer

public final class Equalizer extends Object
Encapsulation of audio equalizer settings.

Equalizer amplification values are constrained to the range -20.0 Hz to 20.0 Hz, see LibVlcConst.MIN_GAIN and LibVlcConst.MAX_GAIN. Attempting to set values outside of this range will cause an IllegalArgumentException to be thrown.

After creating an equalizer, it may be associated with a media player.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Equalizer(int bandCount)
    Create an audio equalizer.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Add a listener to be notified of equalizer state-change events.
    final float
    amp(int index)
    Get an individual amplification value.
    final float[]
    Get the current amplification values for all frequency bands.
    final int
    Get the number of distinct frequency bands in the equalizer.
    final float
    Get the current pre-amplification value.
    final void
    Remove a listener so that it is no longer notified of equalizer state-change events.
    final void
    Reset all of the equalizer amplification values (including pre-amplification) to zero.
    final void
    setAmp(int index, float newAmp)
    Set an individual amplification value.
    final void
    setAmps(float[] newAmps)
    Set new amplification values for all frequency bands.
    final void
    Set new amplification values (including pre-amplification) from another equalizer.
    final void
    setPreamp(float newPreamp)
    Set a new pre-amplification value.
    final String
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Equalizer

      public Equalizer(int bandCount)
      Create an audio equalizer.
      Parameters:
      bandCount - number of unique frequency bands (not including pre-amp)
  • Method Details

    • addEqualizerListener

      public final void addEqualizerListener(EqualizerListener listener)
      Add a listener to be notified of equalizer state-change events.
      Parameters:
      listener - listener to add
    • removeEqualizerListener

      public final void removeEqualizerListener(EqualizerListener listener)
      Remove a listener so that it is no longer notified of equalizer state-change events.
      Parameters:
      listener - listener to remove
    • bandCount

      public final int bandCount()
      Get the number of distinct frequency bands in the equalizer.
      Returns:
      number of frequency bands
    • preamp

      public final float preamp()
      Get the current pre-amplification value.
      Returns:
      pre-amplification value (Hz)
    • setPreamp

      public final void setPreamp(float newPreamp)
      Set a new pre-amplification value.
      Parameters:
      newPreamp - pre-amplification value (Hz)
      Throws:
      IllegalArgumentException - if the amplification value is outside of the allowed range
    • amp

      public final float amp(int index)
      Get an individual amplification value.
      Parameters:
      index - index of the frequency band to get
      Returns:
      amplification value
      Throws:
      IllegalArgumentException - if the index is outside of the allowed range
    • setAmp

      public final void setAmp(int index, float newAmp)
      Set an individual amplification value.
      Parameters:
      index - index of the frequency band to set
      newAmp - amplification value
      Throws:
      IllegalArgumentException - if the index or amplification value is outside of the allowed range
    • amps

      public final float[] amps()
      Get the current amplification values for all frequency bands.
      Returns:
      current amplification values
    • setAmps

      public final void setAmps(float[] newAmps)
      Set new amplification values for all frequency bands.
      Parameters:
      newAmps - new amplification values
      Throws:
      IllegalArgumentException - if the amplification values are null, the wrong length, or outside of the allowed range
    • setEqualizer

      public final void setEqualizer(Equalizer equalizer)
      Set new amplification values (including pre-amplification) from another equalizer.
      Parameters:
      equalizer - equalizer to obtain values from
    • reset

      public final void reset()
      Reset all of the equalizer amplification values (including pre-amplification) to zero.
    • toString

      public final String toString()
      Overrides:
      toString in class Object