Record Class SoundFilter
java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcanvas.api.client.sound.SoundFilter
- Record Components:
gain- how loud the sound staysgainHF- how much of its high end it keepsdistortion- how much of it is sent through the distortionreverb- how much of it is sent into the reverb
How a sound comes through to the listener, each part 0 to 1:
gain: how loud it stays, 1 for as loud as it was;gainHF: how much of its high end it keeps; losing the highs is what makes a sound muffled, as through a wall;distortion: how much of it is sent through a distortion, which makes it rough, as if strained through something;reverb: how much of it is sent into a reverb, which makes it echo, as in a cave or a great hall.
SoundFilter.muffled(0.8F) // through a thick wall
new SoundFilter(0.6F, 0.1F, 0.3F) // muffled and rough, as under water
SoundFilter.echoing(0.5F).then(SoundFilter.quieter(0.8F))
SoundFilter.NONE.lerp(underwater, fade) // part of the way there, for a fade
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSoundFilter(float gain, float gainHF) A filter that only muffles.SoundFilter(float gain, float gainHF, float distortion) A filter without reverb.SoundFilter(float gain, float gainHF, float distortion, float reverb) Creates an instance of aSoundFilterrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic SoundFilterdistorted(float amount) Only rough:amountof it sent through the distortion.floatReturns the value of thedistortionrecord component.static SoundFilterechoing(float amount) Only echoing:amountof it sent into the reverb.final booleanIndicates whether some other object is "equal to" this one.floatgain()Returns the value of thegainrecord component.floatgainHF()Returns the value of thegainHFrecord component.final inthashCode()Returns a hash code value for this object.booleanisNone()Whether it changes nothing.lerp(SoundFilter to, float delta) Part of the way from this filter to another: 0 is this one, 1 the other.static SoundFiltermuffled(float amount) Muffled, as through a wall: 0 for not at all, 1 for nearly nothing of the highs left and a little quieter.static SoundFilterquieter(float gain) Only quieter:gainof the volume left.floatreverb()Returns the value of thereverbrecord component.then(SoundFilter other) Both filters at once, as a sound through one wall and then another.final StringtoString()Returns a string representation of this record class.withDistortion(float distortion) This filter with another distortion.withReverb(float reverb) This filter with another reverb.
-
Field Details
-
NONE
The sound as it is.
-
-
Constructor Details
-
SoundFilter
public SoundFilter(float gain, float gainHF, float distortion, float reverb) Creates an instance of aSoundFilterrecord class.- Parameters:
gain- the value for thegainrecord componentgainHF- the value for thegainHFrecord componentdistortion- the value for thedistortionrecord componentreverb- the value for thereverbrecord component
-
SoundFilter
public SoundFilter(float gain, float gainHF, float distortion) A filter without reverb. -
SoundFilter
public SoundFilter(float gain, float gainHF) A filter that only muffles.
-
-
Method Details
-
muffled
Muffled, as through a wall: 0 for not at all, 1 for nearly nothing of the highs left and a little quieter. -
quieter
Only quieter:gainof the volume left. -
distorted
Only rough:amountof it sent through the distortion. -
echoing
Only echoing:amountof it sent into the reverb. -
withDistortion
This filter with another distortion. -
withReverb
This filter with another reverb. -
then
Both filters at once, as a sound through one wall and then another. -
lerp
Part of the way from this filter to another: 0 is this one, 1 the other. For fades. -
isNone
public boolean isNone()Whether it changes nothing. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
gain
public float gain()Returns the value of thegainrecord component.- Returns:
- the value of the
gainrecord component
-
gainHF
public float gainHF()Returns the value of thegainHFrecord component.- Returns:
- the value of the
gainHFrecord component
-
distortion
public float distortion()Returns the value of thedistortionrecord component.- Returns:
- the value of the
distortionrecord component
-
reverb
public float reverb()Returns the value of thereverbrecord component.- Returns:
- the value of the
reverbrecord component
-