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 floatThe volume scaling of the high frequencies allowed to pass through.protected floatThe 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.protectedLowPassFilter(int id) For internal cloning -
Method Summary
Modifier and TypeMethodDescriptionCreates a native object clone of this filter for internal usage.floatRetrieves the current volume scaling of high frequencies.longRetrieves a unique identifier for this filter.floatRetrieves the current overall volume scaling of the filtered sound.voidread(JmeImporter im) voidsetHighFreqVolume(float highFreqVolume) Sets the high-frequency volume.voidsetVolume(float volume) Sets the overall volume.voidwrite(JmeExporter ex) Methods inherited from class com.jme3.audio.Filter
cloneFields, deleteObject, jmeClone, resetObjectMethods 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- ifvolumeorhighFreqVolumeis 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- ifhighFreqVolumeis 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- ifvolumeis out of range.
-
write
- Specified by:
writein interfaceSavable- Overrides:
writein classFilter- Throws:
IOException
-
read
- Specified by:
readin interfaceSavable- Overrides:
readin classFilter- Throws:
IOException
-
createDestructableClone
Creates a native object clone of this filter for internal usage.- Specified by:
createDestructableClonein classFilter- Returns:
- a new
LowPassFilterinstance with the same native ID.
-
getUniqueId
public long getUniqueId()Retrieves a unique identifier for this filter. Used internally for native object management.- Specified by:
getUniqueIdin classNativeObject- Returns:
- a unique long identifier.
-