Package com.jme3.audio
Class LowPassFilter
java.lang.Object
com.jme3.util.NativeObject
com.jme3.audio.Filter
com.jme3.audio.LowPassFilter
- All Implemented Interfaces:
Savable
,JmeCloneable
,Cloneable
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 Summary
FieldsModifier and TypeFieldDescriptionprotected float
The volume scaling of the high frequencies allowed to pass through.protected float
The overall volume scaling of the filtered soundFields inherited from class com.jme3.util.NativeObject
handleRef, id, INVALID_ID, objectManager, OBJTYPE_AUDIOBUFFER, OBJTYPE_AUDIOSTREAM, OBJTYPE_BO, OBJTYPE_FILTER, OBJTYPE_FRAMEBUFFER, OBJTYPE_SHADER, OBJTYPE_SHADERSOURCE, OBJTYPE_TEXTURE, OBJTYPE_VERTEXBUFFER, updateNeeded
-
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructs a low-pass filter with default settings.LowPassFilter
(float volume, float highFreqVolume) Constructs a low-pass filter.protected
LowPassFilter
(int id) For internal cloning -
Method Summary
Modifier and TypeMethodDescriptionCreates a native object clone of this filter for internal usage.float
Retrieves the current volume scaling of high frequencies.long
Retrieves a unique identifier for this filter.float
Retrieves the current overall volume scaling of the filtered sound.void
read
(JmeImporter im) void
setHighFreqVolume
(float highFreqVolume) Sets the high-frequency volume.void
setVolume
(float volume) Sets the overall volume.void
write
(JmeExporter ex) Methods inherited from class com.jme3.audio.Filter
cloneFields, deleteObject, jmeClone, resetObject
Methods inherited from class com.jme3.util.NativeObject
clearUpdateNeeded, clone, deleteNativeBuffers, dispose, getId, getWeakRef, isUpdateNeeded, setId, setUpdateNeeded, toString
-
Field Details
-
volume
protected float volumeThe overall volume scaling of the filtered sound -
highFreqVolume
protected float highFreqVolumeThe 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
- ifvolume
orhighFreqVolume
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
- ifhighFreqVolume
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
- ifvolume
is out of range.
-
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classFilter
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classFilter
- Throws:
IOException
-
createDestructableClone
Creates a native object clone of this filter for internal usage.- Specified by:
createDestructableClone
in classFilter
- 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 classNativeObject
- Returns:
- a unique long identifier.
-