Interface AudioManager
-
- All Superinterfaces:
Manager<Audio>
,PropertyChangeProvider
,SilenceablePropertyChangeProvider
,VetoableChangeProvider
- All Known Subinterfaces:
AudioSourceManager
- All Known Implementing Classes:
AbstractAudioManager
,DefaultAudioManager
,DefaultAudioSourceManager
public interface AudioManager extends Manager<Audio>
Locate an Audio object representing some specific audio information.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
Fields Modifier and Type Field Description static int
MAX_BUFFERS
Define the maximum number of AudioBuffer objects that can be createdstatic int
MAX_LISTENERS
Define the maximum number of AudioListener objects that can be createdstatic int
MAX_SOURCES
Define the maximum number of AudioSource objects that can be created-
Fields 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, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, STRINGIOS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cleanup()
Perform any clean-up operationsAudioFactory
getActiveAudioFactory()
Returns the currently active AudioFactory object.Audio
getAudio(java.lang.String name)
Get an existing Audio or return null if it doesn't exists.Audio
getBySystemName(java.lang.String systemName)
Get the Audio with the given system name or return null if no instance already exists.Audio
getByUserName(java.lang.String userName)
Get the Audio with the given user name or return null if no instance already exists.java.util.SortedSet<Audio>
getNamedBeanSet(char subType)
Get the specified Audio sub-type NamedBeans.void
init()
Perform any initialisation operationsboolean
isInitialised()
Determine if this AudioManager is initialisedAudio
newAudio(java.lang.String systemName, java.lang.String userName)
Return an Audio with the specified system and user names.Audio
provideAudio(java.lang.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, validSystemNameFormat
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface jmri.beans.SilenceablePropertyChangeProvider
setPropertyChangesSilenced
-
Methods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Field Detail
-
MAX_LISTENERS
static final int MAX_LISTENERS
Define the maximum number of AudioListener objects that can be created- See Also:
- Constant Field Values
-
MAX_SOURCES
static final int MAX_SOURCES
Define the maximum number of AudioSource objects that can be created- See Also:
- Constant Field Values
-
MAX_BUFFERS
static final int MAX_BUFFERS
Define the maximum number of AudioBuffer objects that can be created- See Also:
- Constant Field Values
-
-
Method Detail
-
provideAudio
@Nonnull Audio provideAudio(@Nonnull java.lang.String name) throws AudioException
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
@CheckForNull Audio getAudio(@Nonnull java.lang.String name)
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
@CheckForNull Audio getBySystemName(@Nonnull java.lang.String systemName)
Get the Audio with the given system name or return null if no instance already exists.- Specified by:
getBySystemName
in interfaceManager<Audio>
- Parameters:
systemName
- Audio object system name (such as IAS1 or IAB4)- Returns:
- requested Audio object or null if none exists
-
getByUserName
@CheckForNull Audio getByUserName(@Nonnull java.lang.String userName)
Get the Audio with the given user name or return null if no instance already exists.- Specified by:
getByUserName
in interfaceManager<Audio>
- Parameters:
userName
- Audio object user name- Returns:
- requested Audio object or null if none exists
-
newAudio
@Nonnull Audio newAudio(@Nonnull java.lang.String systemName, java.lang.String userName) throws AudioException
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
@CheckForNull AudioFactory 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
@Nonnull java.util.SortedSet<Audio> getNamedBeanSet(char subType)
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
-
-