public abstract class AudioSystem extends DeviceSystem
Modifier and Type | Class and Description |
---|---|
static class |
AudioSystem.DataFlow
Enumerates the different types of media data flow of
CaptureDeviceInfo2s contributed by an AudioSystem.
|
Modifier and Type | Field and Description |
---|---|
static int |
FEATURE_AGC
The constant/flag (to be) returned by
DeviceSystem.getFeatures() in order to
indicate that the respective AudioSystem supports toggling its
automatic gain control (AGC) functionality between on and off. |
static int |
FEATURE_DENOISE
The constant/flag (to be) returned by
DeviceSystem.getFeatures() in order to
indicate that the respective AudioSystem supports toggling its
denoise functionality between on and off. |
static int |
FEATURE_ECHO_CANCELLATION
The constant/flag (to be) returned by
DeviceSystem.getFeatures() in order to
indicate that the respective AudioSystem supports toggling its
echo cancellation functionality between on and off. |
static int |
FEATURE_NOTIFY_AND_PLAYBACK_DEVICES
The constant/flag (to be) returned by
DeviceSystem.getFeatures() in order to
indicate that the respective AudioSystem differentiates between
playback and notification audio devices. |
static java.lang.String |
LOCATOR_PROTOCOL_AUDIORECORD |
static java.lang.String |
LOCATOR_PROTOCOL_AUDIOSILENCE |
static java.lang.String |
LOCATOR_PROTOCOL_JAVASOUND |
static java.lang.String |
LOCATOR_PROTOCOL_MACCOREAUDIO
The protocol of the MediaLocators identifying
CaptureDeviceInfos contributed by MacCoreaudioSystem.
|
static java.lang.String |
LOCATOR_PROTOCOL_OPENSLES |
static java.lang.String |
LOCATOR_PROTOCOL_PORTAUDIO |
static java.lang.String |
LOCATOR_PROTOCOL_PULSEAUDIO |
static java.lang.String |
LOCATOR_PROTOCOL_WASAPI
The protocol of the MediaLocators identifying
CaptureDeviceInfos contributed by WASAPISystem.
|
protected static java.lang.String |
PNAME_DENOISE
The (base) name of the ConfigurationService property which
indicates whether noise suppression is to be performed for the captured
audio.
|
protected static java.lang.String |
PNAME_ECHOCANCEL
The (base) name of the ConfigurationService property which
indicates whether noise cancellation is to be performed for the captured
audio.
|
FEATURE_REINITIALIZE, LOCATOR_PROTOCOL_ANDROIDCAMERA, LOCATOR_PROTOCOL_CIVIL, LOCATOR_PROTOCOL_DIRECTSHOW, LOCATOR_PROTOCOL_IMGSTREAMING, LOCATOR_PROTOCOL_MEDIARECORDER, LOCATOR_PROTOCOL_QUICKTIME, LOCATOR_PROTOCOL_VIDEO4LINUX2, PROP_DEVICES
Modifier | Constructor and Description |
---|---|
protected |
AudioSystem(java.lang.String locatorProtocol) |
protected |
AudioSystem(java.lang.String locatorProtocol,
int features) |
Modifier and Type | Method and Description |
---|---|
javax.media.Renderer |
createRenderer()
Initializes a new Renderer instance which is to perform playback
on a device contributed by this system.
|
javax.media.Renderer |
createRenderer(boolean playback)
Initializes a new Renderer instance which is to either perform
playback on or sound a notification through a device contributed by this
system.
|
java.io.InputStream |
getAudioInputStream(java.lang.String uri)
Obtains an audio input stream from the URL provided.
|
static AudioSystem |
getAudioSystem(java.lang.String locatorProtocol) |
static AudioSystem[] |
getAudioSystems() |
CaptureDeviceInfo2 |
getDevice(AudioSystem.DataFlow dataFlow,
javax.media.MediaLocator locator)
Gets a CaptureDeviceInfo2 which has been contributed by this
AudioSystem, supports a specific flow of media data (i.e.
|
java.util.List<CaptureDeviceInfo2> |
getDevices(AudioSystem.DataFlow dataFlow)
Gets the list of devices with a specific data flow: capture, notify or
playback.
|
javax.media.format.AudioFormat |
getFormat(java.io.InputStream audioInputStream)
Returns the FMJ format of a specific InputStream providing audio
media.
|
protected java.lang.String |
getPropertyName(java.lang.String basePropertyName)
Gets the (full) name of the ConfigurationService property which
is associated with a (base) AudioSystem-specific property name.
|
CaptureDeviceInfo2 |
getSelectedDevice(AudioSystem.DataFlow dataFlow)
Gets the selected device for a specific data flow: capture, notify or
playback.
|
boolean |
isAutomaticGainControl()
Gets the indicator which determines whether automatic gain control (AGC)
is to be performed for captured audio.
|
boolean |
isDenoise()
Gets the indicator which determines whether noise suppression is to be
performed for captured audio.
|
boolean |
isEchoCancel()
Gets the indicator which determines whether echo cancellation is to be
performed for captured audio.
|
protected void |
postInitialize()
Invoked as part of the execution of
DeviceSystem.initialize() after the
execution of DeviceSystem.doInitialize() regardless of whether the latter
completed successfully. |
protected void |
postInitializeSpecificDevices(AudioSystem.DataFlow dataFlow)
Sets the device lists after the different audio systems (PortAudio,
PulseAudio, etc) have finished detecting their devices.
|
protected void |
preInitialize()
Invoked as part of the execution of
DeviceSystem.initialize() before the
execution of DeviceSystem.doInitialize() . |
(package private) void |
propertyChange(java.lang.String property,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires a new PropertyChangeEvent to the
PropertyChangeListeners registered with this
PropertyChangeNotifier in order to notify about a change in the
value of a specific property which had its old value modified to a
specific new value.
|
void |
setAutomaticGainControl(boolean automaticGainControl)
Sets the indicator which determines whether automatic gain control (AGC)
is to be performed for captured audio.
|
protected void |
setCaptureDevices(java.util.List<CaptureDeviceInfo2> captureDevices)
Sets the list of a kind of devices: capture, notify or playback.
|
void |
setDenoise(boolean denoise)
Sets the indicator which determines whether noise suppression is to be
performed for captured audio.
|
void |
setDevice(AudioSystem.DataFlow dataFlow,
CaptureDeviceInfo2 device,
boolean save)
Selects the active device.
|
void |
setEchoCancel(boolean echoCancel)
Sets the indicator which determines whether echo cancellation is to be
performed for captured audio.
|
protected void |
setPlaybackDevices(java.util.List<CaptureDeviceInfo2> playbackDevices)
Sets the list of the active devices.
|
doInitialize, filterDeviceListByLocatorProtocol, getDeviceSystems, getFeatures, getFormat, getLocatorProtocol, getMediaType, getRendererClassName, initialize, initializeDeviceSystems, initializeDeviceSystems, invokeDeviceSystemInitialize, invokeDeviceSystemInitialize, toString
addPropertyChangeListener, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener
public static final int FEATURE_AGC
DeviceSystem.getFeatures()
in order to
indicate that the respective AudioSystem supports toggling its
automatic gain control (AGC) functionality between on and off. The UI
will look for the presence of the flag in order to determine whether a
check box is to be shown to the user to enable toggling the automatic
gain control (AGC) functionality.public static final int FEATURE_DENOISE
DeviceSystem.getFeatures()
in order to
indicate that the respective AudioSystem supports toggling its
denoise functionality between on and off. The UI will look for the
presence of the flag in order to determine whether a check box is to be
shown to the user to enable toggling the denoise functionality.public static final int FEATURE_ECHO_CANCELLATION
DeviceSystem.getFeatures()
in order to
indicate that the respective AudioSystem supports toggling its
echo cancellation functionality between on and off. The UI will look for
the presence of the flag in order to determine whether a check box is to
be shown to the user to enable toggling the echo cancellation
functionality.public static final int FEATURE_NOTIFY_AND_PLAYBACK_DEVICES
DeviceSystem.getFeatures()
in order to
indicate that the respective AudioSystem differentiates between
playback and notification audio devices. The UI, for example, will look
for the presence of the flag in order to determine whether separate combo
boxes are to be shown to the user to allow the configuration of the
preferred playback and notification audio devices.public static final java.lang.String LOCATOR_PROTOCOL_AUDIORECORD
public static final java.lang.String LOCATOR_PROTOCOL_AUDIOSILENCE
public static final java.lang.String LOCATOR_PROTOCOL_JAVASOUND
public static final java.lang.String LOCATOR_PROTOCOL_MACCOREAUDIO
public static final java.lang.String LOCATOR_PROTOCOL_OPENSLES
public static final java.lang.String LOCATOR_PROTOCOL_PORTAUDIO
public static final java.lang.String LOCATOR_PROTOCOL_PULSEAUDIO
public static final java.lang.String LOCATOR_PROTOCOL_WASAPI
protected static final java.lang.String PNAME_DENOISE
protected static final java.lang.String PNAME_ECHOCANCEL
protected AudioSystem(java.lang.String locatorProtocol) throws java.lang.Exception
java.lang.Exception
protected AudioSystem(java.lang.String locatorProtocol, int features) throws java.lang.Exception
java.lang.Exception
public static AudioSystem getAudioSystem(java.lang.String locatorProtocol)
public static AudioSystem[] getAudioSystems()
public javax.media.Renderer createRenderer()
createRenderer(boolean)
with the value of the
playback argument set to true.createRenderer
in class DeviceSystem
public javax.media.Renderer createRenderer(boolean playback)
DeviceSystem.createRenderer()
.playback
- true if the new instance is to perform playback
or false if the new instance is to sound a notificationpublic java.io.InputStream getAudioInputStream(java.lang.String uri) throws java.io.IOException
uri
- a valid uri to a sound resource.java.io.IOException
- if an I/O exception occurspublic CaptureDeviceInfo2 getDevice(AudioSystem.DataFlow dataFlow, javax.media.MediaLocator locator)
dataFlow
- the flow of the media data supported by the
CaptureDeviceInfo2 to be returnedlocator
- the MediaLocator of the
CaptureDeviceInfo2 to be returnedpublic java.util.List<CaptureDeviceInfo2> getDevices(AudioSystem.DataFlow dataFlow)
dataFlow
- the data flow of the devices to retrieve: capture, notify
or playbackpublic javax.media.format.AudioFormat getFormat(java.io.InputStream audioInputStream)
audioInputStream
- the InputStream providing audio media to
determine the FMJ format ofprotected java.lang.String getPropertyName(java.lang.String basePropertyName)
basePropertyName
- the (base) AudioSystem-specific property
name of which the associated (full) ConfigurationService
property name is to be returnedpublic CaptureDeviceInfo2 getSelectedDevice(AudioSystem.DataFlow dataFlow)
dataFlow
- the data flow of the selected device to retrieve:
capture, notify or playback.public boolean isAutomaticGainControl()
public boolean isDenoise()
public boolean isEchoCancel()
protected void postInitialize() throws java.lang.Exception
DeviceSystem.initialize()
after the
execution of DeviceSystem.doInitialize()
regardless of whether the latter
completed successfully. The implementation of DeviceSystem fires
a new PropertyChangeEvent to notify that the value of the
property DeviceSystem.PROP_DEVICES
of this instance may have changed i.e.
that the list of devices detected by this instance may have changed.
Because AudioSystem may support playback and notification audio
devices apart from capture audio devices, fires more specific
PropertyChangeEvents than DeviceSystempostInitialize
in class DeviceSystem
java.lang.Exception
protected void postInitializeSpecificDevices(AudioSystem.DataFlow dataFlow)
dataFlow
- the data flow of the devices to perform
post-initialization onprotected void preInitialize() throws java.lang.Exception
DeviceSystem.initialize()
before the
execution of DeviceSystem.doInitialize()
. The implementation of
DeviceSystem removes from FMJ's CaptureDeviceManager
the CaptureDeviceInfos whose MediaLocator has the same
protocol as DeviceSystem.getLocatorProtocol()
of this instance.
Removes any capture, playback and notification devices previously
detected by this AudioSystem and prepares it for the execution
of its DeviceSystem.doInitialize()
implementation (which detects
all devices to be provided by this instance).preInitialize
in class DeviceSystem
java.lang.Exception
void propertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
property
- the name of the property of this
PropertyChangeNotifier which had its value changedoldValue
- the value of the property with the specified name before
the changenewValue
- the value of the property with the specified name after
the changepublic void setAutomaticGainControl(boolean automaticGainControl)
automaticGainControl
- true if automatic gain control (AGC)
is to be performed for captured audio; otherwise, falseprotected void setCaptureDevices(java.util.List<CaptureDeviceInfo2> captureDevices)
captureDevices
- The list of a kind of devices: capture, notify or
playback.public void setDenoise(boolean denoise)
denoise
- true if noise suppression is to be performed for
captured audio; otherwise, falsepublic void setDevice(AudioSystem.DataFlow dataFlow, CaptureDeviceInfo2 device, boolean save)
dataFlow
- the data flow of the device to set: capture, notify or
playbackdevice
- The selected active device.save
- Flag set to true in order to save this choice in the
configuration. False otherwise.public void setEchoCancel(boolean echoCancel)
echoCancel
- true if echo cancellation is to be performed
for captured audio; otherwise, falseprotected void setPlaybackDevices(java.util.List<CaptureDeviceInfo2> playbackDevices)
playbackDevices
- The list of the active devices.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.