Class JavaSoundAudioFactory
- java.lang.Object
-
- jmri.jmrit.audio.AbstractAudioFactory
-
- jmri.jmrit.audio.JavaSoundAudioFactory
-
- All Implemented Interfaces:
AudioFactory
public class JavaSoundAudioFactory extends AbstractAudioFactory
This is the JavaSound audio system specific AudioFactory.The JavaSound sound system supports, where available, 2-channel stereo.
The implemented Audio objects provide an approximation of a 3D positionable audio model through the use of calculated panning and gain based on the 3D position of the individual sound sources.
This factory initialises JavaSound, provides new JavaSound-specific Audio objects and deals with clean-up operations.
For more information about the JavaSound API, visit http://java.sun.com/products/java-media/sound/
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.
-
-
Constructor Summary
Constructors Constructor Description JavaSoundAudioFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()Perform any implementation specific clean-up operations.AudioBuffercreateNewBuffer(java.lang.String systemName, java.lang.String userName)Provide a specific new AudioBuffer object.AudioListenercreateNewListener(java.lang.String systemName, java.lang.String userName)Provide a specific new AudioListener object.AudioSourcecreateNewSource(java.lang.String systemName, java.lang.String userName)Provide a specific new AudioSource object.AudioListenergetActiveAudioListener()Get the currently active Listener object.static javax.sound.sampled.MixergetMixer()Return reference to the current JavaSound mixer object.booleaninit()Perform any implementation specific initialisation routines.booleanisInitialised()Determine if this AudioFactory is initialisedjava.lang.StringtoString()-
Methods inherited from class jmri.jmrit.audio.AbstractAudioFactory
audioCommandQueue, getCommandThread, isDistanceAttenuated, setDistanceAttenuated
-
-
-
-
Constructor Detail
-
JavaSoundAudioFactory
public JavaSoundAudioFactory()
-
-
Method Detail
-
init
public boolean init()
Description copied from interface:AudioFactoryPerform any implementation specific initialisation routines.- Specified by:
initin interfaceAudioFactory- Overrides:
initin classAbstractAudioFactory- Returns:
- true, if initialisation successful
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
cleanup
public void cleanup()
Description copied from interface:AudioFactoryPerform any implementation specific clean-up operations.- Specified by:
cleanupin interfaceAudioFactory- Overrides:
cleanupin classAbstractAudioFactory
-
isInitialised
public boolean isInitialised()
Description copied from interface:AudioFactoryDetermine if this AudioFactory is initialised- Returns:
- true if initialised
-
createNewBuffer
public AudioBuffer createNewBuffer(java.lang.String systemName, java.lang.String userName)
Description copied from interface:AudioFactoryProvide a specific new AudioBuffer object.- Parameters:
systemName- for this object instanceuserName- for this object instance- Returns:
- a new specific AudioBuffer
-
createNewListener
public AudioListener createNewListener(java.lang.String systemName, java.lang.String userName)
Description copied from interface:AudioFactoryProvide a specific new AudioListener object.- Parameters:
systemName- for this object instanceuserName- for this object instance- Returns:
- a new specific AudioListener
-
getActiveAudioListener
public AudioListener getActiveAudioListener()
Description copied from interface:AudioFactoryGet the currently active Listener object.- Returns:
- active AudioListener
-
createNewSource
public AudioSource createNewSource(java.lang.String systemName, java.lang.String userName)
Description copied from interface:AudioFactoryProvide a specific new AudioSource object.- Parameters:
systemName- for this object instanceuserName- for this object instance- Returns:
- a new specific AudioSource
-
getMixer
public static javax.sound.sampled.Mixer getMixer()
Return reference to the current JavaSound mixer object.- Returns:
- current JavaSound mixer
-
-