java.lang.Object
uk.co.caprica.vlcj.player.base.Equalizer
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 -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addEqualizerListener
(EqualizerListener listener) Add a listener to be notified of equalizer state-change events.final float
amp
(int index) Get an individual amplification value.final float[]
amps()
Get the current amplification values for all frequency bands.final int
Get the number of distinct frequency bands in the equalizer.final float
preamp()
Get the current pre-amplification value.final void
removeEqualizerListener
(EqualizerListener listener) Remove a listener so that it is no longer notified of equalizer state-change events.final void
reset()
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
setEqualizer
(Equalizer equalizer) Set new amplification values (including pre-amplification) from another equalizer.final void
setPreamp
(float newPreamp) Set a new pre-amplification value.final String
toString()
-
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
Add a listener to be notified of equalizer state-change events.- Parameters:
listener
- listener to add
-
removeEqualizerListener
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 setnewAmp
- 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 arenull
, the wrong length, or outside of the allowed range
-
setEqualizer
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
-