Class AudioSource
java.lang.Object
dev.prozilla.pine.common.asset.audio.AudioSource
- All Implemented Interfaces:
Asset,AudioSourceContext,Cloneable<AudioSource>,Destructible,Initializable
public class AudioSource
extends Object
implements Initializable, Destructible, Asset, AudioSourceContext, Cloneable<AudioSource>
-
Constructor Summary
ConstructorsConstructorDescriptionAudioSource(String path, ShortBuffer buffer, int channels, int sampleRate) AudioSource(ShortBuffer buffer, int channels, int sampleRate) -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a new object that is equal to this object.voiddestroy()Destroys this object.booleanequals(AudioSource audioSource) Checks if the given object is equal to this object.booleanintgetAttribute(int attribute) double[]getAverageMagnitudes(int intervalCount) double[]getPath()Returns the path to the file this asset was loaded from.intgetState()voidinit()Initializes this object to prepare its usage.booleanbooleanvoidpause()voidplay()voidrewind()voidsetAttribute(int attribute, boolean value) voidsetAttribute(int attribute, float value) voidsetAttribute(int attribute, int value) voidsetCapture(boolean capture) voidsetGain(float gain) voidsetLoop(boolean loop) voidsetPitch(float pitch) voidsetVolume(float volume) Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.prozilla.pine.common.asset.audio.AudioSourceContext
restart, stop, togglePause
-
Constructor Details
-
AudioSource
-
AudioSource
-
-
Method Details
-
init
Description copied from interface:InitializableInitializes this object to prepare its usage.- Specified by:
initin interfaceInitializable- Throws:
IllegalStateException
-
destroy
public void destroy()Description copied from interface:DestructibleDestroys this object.- Specified by:
destroyin interfaceAsset- Specified by:
destroyin interfaceDestructible
-
getPath
Description copied from interface:AssetReturns the path to the file this asset was loaded from. -
setCapture
public void setCapture(boolean capture) -
isCaptured
public boolean isCaptured() -
rewind
public void rewind()- Specified by:
rewindin interfaceAudioSourceContext
-
play
public void play()- Specified by:
playin interfaceAudioSourceContext
-
pause
public void pause()- Specified by:
pausein interfaceAudioSourceContext
-
isPlaying
public boolean isPlaying()- Specified by:
isPlayingin interfaceAudioSourceContext
-
getState
public int getState() -
getAttribute
- Throws:
IllegalStateException
-
setVolume
- Specified by:
setVolumein interfaceAudioSourceContext- Throws:
IllegalStateException
-
setPitch
- Specified by:
setPitchin interfaceAudioSourceContext- Throws:
IllegalStateException
-
setGain
public void setGain(float gain) - Specified by:
setGainin interfaceAudioSourceContext
-
setLoop
- Specified by:
setLoopin interfaceAudioSourceContext- Throws:
IllegalStateException
-
setAttribute
- Throws:
IllegalStateException
-
setAttribute
- Throws:
IllegalStateException
-
setAttribute
- Throws:
IllegalStateException
-
getAverageMagnitudes
public double[] getAverageMagnitudes(int intervalCount) -
getMagnitudes
public double[] getMagnitudes() -
equals
-
equals
Description copied from interface:CloneableChecks if the given object is equal to this object.- Specified by:
equalsin interfaceCloneable<AudioSource>- Parameters:
audioSource- Other object- Returns:
trueif both objects are equal.
-
clone
Description copied from interface:CloneableReturns a new object that is equal to this object.- Specified by:
clonein interfaceCloneable<AudioSource>- Overrides:
clonein classObject- Returns:
- Clone of this object
-