Package de.Keyle.MyPet.api.gui
Record Class SoundSpec.Fixed
java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.gui.SoundSpec.Fixed
- Record Components:
key- which sound to playvolume- playback volumepitch- playback pitchsource- the mixer category to play it on
- All Implemented Interfaces:
SoundSpec
- Enclosing interface:
SoundSpec
public static record SoundSpec.Fixed(Key key, float volume, float pitch, Sound.Source source)
extends Record
implements SoundSpec
A sound played at a fixed volume and pitch.
-
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
ConstructorsConstructorDescriptionFixed(Key key, float volume, float pitch, Sound.Source source) Creates an instance of aFixedrecord 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.floatpitch()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.floatvolume()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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
volume
public float volume()Returns the value of thevolumerecord component.- Returns:
- the value of the
volumerecord component
-
pitch
public float 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
-