|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface AudioSource
Represent an AudioSource, a place to store or control sound information.
The AbstractAudio class contains a basic implementation of the state and messaging code, and forms a useful start for a system-specific implementation. Specific implementations in the jmrix package, e.g. for LocoNet and NCE, will convert to and from the layout commands.
The states and names are Java Bean parameters, so that listeners can be registered to be notified of any changes.
Each AudioSource object has a two names. The "user" name is entirely free form, and can be used for any purpose. The "system" name is provided by the system-specific implementations, and provides a unique mapping to the layout control system (e.g. LocoNet, NCE, etc) and address within that system.
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.
| Field Summary | |
|---|---|
static int |
LOOP_CONTINUOUS
Constant to define that this source should loop continously when played |
static int |
LOOP_NONE
Constant to define that this source should not loop when played |
| 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_RESET_POSITION, CMD_RESUME, CMD_REWIND, CMD_STOP, 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.NamedBean |
|---|
INCONSISTENT, UNKNOWN |
| Method Summary | |
|---|---|
void |
fadeIn()
Method to fade in and then play this AudioSource Object Applies only to sub-types: Source |
void |
fadeOut()
Method to fade out and then stop this AudioSource Object only when it is already playing. |
AudioBuffer |
getAssignedBuffer()
Returns linked AudioBuffer object Applies only to sub-types: Source |
String |
getAssignedBufferName()
Return system name of linked AudioBuffer object Applies only to sub-types: Source |
Vector3f |
getCurrentPosition()
Returns the current position of this AudioSource object as a 3-dimensional vector. |
float |
getDopplerFactor()
Deprecated. |
int |
getFadeIn()
Retrieve the length of time in milliseconds to fade this source in Default value = 1000 Applies only to sub-types: Source |
int |
getFadeOut()
Retrieve the length of time in milliseconds to fade this source in Default value = 1000 Applies only to sub-types: Source |
float |
getGain()
Return the currently stored gain setting Default value = 1.0f Applies only to sub-types: Listener Source |
float |
getMaximumDistance()
Return 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. |
int |
getMaxLoops()
Returns the maximum number of times that this AudioSource will loop, or LOOP_CONTINUOUS for infinite looping. |
int |
getMinLoops()
Returns the minimum number of times that this AudioSource will loop, or LOOP_CONTINUOUS for infinite looping. |
int |
getNumLoops()
The number of times that this AudioSource should loop, or LOOP_CONTINUOUS for infinite looping. |
float |
getPitch()
Return the current pitch setting Values are restricted from 0.5f to 2.0f, i.e. half to double Default value = 1.0f Applies only to sub-types: Source |
Vector3f |
getPosition()
Returns the position of this AudioSource object as a 3-dimensional vector. |
float |
getReferenceDistance()
Return the current reference distance setting Default value = 1.0f Applies only to sub-types: Source |
float |
getRollOffFactor()
Return the roll-off factor of this AudioSource object Default value = 1.0f Applies only to sub-types: Source |
Vector3f |
getVelocity()
Returns the velocity of this AudioSource object Applies only to sub-types: Listener Source |
boolean |
isBound()
Method to return if this AudioSource has been bound to an AudioBuffer Applies only to sub-types: Source |
boolean |
isLooped()
Returns a boolean if this AudioSource object will loop or not Applies only to sub-types: Source |
boolean |
isPositionRelative()
Returns a boolean value that determines if the position of this AudioSource object is relative to the position of the AudioListener object or absolute. |
void |
pause()
Method to pause playing this AudioSource Object Applies only to sub-types: Source |
void |
play()
Method to start playing this AudioSource Object If this AudioSource is already playing, this command is ignored. |
void |
resetCurrentPosition()
Method to reset the current position of this AudioSource object to the initial position as defined by setPosition. |
void |
resume()
Method to resume playing this AudioSource Object Applies only to sub-types: Source |
void |
rewind()
Method to rewind this AudioSource Object Applies only to sub-types: Source |
void |
setAssignedBuffer(AudioBuffer audioBuffer)
Sets the linked AudioBuffer object Applies only to sub-types: Source |
void |
setAssignedBuffer(String sysName)
Sets the system name of the linked AudioBuffer object Applies only to sub-types: Source |
void |
setDopplerFactor(float dopplerFactor)
Deprecated. |
void |
setFadeIn(int fadeInTime)
Set the length of time in milliseconds to fade this source in Default value = 1000 Applies only to sub-types: Source |
void |
setFadeOut(int fadeOutTime)
Set the length of time in milliseconds to fade this source in Default value = 1000 Applies only to sub-types: Source |
void |
setGain(float gain)
Set the gain of this AudioSource object Default value = 1.0f Applies only to sub-types: Listener Source |
void |
setLooped(boolean loop)
Sets this AudioSource object to loop infinitely or not. |
void |
setMaximumDistance(float maximumDistance)
Set 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. |
void |
setMaxLoops(int loops)
The maximum number of times that this AudioSource should loop. |
void |
setMinLoops(int loops)
The minimum number of times that this AudioSource should loop. |
void |
setPitch(float pitch)
Set the pitch of this AudioSource object Values are restricted from 0.5f to 2.0f, i.e. half to double Default value = 1.0f Applies only to sub-types: Source |
void |
setPosition(float x,
float y)
Sets the position of this AudioSource object in x and y planes with z plane position fixed at zero Equivalent to setPosition(x, y, 0.0f) Applies only to sub-types: Listener Source |
void |
setPosition(float x,
float y,
float z)
Sets the position of this AudioSource object in x, y and z planes Applies only to sub-types: Listener Source |
void |
setPosition(Vector3f pos)
Sets the position of this AudioSource object Applies only to sub-types: Listener Source |
void |
setPositionRelative(boolean relative)
Sets the position of this AudioSource object to be relative to the position of the AudioListener object or absolute. |
void |
setReferenceDistance(float referenceDistance)
Set the reference distance of this AudioSource object. |
void |
setRollOffFactor(float rollOffFactor)
Set the roll-off factor of this AudioSource object Default value = 1.0f Applies only to sub-types: Source |
void |
setVelocity(Vector3f vel)
Sets the velocity of this AudioSource object Applies only to sub-types: Listener Source |
void |
stop()
Method to stop playing this AudioSource Object Applies only to sub-types: Source |
void |
togglePause()
Method to toggle playback of this AudioSource Object retaining postition Applies only to sub-types: Source |
void |
togglePlay()
Method to toggle playback of this AudioSource Object reseting position Applies only to sub-types: Source |
| Methods inherited from interface jmri.Audio |
|---|
getSubType, stateChanged |
| Field Detail |
|---|
static final int LOOP_CONTINUOUS
static final int LOOP_NONE
| Method Detail |
|---|
void setPosition(Vector3f pos)
Applies only to sub-types:
pos - 3d position vector
void setPosition(float x,
float y,
float z)
Applies only to sub-types:
x - x-coordinatey - y-coordinatez - z-coordinate
void setPosition(float x,
float y)
Equivalent to setPosition(x, y, 0.0f)
Applies only to sub-types:
x - x-coordinatey - y-coordinateVector3f getPosition()
Applies only to sub-types:
Vector3f getCurrentPosition()
Applies only to sub-types:
void resetCurrentPosition()
Applies only to sub-types:
void setPositionRelative(boolean relative)
Applies only to sub-types:
relative - position relative or absoluteboolean isPositionRelative()
Applies only to sub-types:
void setVelocity(Vector3f vel)
Applies only to sub-types:
vel - 3d velocity vectorVector3f getVelocity()
Applies only to sub-types:
AudioBuffer getAssignedBuffer()
Applies only to sub-types:
String getAssignedBufferName()
Applies only to sub-types:
void setAssignedBuffer(AudioBuffer audioBuffer)
Applies only to sub-types:
audioBuffer - the AudioBuffer object to bind to this AudioSourcevoid setAssignedBuffer(String sysName)
Applies only to sub-types:
sysName - the SystemName of the AudioBuffer (i.e. IAB1) to bind
to this AudioSourceboolean isBound()
Applies only to sub-types:
float getGain()
Default value = 1.0f
Applies only to sub-types:
void setGain(float gain)
Default value = 1.0f
Applies only to sub-types:
gain - the gain of this AudioSourcefloat getPitch()
Values are restricted from 0.5f to 2.0f, i.e. half to double
Default value = 1.0f
Applies only to sub-types:
void setPitch(float pitch)
Values are restricted from 0.5f to 2.0f, i.e. half to double
Default value = 1.0f
Applies only to sub-types:
pitch - the pitch of this AudioSourcefloat getReferenceDistance()
Default value = 1.0f
Applies only to sub-types:
void setReferenceDistance(float referenceDistance)
Default value = 1.0f
The Reference Distance is one of the main parameters you have for controlling the way that sounds attenutate 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:
referenceDistance - the Reference Distance for this AudioSourcefloat getMaximumDistance()
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:
void setMaximumDistance(float maximumDistance)
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:
maximumDistance - maximum distance of this sourcevoid setRollOffFactor(float rollOffFactor)
Default value = 1.0f
Applies only to sub-types:
rollOffFactor - roll-off factorfloat getRollOffFactor()
Default value = 1.0f
Applies only to sub-types:
boolean isLooped()
Applies only to sub-types:
void setLooped(boolean loop)
When loop == false, sets the min and max number of loops to zero.
Applies only to sub-types:
loop - infinite loop settingint getMinLoops()
Default value = 0
Applies only to sub-types:
void setMinLoops(int loops)
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:
loops - minimum number of loopsint getMaxLoops()
Default value = 0
Applies only to sub-types:
void setMaxLoops(int loops)
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:
loops - maximum number of loopsint getNumLoops()
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 <= maximumDefault value = 0
Applies only to sub-types:
void setFadeIn(int fadeInTime)
Default value = 1000
Applies only to sub-types:
fadeInTime - fade-in time in millisecondsint getFadeIn()
Default value = 1000
Applies only to sub-types:
void setFadeOut(int fadeOutTime)
Default value = 1000
Applies only to sub-types:
fadeOutTime - fade-out time in millisecondsint getFadeOut()
Default value = 1000
Applies only to sub-types:
@Deprecated void setDopplerFactor(float dopplerFactor)
Default value = 1.0f
Only calculated for JoalAudioSources
Applies only to sub-types:
dopplerFactor - factor to apply in doppler calculations@Deprecated float getDopplerFactor()
Default value = 1.0f
Only calculated for JoalAudioSources
Applies only to sub-types:
void play()
If this AudioSource is already playing, this command is ignored.
Applies only to sub-types:
void stop()
Applies only to sub-types:
void togglePlay()
Applies only to sub-types:
void pause()
Applies only to sub-types:
void resume()
Applies only to sub-types:
void togglePause()
Applies only to sub-types:
void rewind()
Applies only to sub-types:
void fadeIn()
Applies only to sub-types:
void fadeOut()
If not playing, command is ignored.
Applies only to sub-types:
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||