Class LowPassFilter

All Implemented Interfaces:
Savable, JmeCloneable, Cloneable

public class LowPassFilter extends Filter
A filter that attenuates frequencies above a specified threshold, allowing lower frequencies to pass through with less attenuation. Commonly used to simulate effects such as muffling or underwater acoustics.
  • Field Details

    • volume

      protected float volume
      The overall volume scaling of the filtered sound
    • highFreqVolume

      protected float highFreqVolume
      The volume scaling of the high frequencies allowed to pass through. Valid values range from 0.0 to 1.0, where 0.0 completely eliminates high frequencies and 1.0 lets them pass through unchanged.
  • Constructor Details

    • LowPassFilter

      public LowPassFilter()
      Constructs a low-pass filter with default settings. Required for jME deserialization.
    • LowPassFilter

      public LowPassFilter(float volume, float highFreqVolume)
      Constructs a low-pass filter.
      Parameters:
      volume - the overall volume scaling of the filtered sound (0.0 - 1.0).
      highFreqVolume - the volume scaling of high frequencies (0.0 - 1.0).
      Throws:
      IllegalArgumentException - if volume or highFreqVolume is out of range.
    • LowPassFilter

      protected LowPassFilter(int id)
      For internal cloning
      Parameters:
      id - the native object ID
  • Method Details

    • getHighFreqVolume

      public float getHighFreqVolume()
      Retrieves the current volume scaling of high frequencies.
      Returns:
      the high-frequency volume scaling.
    • setHighFreqVolume

      public void setHighFreqVolume(float highFreqVolume)
      Sets the high-frequency volume.
      Parameters:
      highFreqVolume - the new high-frequency volume scaling (0.0 - 1.0).
      Throws:
      IllegalArgumentException - if highFreqVolume is out of range.
    • getVolume

      public float getVolume()
      Retrieves the current overall volume scaling of the filtered sound.
      Returns:
      the overall volume scaling.
    • setVolume

      public void setVolume(float volume)
      Sets the overall volume.
      Parameters:
      volume - the new overall volume scaling (0.0 - 1.0).
      Throws:
      IllegalArgumentException - if volume is out of range.
    • write

      public void write(JmeExporter ex) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class Filter
      Throws:
      IOException
    • read

      public void read(JmeImporter im) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class Filter
      Throws:
      IOException
    • createDestructableClone

      public NativeObject createDestructableClone()
      Creates a native object clone of this filter for internal usage.
      Specified by:
      createDestructableClone in class Filter
      Returns:
      a new LowPassFilter instance with the same native ID.
    • getUniqueId

      public long getUniqueId()
      Retrieves a unique identifier for this filter. Used internally for native object management.
      Specified by:
      getUniqueId in class NativeObject
      Returns:
      a unique long identifier.