Package jmri.jmrit.vsdecoder
Class VSDecoder
java.lang.Object
jmri.jmrit.vsdecoder.VSDecoder
- All Implemented Interfaces:
PropertyChangeListener,EventListener
Implements a software "decoder" that responds to throttle inputs and
generates sounds in responds to them.
This file is part of JMRI.
Each VSDecoder implements exactly one Sound Profile (describes a particular type of locomotive, say, an EMD GP7).
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.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int(package private) double(package private) float(package private) double(package private) LinkedHashMap<String,SoundEvent> (package private) boolean(package private) boolean(package private) PhysicalLocation(package private) LayoutTrack(package private) PhysicalLocation(package private) int(package private) PhysicalLocation(package private) int(package private) int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voiddisable()Disable this VSDecoder.(package private) voidenable()Enable this VSDecoder.Get the currently assigned LocoAddressfloatGet the current decoder volume setting for this VSDecoder(package private) double(package private) doubleGet a reference to the EngineSound associated with this VSDecoderGet a Collection of SoundEvents associated with this VSDecodergetId()Get the ID (System Name) of this VSDecoder(package private) LayoutTrack(package private) LayoutTrack(package private) Point2D(package private) LayoutEditorGet the current x/y/z position in the soundspace of this VSDecoderget the currently selected profile name(package private) double(package private) LayoutTrack(package private) LayoutTrackRetrieve the VSDSound with the given system nameprotected PhysicalLocationGet the physical location of the given Operations TrainGet the current VSD File path for this VSDecoderorg.jdom2.ElementgetXml()Get an XML representation of this VSDecoder Includes a subtree of Elements for all of the associated SoundEvents, Triggers, VSDSounds, etc.(package private) booleanbooleanCheck whether this VSDecoder has completed initializationbooleanisMuted()Is this VSDecoder muted?voidmute(boolean m) Mute or un-mute this VSDecoder(package private) voidnavigate()voidRespond to property change events from this VSDecoder's GUIvoidSet this VSDecoder's LocoAddress, and register to follow events from the throttle with this address.voidsetDecoderVolume(float decoder_volume) Set the decoder volume for this VSDecoder(package private) voidsetDirectionDEG(double directionDEG) (package private) voidsetDirectionRAD(double directionRAD) (package private) voidsetDistance(double distance) (package private) voidsetLastTrack(LayoutTrack lastTrack) (package private) voidsetLayoutTrack(LayoutTrack layoutTrack) (package private) voidsetLocation(Point2D location) (package private) voidsetModels(LayoutEditor models) voidset the x/y/z position in the soundspace of this VSDecoder Translates the given position to a position relative to the listener for the component VSDSounds.voidsetProfileName(String pn) Set the profile name to the given string(package private) voidsetReturnDistance(double returnDistance) (package private) voidsetReturnLastTrack(LayoutTrack returnLastTrack) (package private) voidsetReturnTrack(LayoutTrack returnTrack) (package private) voidsetTunnelState(boolean t) voidSet the VSD File path for this VSDecoder to usevoidBuild this VSDecoder from an XML representationvoidshutdown()Shut down this VSDecoder and all of its associated sounds.protected voidHandle the details of responding to a PropertyChangeEvent from a throttle.
-
Field Details
-
initialized
boolean initialized -
dirfn
int dirfn -
posToSet
-
lastPos
-
startPos
-
topspeed
int topspeed -
topspeed_rev
int topspeed_rev -
setup_index
int setup_index -
is_muted
boolean is_muted -
distanceOnTrack
double distanceOnTrack -
distanceMeter
float distanceMeter -
distance
double distance -
nextLayoutTrack
-
sound_list
-
event_list
-
-
Constructor Details
-
VSDecoder
Construct a VSDecoder with the given system name (id) and configuration (config)- Parameters:
cfg- (VSDConfig) Configuration
-
VSDecoder
Construct a VSDecoder with the given system name (id), profile name and VSD file path- Parameters:
id- (String) System name for this VSDecodername- (String) Profile namepath- (String) Path to a VSD file to pull the given Profile from
-
-
Method Details
-
getId
Get the ID (System Name) of this VSDecoder- Returns:
- (String) system name of this VSDecoder
-
isInitialized
Check whether this VSDecoder has completed initialization- Returns:
- (boolean) true if initialization is complete.
-
setVSDFilePath
Set the VSD File path for this VSDecoder to use- Parameters:
p- (String) path to VSD File
-
getVSDFilePath
Get the current VSD File path for this VSDecoder- Returns:
- (String) path to VSD file
-
shutdown
Shut down this VSDecoder and all of its associated sounds. -
throttlePropertyChange
Handle the details of responding to a PropertyChangeEvent from a throttle.- Parameters:
event- (PropertyChangeEvent) Throttle event to respond to
-
setAddress
Set this VSDecoder's LocoAddress, and register to follow events from the throttle with this address.- Parameters:
l- (LocoAddress) LocoAddress to be followed
-
getAddress
Get the currently assigned LocoAddress- Returns:
- the currently assigned LocoAddress
-
getRosterEntry
-
getDecoderVolume
Get the current decoder volume setting for this VSDecoder- Returns:
- (float) volume level (0.0 - 1.0)
-
setDecoderVolume
Set the decoder volume for this VSDecoder- Parameters:
decoder_volume- (float) volume level (0.0 - 1.0)
-
isMuted
Is this VSDecoder muted?- Returns:
- true if muted
-
mute
Mute or un-mute this VSDecoder- Parameters:
m- (boolean) true to mute, false to un-mute
-
setPosition
set the x/y/z position in the soundspace of this VSDecoder Translates the given position to a position relative to the listener for the component VSDSounds.The idea is that the user-preference Listener Position (relative to the USER's chosen origin) is always the OpenAL Context's origin.
- Parameters:
p- (PhysicalLocation) location relative to the user's chosen Origin.
-
setTunnelState
-
getPosition
Get the current x/y/z position in the soundspace of this VSDecoder- Returns:
- PhysicalLocation location of this VSDecoder
-
propertyChange
Respond to property change events from this VSDecoder's GUI- Specified by:
propertyChangein interfacePropertyChangeListener- Parameters:
evt- (PropertyChangeEvent) event to respond to
-
getTrainPosition
Get the physical location of the given Operations Train- Parameters:
t- (Train) the Train to interrogate- Returns:
- PhysicalLocation location of the train
-
getSound
Retrieve the VSDSound with the given system name- Parameters:
name- (String) System name of the requested VSDSound- Returns:
- VSDSound the requested sound
-
setProfileName
Set the profile name to the given string- Parameters:
pn- (String) : name of the profile to set
-
getProfileName
get the currently selected profile name- Returns:
- (String) name of the currently selected profile
-
enable
void enable()Enable this VSDecoder. -
disable
void disable()Disable this VSDecoder. -
isEnabled
boolean isEnabled() -
getEngineSound
Get a reference to the EngineSound associated with this VSDecoder- Returns:
- EngineSound The EngineSound reference for this VSDecoder or null
-
getEventList
Get a Collection of SoundEvents associated with this VSDecoder- Returns:
- Collection<SoundEvent> collection of SoundEvents
-
getXml
Get an XML representation of this VSDecoder Includes a subtree of Elements for all of the associated SoundEvents, Triggers, VSDSounds, etc.- Returns:
- Element XML Element for this VSDecoder
-
setXml
Build this VSDecoder from an XML representation- Parameters:
vf- (VSDFile) : VSD File to pull the XML frompn- (String) : Parameter Name to find within the VSD File.
-
setLocation
-
getLocation
-
getLastTrack
-
setLastTrack
-
setLayoutTrack
-
getLayoutTrack
-
setReturnTrack
-
getReturnTrack
-
setReturnLastTrack
-
getReturnLastTrack
-
getDistance
double getDistance() -
setDistance
-
getReturnDistance
double getReturnDistance() -
setReturnDistance
-
getDirectionRAD
double getDirectionRAD() -
setDirectionRAD
-
setDirectionDEG
-
getModels
-
setModels
-