Interface AudioManager
- All Superinterfaces:
Manager<Audio>,PropertyChangeProvider,SilenceablePropertyChangeProvider,VetoableChangeProvider
- All Known Subinterfaces:
AudioSourceManager
- All Known Implementing Classes:
AbstractAudioManager,DefaultAudioManager,DefaultAudioSourceManager
Audio objects are obtained from an AudioManager, which in turn is generally located from the InstanceManager. A typical call sequence might be:
Audio audio = InstanceManager.getDefault(jmri.AudioManager.class).provideAudio("myAudio");
Each Audio has 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, if any, and provides a unique mapping to the layout control system (for example LocoNet or NCE) and address within that system. Note that most (all?) layout systems don't have anything corresponding to this, in which case the "Internal" Audio objects are still available with names like IAS23.
Much of the book-keeping is implemented in the AbstractAudioManager class, which can form the basis for a system-specific implementation.
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/interfaces inherited from interface jmri.Manager
Manager.ManagerDataEvent<E extends NamedBean>, Manager.ManagerDataListener<E extends NamedBean>, Manager.NameValidity -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefine the maximum number of AudioBuffer objects that can be createdstatic final intDefine the maximum number of AudioListener objects that can be createdstatic final intDefine the maximum number of AudioSource objects that can be createdFields inherited from interface jmri.Manager
ANALOGIOS, AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, CTCDATA, ENTRYEXIT, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXNG_ANALOG_ACTIONS, LOGIXNG_ANALOG_EXPRESSIONS, LOGIXNG_CONDITIONALNGS, LOGIXNG_DIGITAL_ACTIONS, LOGIXNG_DIGITAL_BOOLEAN_ACTIONS, LOGIXNG_DIGITAL_EXPRESSIONS, LOGIXNG_GLOBAL_VARIABLES, LOGIXNG_MODULES, LOGIXNG_STRING_ACTIONS, LOGIXNG_STRING_EXPRESSIONS, LOGIXNG_TABLES, LOGIXNGS, LOGIXS, MEMORIES, METERFRAMES, METERS, OBLOCKS, PANELFILES, PROPERTY_BEANS, PROPERTY_CAN_DELETE, PROPERTY_DISPLAY_LIST_NAME, PROPERTY_DO_DELETE, PROPERTY_DO_NOT_DELETE, PROPERTY_LENGTH, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, STRINGIOS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Perform any clean-up operationsReturns the currently active AudioFactory object.Get an existing Audio or return null if it doesn't exists.getBySystemName(String systemName) Get the Audio with the given system name or return null if no instance already exists.getByUserName(String userName) Get the Audio with the given user name or return null if no instance already exists.getNamedBeanSet(char subType) Get the specified Audio sub-type NamedBeans.voidinit()Perform any initialisation operationsbooleanDetermine if this AudioManager is initialisedReturn an Audio with the specified system and user names.provideAudio(String name) Get the Audio with the user name, then system name if needed; if that fails, create a new Audio.Methods inherited from interface jmri.Manager
addDataListener, deleteBean, deregister, dispose, getBeanTypeHandled, getBeanTypeHandled, getEntryToolTip, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanClass, getNamedBeanSet, getObjectCount, getSubSystemNamePrefix, getSystemNamePrefix, getSystemPrefix, getXMLOrder, isValidSystemNameFormat, makeSystemName, makeSystemName, makeSystemName, register, removeDataListener, setDataListenerMute, typeLetter, validateBadCharsInSystemNameFormat, validateIntegerSystemNameFormat, validateNmraAccessorySystemNameFormat, validateSystemNameFormat, validateSystemNameFormat, validateSystemNameFormatOnlyNumeric, validateSystemNamePrefix, validateTrimmedMin1NumberSystemNameFormat, validateTrimmedSystemNameFormat, validateUppercaseTrimmedSystemNameFormat, validSystemNameFormatMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from interface jmri.beans.SilenceablePropertyChangeProvider
setPropertyChangesSilencedMethods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Field Details
-
MAX_LISTENERS
Define the maximum number of AudioListener objects that can be created- See Also:
-
MAX_SOURCES
Define the maximum number of AudioSource objects that can be created- See Also:
-
MAX_BUFFERS
Define the maximum number of AudioBuffer objects that can be created- See Also:
-
-
Method Details
-
provideAudio
Get the Audio with the user name, then system name if needed; if that fails, create a new Audio. If the name is a valid system name, it will be used for the new Audio. Otherwise, the makeSystemName method will attempt to turn it into a valid system name.- Parameters:
name- User name or system name to match, or which can be promoted to system name- Returns:
- Never null under normal circumstances
- Throws:
AudioException- if error occurs during creation
-
getAudio
Get an existing Audio or return null if it doesn't exists. Locates via user name, then system name if needed.- Parameters:
name- User name or system name to match- Returns:
- null if no match found
-
getBySystemName
Get the Audio with the given system name or return null if no instance already exists.- Specified by:
getBySystemNamein interfaceManager<Audio>- Parameters:
systemName- Audio object system name (such as IAS1 or IAB4)- Returns:
- requested Audio object or null if none exists
-
getByUserName
Get the Audio with the given user name or return null if no instance already exists.- Specified by:
getByUserNamein interfaceManager<Audio>- Parameters:
userName- Audio object user name- Returns:
- requested Audio object or null if none exists
-
newAudio
Return an Audio with the specified system and user names. Note that two calls with the same arguments will get the same instance; there is only one Audio object representing a given physical Audio and therefore only one with a specific system or user name.This will always return a valid object reference; a new object will be created if necessary. In that case:
- If a null reference is given for user name, no user name will be associated with the Audio object created; a valid system name must be provided
- If both names are provided, the system name defines the hardware access of the desired Audio, and the user address is associated with it. The system name must be valid.
- Parameters:
systemName- Audio object system name (such as IAS1 or IAB4)userName- Audio object user name- Returns:
- requested Audio object (never null)
- Throws:
AudioException- if error occurs during creation
-
getActiveAudioFactory
Returns the currently active AudioFactory object.An Audio factory is responsible for the creation of implementation specific audio objects.
- Returns:
- current active AudioFactory object
-
getNamedBeanSet
Get the specified Audio sub-type NamedBeans.- Parameters:
subType- sub-type to retrieve- Returns:
- Unmodifiable access to a SortedSet of NamedBeans for the specified Audio sub-type .
- Since:
- 4.17.6
-
init
void init()Perform any initialisation operations -
cleanup
void cleanup()Perform any clean-up operations -
isInitialised
boolean isInitialised()Determine if this AudioManager is initialised- Returns:
- true if initialised
-