Package de.Keyle.MyPet.api.gui
Record Class SoundSpec.Range
java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.gui.SoundSpec.Range
- Record Components:
key- which sound to playvolume- range the volume is sampled frompitch- range the pitch is sampled fromsource- the mixer category to play it on
- All Implemented Interfaces:
SoundSpec
- Enclosing interface:
SoundSpec
public static record SoundSpec.Range(Key key, FloatRange volume, FloatRange pitch, Sound.Source source)
extends Record
implements SoundSpec
A sound whose volume and pitch are sampled from a range on each play.
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.Keyle.MyPet.api.gui.SoundSpec
SoundSpec.Choice, SoundSpec.Fixed, SoundSpec.Range, SoundSpec.Silent -
Constructor Summary
ConstructorsConstructorDescriptionRange(Key key, FloatRange volume, FloatRange pitch, Sound.Source source) Creates an instance of aRangerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.pitch()Returns the value of thepitchrecord component.resolve(RandomGenerator random) Resolves this spec into a playable sound.source()Returns the value of thesourcerecord component.final StringtoString()Returns a string representation of this record class.volume()Returns the value of thevolumerecord component.
-
Constructor Details
-
Method Details
-
resolve
Description copied from interface:SoundSpecResolves this spec into a playable sound.- Specified by:
resolvein interfaceSoundSpec- Parameters:
random- generator used to pick an option and sample any ranges- Returns:
- the sound to play, or
nullforSoundSpec.Silent
-
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 withObjects::equals(Object,Object). -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
volume
Returns the value of thevolumerecord component.- Returns:
- the value of the
volumerecord component
-
pitch
Returns the value of thepitchrecord component.- Returns:
- the value of the
pitchrecord component
-
source
Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-