Class AbstractAudioSource
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractAudio
-
- jmri.jmrit.audio.AbstractAudioSource
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>,Audio,PropertyChangeProvider,AudioSource,NamedBean
- Direct Known Subclasses:
JavaSoundAudioSource,JoalAudioSource,NullAudioSource
public abstract class AbstractAudioSource extends AbstractAudio implements AudioSource
Base implementation of the AudioSource class.Specific implementations will extend this base class.
This file is part of JMRI.JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractAudioSource.AudioSourceFadeThreadAn internal class used to create a new thread to monitor and maintain fade in and fade out levels.protected static classAbstractAudioSource.AudioSourceMoveThreadAn internal class used to create a new thread to monitor and maintain current source position with respect to velocity.-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.Audio
AT, BUFFER, CMD_BIND_BUFFER, CMD_FADE_IN, CMD_FADE_OUT, CMD_INIT_FACTORY, CMD_LOAD_SOUND, CMD_PAUSE, CMD_PAUSE_TOGGLE, CMD_PLAY, CMD_PLAY_TOGGLE, CMD_QUEUE_BUFFERS, CMD_RESET_POSITION, CMD_RESUME, CMD_REWIND, CMD_STOP, CMD_UNQUEUE_BUFFERS, DECIMAL_PLACES, FADE_IN, FADE_NONE, FADE_OUT, LISTENER, MAX_DISTANCE, SOURCE, STATE_EMPTY, STATE_INITIAL, STATE_LOADED, STATE_MOVING, STATE_PLAYING, STATE_POSITIONED, STATE_STOPPED, UP
-
Fields inherited from interface jmri.jmrit.audio.AudioSource
LOOP_CONTINUOUS, LOOP_NONE
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description AbstractAudioSource(java.lang.String systemName)Abstract constructor for new AudioSource with system nameAbstractAudioSource(java.lang.String systemName, java.lang.String userName)Abstract constructor for new AudioSource with system name and user name
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intattachSourcesToEffects()Method to attach sources to effects(package private) abstract booleanbindAudioBuffer(AudioBuffer buffer)Binds this AudioSource with the specified AudioBuffer.protected voidcalculateCurrentPosition()Calculate current position based on velocity.protected voidcalculateFades()Calculate the fade gains.protected abstract voidcalculateGain()Calculate the gain of this AudioSource based on distance from listener and fade levels.protected voidcalculateLoops()Calculate the number of times to loop playback of this sound.protected abstract voidchangePosition(javax.vecmath.Vector3f pos)Change the current position of this source.intdetachSourcesToEffects()Method to detach sources to effectsprotected abstract voiddoFadeIn()Fade in then play this AudioSource.protected abstract voiddoFadeOut()Fade out then stop this AudioSource.protected abstract voiddoPause()Stop playing the clip but retain the current position.protected abstract voiddoPlay()Play the clip from the beginning.protected voiddoResetCurrentPosition()Reset the current position.protected abstract voiddoResume()Play the clip from the current position.protected abstract voiddoRewind()Rewind clip to the beginning.protected abstract voiddoStop()Stop playing the clip and rewind to the beginning.protected voiddoTogglePause()Toggle the current playing status.protected voiddoTogglePlay()Toggle the current playing status.voidfadeIn()Method to fade in and then play this AudioSource ObjectvoidfadeOut()Method to fade out and then stop this AudioSource Object only when it is already playing.AudioBuffergetAssignedBuffer()Returns linked AudioBuffer objectjava.lang.StringgetAssignedBufferName()Return system name of linked AudioBuffer objectjavax.vecmath.Vector3fgetCurrentPosition()Returns the current position of this AudioSource object as a 3-dimensional vector.java.lang.StringgetDebugString()Get debug info about this audio source.protected floatgetFadeGain()Used to return the current calculated fade gain for this AudioSource.intgetFadeIn()Retrieve the length of time in milliseconds to fade this source inintgetFadeOut()Retrieve the length of time in milliseconds to fade this source inprotected intgetFading()Get the current fading status.floatgetGain()Return the currently stored gain settingintgetLastNumLoops()Get the last value returned byAudioSource.getNumLoops()floatgetMaximumDistance()Return the current maximum distance setting.intgetMaxLoops()Returns the maximum number of times that this AudioSource will loop, or LOOP_CONTINUOUS for infinite looping.intgetMinLoops()Returns the minimum number of times that this AudioSource will loop, or LOOP_CONTINUOUS for infinite looping.intgetNumLoops()The number of times that this AudioSource should loop, or LOOP_CONTINUOUS for infinite looping.longgetOffset()Return the offset in which to start playback of this AudioSource.floatgetPitch()Return the current pitch settingjavax.vecmath.Vector3fgetPosition()Returns the position of this AudioSource object as a 3-dimensional vector.java.util.Queue<AudioBuffer>getQueuedBuffers()floatgetReferenceDistance()Return the current reference distance settingfloatgetRollOffFactor()Get the roll-off factor of this AudioSource object.chargetSubType()An Audio object can represent one of a number of subtypes of object.javax.vecmath.Vector3fgetVelocity()Returns the velocity of this AudioSource objectbooleanisAudioAlive()booleanisBound()Method to return if this AudioSource has been bound to an AudioBufferbooleanisLooped()Check if this AudioSource object will loop or not.booleanisPositionRelative()Returns a boolean value that determines if the position of this AudioSource object is relative to the position of the AudioListener object or absolute.booleanisQueued()Method to return if this AudioSource has AudioBuffers queued to itintnumProcessedBuffers()intnumQueuedBuffers()voidpause()Method to pause playing this AudioSource Objectvoidplay()Method to start playing this AudioSource ObjectbooleanqueueAudioBuffer(AudioBuffer audioBuffer)booleanqueueAudioBuffers(java.util.Queue<AudioBuffer> audioBuffers)booleanqueueBuffer(AudioBuffer audioBuffer)booleanqueueBuffers(java.util.Queue<AudioBuffer> audioBuffers)Queues the linked AudioBuffer object to this Source's buffer queuevoidresetCurrentPosition()Method to reset the current position of this AudioSource object to the initial position as defined by setPosition.voidresume()Method to resume playing this AudioSource Objectvoidrewind()Method to rewind this AudioSource ObjectvoidsetAssignedBuffer(java.lang.String bufferSystemName)Sets the system name of the linked AudioBuffer objectvoidsetAssignedBuffer(AudioBuffer audioBuffer)Sets the linked AudioBuffer objectprotected voidsetBound(boolean bound)Method to define if this AudioSource has been bound to an AudioBuffer.voidsetFadeIn(int fadeInTime)Set the length of time in milliseconds to fade this source invoidsetFadeOut(int fadeOutTime)Set the length of time in milliseconds to fade this source invoidsetGain(float gain)Set the gain of this AudioSource objectvoidsetLooped(boolean loop)Sets this AudioSource object to loop infinitely or not.voidsetMaximumDistance(float maximumDistance)Set the current maximum distance setting.voidsetMaxLoops(int loops)The maximum number of times that this AudioSource should loop.voidsetMinLoops(int loops)The minimum number of times that this AudioSource should loop.voidsetOffset(long offset)Set the offset in which to start playback of this AudioSource.voidsetPitch(float pitch)Set the pitch of this AudioSource objectvoidsetPosition(float x, float y)Sets the position of this AudioSource object in x and y planes with z plane position fixed at zerovoidsetPosition(float x, float y, float z)Sets the position of this AudioSource object in x, y and z planesvoidsetPosition(javax.vecmath.Vector3f pos)Sets the position of this AudioSource objectvoidsetPositionRelative(boolean relative)Sets the position of this AudioSource object to be relative to the position of the AudioListener object or absolute.protected voidsetQueued(boolean queued)voidsetReferenceDistance(float referenceDistance)Set the reference distance of this AudioSource object.voidsetRollOffFactor(float rollOffFactor)Set the roll-off factor of this AudioSource object.voidsetVelocity(javax.vecmath.Vector3f vel)Sets the velocity of this AudioSource objectvoidstateChanged(int oldState)Method used to update the current state of the Audio objectvoidstop()Method to stop playing this AudioSource ObjectvoidtogglePause()Method to toggle playback of this AudioSource Object retaining postitionvoidtogglePlay()Method to toggle playback of this AudioSource Object reseting positionbooleanunqueueAudioBuffers()booleanunqueueBuffers()-
Methods inherited from class jmri.implementation.AbstractAudio
cleanup, dispose, getBeanType, getState, getUsageReport, roundDecimal, roundDecimal, setState
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, toStringSuffix, updateListenerRef, vetoableChange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, dispose, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getState, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setState, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
AbstractAudioSource
public AbstractAudioSource(java.lang.String systemName)
Abstract constructor for new AudioSource with system name- Parameters:
systemName- AudioSource object system name (e.g. IAS1)
-
AbstractAudioSource
public AbstractAudioSource(java.lang.String systemName, java.lang.String userName)
Abstract constructor for new AudioSource with system name and user name- Parameters:
systemName- AudioSource object system name (e.g. IAS1)userName- AudioSource object user name
-
-
Method Detail
-
isAudioAlive
public boolean isAudioAlive()
-
getSubType
public char getSubType()
Description copied from interface:AudioAn Audio object can represent one of a number of subtypes of object.This method enables us to determine which of those subtypes this particular instance is and be able to process accordingly.
Current supported subtypes are:
- B = Buffer
- L = Listener
- S = Source
- Specified by:
getSubTypein interfaceAudio- Returns:
- subType char
-
queueBuffers
public boolean queueBuffers(java.util.Queue<AudioBuffer> audioBuffers)
Description copied from interface:AudioSourceQueues the linked AudioBuffer object to this Source's buffer queueApplies only to sub-types:
- Source
- Specified by:
queueBuffersin interfaceAudioSource- Parameters:
audioBuffers- the AudioBuffer object to enqueue to this AudioSource- Returns:
- true if successfully queued audioBuffers; false otherwise
-
queueBuffer
public boolean queueBuffer(AudioBuffer audioBuffer)
- Specified by:
queueBufferin interfaceAudioSource
-
unqueueBuffers
public boolean unqueueBuffers()
- Specified by:
unqueueBuffersin interfaceAudioSource
-
getQueuedBuffers
public java.util.Queue<AudioBuffer> getQueuedBuffers()
-
setAssignedBuffer
public void setAssignedBuffer(AudioBuffer audioBuffer)
Description copied from interface:AudioSourceSets the linked AudioBuffer objectApplies only to sub-types:
- Source
- Specified by:
setAssignedBufferin interfaceAudioSource- Parameters:
audioBuffer- the AudioBuffer object to bind to this AudioSource
-
setAssignedBuffer
public void setAssignedBuffer(java.lang.String bufferSystemName)
Description copied from interface:AudioSourceSets the system name of the linked AudioBuffer objectApplies only to sub-types:
- Source
- Specified by:
setAssignedBufferin interfaceAudioSource- Parameters:
bufferSystemName- the SystemName of the AudioBuffer (i.e. IAB1) to bind to this AudioSource
-
getAssignedBuffer
public AudioBuffer getAssignedBuffer()
Description copied from interface:AudioSourceReturns linked AudioBuffer objectApplies only to sub-types:
- Source
- Specified by:
getAssignedBufferin interfaceAudioSource- Returns:
- AudioBuffer the AudioBuffer object bound to this AudioSource
-
getAssignedBufferName
public java.lang.String getAssignedBufferName()
Description copied from interface:AudioSourceReturn system name of linked AudioBuffer objectApplies only to sub-types:
- Source
- Specified by:
getAssignedBufferNamein interfaceAudioSource- Returns:
- sysName the SystemName of the AudioBuffer bound to this AudioSource
-
setPosition
public void setPosition(javax.vecmath.Vector3f pos)
Description copied from interface:AudioSourceSets the position of this AudioSource objectApplies only to sub-types:
- Listener
- Source
- Specified by:
setPositionin interfaceAudioSource- Parameters:
pos- 3d position vector
-
setPosition
public void setPosition(float x, float y, float z)
Description copied from interface:AudioSourceSets the position of this AudioSource object in x, y and z planesApplies only to sub-types:
- Listener
- Source
- Specified by:
setPositionin interfaceAudioSource- Parameters:
x- x-coordinatey- y-coordinatez- z-coordinate
-
setPosition
public void setPosition(float x, float y)
Description copied from interface:AudioSourceSets the position of this AudioSource object in x and y planes with z plane position fixed at zeroEquivalent to setPosition(x, y, 0.0f)
Applies only to sub-types:
- Listener
- Source
- Specified by:
setPositionin interfaceAudioSource- Parameters:
x- x-coordinatey- y-coordinate
-
getPosition
public javax.vecmath.Vector3f getPosition()
Description copied from interface:AudioSourceReturns the position of this AudioSource object as a 3-dimensional vector.Applies only to sub-types:
- Listener
- Source
- Specified by:
getPositionin interfaceAudioSource- Returns:
- 3d position vector
-
getCurrentPosition
public javax.vecmath.Vector3f getCurrentPosition()
Description copied from interface:AudioSourceReturns the current position of this AudioSource object as a 3-dimensional vector.Applies only to sub-types:
- Listener
- Source
- Specified by:
getCurrentPositionin interfaceAudioSource- Returns:
- 3d position vector
-
setPositionRelative
public void setPositionRelative(boolean relative)
Description copied from interface:AudioSourceSets the position of this AudioSource object to be relative to the position of the AudioListener object or absolute.Applies only to sub-types:
- Source
- Specified by:
setPositionRelativein interfaceAudioSource- Parameters:
relative- position relative or absolute
-
isPositionRelative
public boolean isPositionRelative()
Description copied from interface:AudioSourceReturns a boolean value that determines if the position of this AudioSource object is relative to the position of the AudioListener object or absolute.Applies only to sub-types:
- Source
- Specified by:
isPositionRelativein interfaceAudioSource- Returns:
- boolean position relative
-
setVelocity
public void setVelocity(javax.vecmath.Vector3f vel)
Description copied from interface:AudioSourceSets the velocity of this AudioSource objectApplies only to sub-types:
- Listener
- Source
- Specified by:
setVelocityin interfaceAudioSource- Parameters:
vel- 3d velocity vector
-
getVelocity
public javax.vecmath.Vector3f getVelocity()
Description copied from interface:AudioSourceReturns the velocity of this AudioSource objectApplies only to sub-types:
- Listener
- Source
- Specified by:
getVelocityin interfaceAudioSource- Returns:
- 3d velocity vector
-
calculateCurrentPosition
protected void calculateCurrentPosition()
Calculate current position based on velocity.
-
resetCurrentPosition
public void resetCurrentPosition()
Description copied from interface:AudioSourceMethod to reset the current position of this AudioSource object to the initial position as defined by setPosition.Applies only to sub-types:
- Listener
- Source
- Specified by:
resetCurrentPositionin interfaceAudioSource
-
doResetCurrentPosition
protected void doResetCurrentPosition()
Reset the current position.
-
changePosition
protected abstract void changePosition(javax.vecmath.Vector3f pos)
Change the current position of this source.- Parameters:
pos- new position
-
setGain
public void setGain(float gain)
Description copied from interface:AudioSourceSet the gain of this AudioSource objectDefault value = 1.0f
Applies only to sub-types:
- Listener
- Source
- Specified by:
setGainin interfaceAudioSource- Parameters:
gain- the gain of this AudioSource
-
getGain
public float getGain()
Description copied from interface:AudioSourceReturn the currently stored gain settingDefault value = 1.0f
Applies only to sub-types:
- Listener
- Source
- Specified by:
getGainin interfaceAudioSource- Returns:
- gain setting of this AudioSource
-
calculateGain
protected abstract void calculateGain()
Calculate the gain of this AudioSource based on distance from listener and fade levels.
-
setPitch
public void setPitch(float pitch)
Description copied from interface:AudioSourceSet the pitch of this AudioSource objectValues are restricted from 0.5f to 2.0f, i.e. half to double
Default value = 1.0f
Applies only to sub-types:
- Source
- Specified by:
setPitchin interfaceAudioSource- Parameters:
pitch- the pitch of this AudioSource
-
getPitch
public float getPitch()
Description copied from interface:AudioSourceReturn the current pitch settingValues are restricted from 0.5f to 2.0f, i.e. half to double
Default value = 1.0f
Applies only to sub-types:
- Source
- Specified by:
getPitchin interfaceAudioSource- Returns:
- pitch of this AudioSource
-
setReferenceDistance
public void setReferenceDistance(float referenceDistance)
Description copied from interface:AudioSourceSet the reference distance of this AudioSource object.Default value = 1.0f
The Reference Distance is one of the main parameters you have for controlling the way that sounds attenuate with distance. A Source with Reference Distance set to 5 (meters) will be at maximum volume while it is within 5 metere of the listener, and start to fade out as it moves further away. At 10 meters it will be at half volume, and at 20 meters at a quarter volume, etc ...
Applies only to sub-types:
- Source
- Specified by:
setReferenceDistancein interfaceAudioSource- Parameters:
referenceDistance- the Reference Distance for this AudioSource
-
getReferenceDistance
public float getReferenceDistance()
Description copied from interface:AudioSourceReturn the current reference distance settingDefault value = 1.0f
Applies only to sub-types:
- Source
- Specified by:
getReferenceDistancein interfaceAudioSource- Returns:
- Reference Distance of this AudioSource
-
setOffset
public void setOffset(long offset)
Description copied from interface:AudioSourceSet the offset in which to start playback of this AudioSource.Default value = 0
Value is clamped between 0 and length of attached AudioBuffer
Applies only to sub-types:
- Source
- Specified by:
setOffsetin interfaceAudioSource- Parameters:
offset- the offset in samples marking the point to commence playback
-
getOffset
public long getOffset()
Description copied from interface:AudioSourceReturn the offset in which to start playback of this AudioSource.Default value = 0
Applies only to sub-types:
- Source
- Specified by:
getOffsetin interfaceAudioSource- Returns:
- the offset in samples marking the point to commence playback
-
setMaximumDistance
public void setMaximumDistance(float maximumDistance)
Description copied from interface:AudioSourceSet the current maximum distance setting.Default value = Audio.MAX_DISTANCE
The maximum distance is that where the volume of the sound would normally be zero.
Applies only to sub-types:
- Source
- Specified by:
setMaximumDistancein interfaceAudioSource- Parameters:
maximumDistance- maximum distance of this source
-
getMaximumDistance
public float getMaximumDistance()
Description copied from interface:AudioSourceReturn the current maximum distance setting.Default value = Audio.MAX_DISTANCE
The maximum distance is that where the volume of the sound would normally be zero.
Applies only to sub-types:
- Source
- Specified by:
getMaximumDistancein interfaceAudioSource- Returns:
- the maximum distance
-
setRollOffFactor
public void setRollOffFactor(float rollOffFactor)
Description copied from interface:AudioSourceSet the roll-off factor of this AudioSource object.Default value = 1.0f
Applies only to sub-types:
- Source
- Specified by:
setRollOffFactorin interfaceAudioSource- Parameters:
rollOffFactor- roll-off factor
-
getRollOffFactor
public float getRollOffFactor()
Description copied from interface:AudioSourceGet the roll-off factor of this AudioSource object.Default value = 1.0f
Applies only to sub-types:
- Source
- Specified by:
getRollOffFactorin interfaceAudioSource- Returns:
- the roll-off factor
-
setLooped
public void setLooped(boolean loop)
Description copied from interface:AudioSourceSets this AudioSource object to loop infinitely or not.When loop == false, sets the min and max number of loops to zero.
Applies only to sub-types:
- Source
- Specified by:
setLoopedin interfaceAudioSource- Parameters:
loop- infinite loop setting
-
isLooped
public boolean isLooped()
Description copied from interface:AudioSourceCheck if this AudioSource object will loop or not.Applies only to sub-types:
- Source
- Specified by:
isLoopedin interfaceAudioSource- Returns:
- boolean loop
-
setMinLoops
public void setMinLoops(int loops)
Description copied from interface:AudioSourceThe minimum number of times that this AudioSource should loop.When set to 1, the sound will loop once (i.e. play through twice).
When set to LOOP_CONTINUOUS, determines that this AudioSource object should loop indefinitely until explicitly stopped.
Default value = 0
Applies only to sub-types:
- Source
- Specified by:
setMinLoopsin interfaceAudioSource- Parameters:
loops- minimum number of loops
-
getMinLoops
public int getMinLoops()
Description copied from interface:AudioSourceReturns the minimum number of times that this AudioSource will loop, or LOOP_CONTINUOUS for infinite looping.Default value = 0
Applies only to sub-types:
- Source
- Specified by:
getMinLoopsin interfaceAudioSource- Returns:
- number of loops
-
setMaxLoops
public void setMaxLoops(int loops)
Description copied from interface:AudioSourceThe maximum number of times that this AudioSource should loop.When set to 1, the sound will loop once (i.e. play through twice).
When set to LOOP_CONTINUOUS, determines that this AudioSource object should loop indefinitely until explicitly stopped.
Default value = 0
Applies only to sub-types:
- Source
- Specified by:
setMaxLoopsin interfaceAudioSource- Parameters:
loops- maximum number of loops
-
calculateLoops
protected void calculateLoops()
Calculate the number of times to loop playback of this sound.
-
getMaxLoops
public int getMaxLoops()
Description copied from interface:AudioSourceReturns the maximum number of times that this AudioSource will loop, or LOOP_CONTINUOUS for infinite looping.Default value = 0
Applies only to sub-types:
- Source
- Specified by:
getMaxLoopsin interfaceAudioSource- Returns:
- maximum number of loops
-
getNumLoops
public int getNumLoops()
Description copied from interface:AudioSourceThe number of times that this AudioSource should loop, or LOOP_CONTINUOUS for infinite looping.When the minimum and maximum number of loops are different, each call to this method will return a different random number that lies between the two settings:
minimum <= number of loops <= maximum
Default value = 0Applies only to sub-types:
- Source
- Specified by:
getNumLoopsin interfaceAudioSource- Returns:
- number of loops
-
getLastNumLoops
public int getLastNumLoops()
Description copied from interface:AudioSourceGet the last value returned byAudioSource.getNumLoops()- Specified by:
getLastNumLoopsin interfaceAudioSource- Returns:
- the number of loops
-
setFadeIn
public void setFadeIn(int fadeInTime)
Description copied from interface:AudioSourceSet the length of time in milliseconds to fade this source inDefault value = 1000
Applies only to sub-types:
- Source
- Specified by:
setFadeInin interfaceAudioSource- Parameters:
fadeInTime- fade-in time in milliseconds
-
getFadeIn
public int getFadeIn()
Description copied from interface:AudioSourceRetrieve the length of time in milliseconds to fade this source inDefault value = 1000
Applies only to sub-types:
- Source
- Specified by:
getFadeInin interfaceAudioSource- Returns:
- fade-in time in milliseconds
-
setFadeOut
public void setFadeOut(int fadeOutTime)
Description copied from interface:AudioSourceSet the length of time in milliseconds to fade this source inDefault value = 1000
Applies only to sub-types:
- Source
- Specified by:
setFadeOutin interfaceAudioSource- Parameters:
fadeOutTime- fade-out time in milliseconds
-
getFadeOut
public int getFadeOut()
Description copied from interface:AudioSourceRetrieve the length of time in milliseconds to fade this source inDefault value = 1000
Applies only to sub-types:
- Source
- Specified by:
getFadeOutin interfaceAudioSource- Returns:
- fade-in time in milliseconds
-
getFadeGain
protected float getFadeGain()
Used to return the current calculated fade gain for this AudioSource.- Returns:
- current fade gain
-
calculateFades
protected void calculateFades()
Calculate the fade gains.
-
queueAudioBuffers
public boolean queueAudioBuffers(java.util.Queue<AudioBuffer> audioBuffers)
-
queueAudioBuffer
public boolean queueAudioBuffer(AudioBuffer audioBuffer)
-
unqueueAudioBuffers
public boolean unqueueAudioBuffers()
-
numQueuedBuffers
public int numQueuedBuffers()
- Specified by:
numQueuedBuffersin interfaceAudioSource
-
numProcessedBuffers
public int numProcessedBuffers()
- Specified by:
numProcessedBuffersin interfaceAudioSource
-
bindAudioBuffer
abstract boolean bindAudioBuffer(AudioBuffer buffer)
Binds this AudioSource with the specified AudioBuffer.Applies only to sub-types:
- Source
- Parameters:
buffer- The AudioBuffer to bind to this AudioSource- Returns:
- true if successful
-
setBound
protected void setBound(boolean bound)
Method to define if this AudioSource has been bound to an AudioBuffer.- Parameters:
bound- True if bound to an AudioBufferr
-
setQueued
protected void setQueued(boolean queued)
-
isBound
public boolean isBound()
Description copied from interface:AudioSourceMethod to return if this AudioSource has been bound to an AudioBufferApplies only to sub-types:
- Source
- Specified by:
isBoundin interfaceAudioSource- Returns:
- True if bound to an AudioBuffer
-
isQueued
public boolean isQueued()
Description copied from interface:AudioSourceMethod to return if this AudioSource has AudioBuffers queued to itApplies only to sub-types:
- Source
- Specified by:
isQueuedin interfaceAudioSource- Returns:
- True if AudioBuffers are queued.
-
stateChanged
public void stateChanged(int oldState)
Description copied from interface:AudioMethod used to update the current state of the Audio object- Specified by:
stateChangedin interfaceAudio- Parameters:
oldState- the former state
-
play
public void play()
Description copied from interface:AudioSourceMethod to start playing this AudioSource ObjectIf this AudioSource is already playing, this command is ignored.
Applies only to sub-types:
- Source
- Specified by:
playin interfaceAudioSource
-
doPlay
protected abstract void doPlay()
Play the clip from the beginning. If looped, start looping.
-
stop
public void stop()
Description copied from interface:AudioSourceMethod to stop playing this AudioSource ObjectApplies only to sub-types:
- Source
- Specified by:
stopin interfaceAudioSource
-
doStop
protected abstract void doStop()
Stop playing the clip and rewind to the beginning.
-
togglePlay
public void togglePlay()
Description copied from interface:AudioSourceMethod to toggle playback of this AudioSource Object reseting positionApplies only to sub-types:
- Source
- Specified by:
togglePlayin interfaceAudioSource
-
doTogglePlay
protected void doTogglePlay()
Toggle the current playing status. Will always start at/return to the beginning of the sample.
-
pause
public void pause()
Description copied from interface:AudioSourceMethod to pause playing this AudioSource ObjectApplies only to sub-types:
- Source
- Specified by:
pausein interfaceAudioSource
-
doPause
protected abstract void doPause()
Stop playing the clip but retain the current position.
-
resume
public void resume()
Description copied from interface:AudioSourceMethod to resume playing this AudioSource ObjectApplies only to sub-types:
- Source
- Specified by:
resumein interfaceAudioSource
-
doResume
protected abstract void doResume()
Play the clip from the current position.
-
togglePause
public void togglePause()
Description copied from interface:AudioSourceMethod to toggle playback of this AudioSource Object retaining postitionApplies only to sub-types:
- Source
- Specified by:
togglePausein interfaceAudioSource
-
doTogglePause
protected void doTogglePause()
Toggle the current playing status. Will retain the playback position of the sample.
-
rewind
public void rewind()
Description copied from interface:AudioSourceMethod to rewind this AudioSource ObjectApplies only to sub-types:
- Source
- Specified by:
rewindin interfaceAudioSource
-
doRewind
protected abstract void doRewind()
Rewind clip to the beginning.
-
fadeIn
public void fadeIn()
Description copied from interface:AudioSourceMethod to fade in and then play this AudioSource ObjectApplies only to sub-types:
- Source
- Specified by:
fadeInin interfaceAudioSource
-
doFadeIn
protected abstract void doFadeIn()
Fade in then play this AudioSource.
-
fadeOut
public void fadeOut()
Description copied from interface:AudioSourceMethod to fade out and then stop this AudioSource Object only when it is already playing.If not playing, command is ignored.
Applies only to sub-types:
- Source
- Specified by:
fadeOutin interfaceAudioSource
-
doFadeOut
protected abstract void doFadeOut()
Fade out then stop this AudioSource.
-
getFading
protected int getFading()
Get the current fading status.- Returns:
- fading status
-
attachSourcesToEffects
public int attachSourcesToEffects()
Description copied from interface:AudioSourceMethod to attach sources to effects- Specified by:
attachSourcesToEffectsin interfaceAudioSource- Returns:
- a number code
-
detachSourcesToEffects
public int detachSourcesToEffects()
Description copied from interface:AudioSourceMethod to detach sources to effects- Specified by:
detachSourcesToEffectsin interfaceAudioSource- Returns:
- a number code
-
getDebugString
@Nonnull public java.lang.String getDebugString()
Description copied from interface:AudioSourceGet debug info about this audio source. AbstractAudioSource overrides this to get more debug info. It was previously the method toString().- Specified by:
getDebugStringin interfaceAudioSource- Returns:
- a string with debug info or the result of the method toString()
-
-